Compare commits

...

53 Commits

Author SHA1 Message Date
1433dbc316 (release): v1.0.0 (#341) 2020-03-23 15:34:21 +08:00
def3d27d25 (internal): small refactor (#340) 2020-03-22 12:12:40 +08:00
6fae1d8100 (chore): update internal Github settings (#339)
Removes sponsor button, and disables 26.3 in testing matrix
2020-03-22 11:37:23 +08:00
07672213b6 (chore): fix bytecompile errors and checkdoc errors (#338) 2020-03-22 03:16:38 +08:00
5406827451 (internal): use org-link-make-string (#337)
This takes care of properly escaping backslashes in file names.
2020-03-22 02:46:36 +08:00
214a8f771f (internal): reduce org-roam capture template key pollution (#336)
Following #332, nest all org-roam related customization in to a single
key.
2020-03-22 00:13:19 +08:00
57f5e73192 (internal): force a reconnect on org-roam-build-cache (#335)
This is to guard against scenarios where a db connection is still live, although it
may already be invalid (like in #331)
2020-03-21 22:30:30 +08:00
1352809451 ensure "%?" is present in the template string (#330)
* ensure "%?" is present in the template string

- addresses #298
- fixes `org-capture-place-plain-text` throwing 'invalid search bound'
  when both :unnarowed t and "%?" is missing from the template string

* ensure "%?" is present in the template string

- if "%?" is missing, add it at the end of the template
2020-03-21 20:56:20 +08:00
N V
8b37135aa2 (internal): refactor to remove hooks in a loop (#334)
Removing hooks in a loop should be easier to extend/maintain.
More "DRY" than repeating calls to `remove-hook'.

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2020-03-21 12:43:11 +08:00
N V
159e11c842 (internal): update cl.el functions to cl-lib versions (#333)
cl is a deprecated library. cl-lib replaces it.
2020-03-21 12:40:13 +08:00
63b2eaaf86 (bugfix): throw an error on nested org-roam capture processes (#329) 2020-03-20 20:17:56 +08:00
919d08732c (bugfix): fix nested org-roam-inserts not working (#328) 2020-03-20 00:57:32 +08:00
97dfc4b980 (bugfix): fix `org-roam--completing-read' for ido (#324)
For `ido-completing-read', `choices' must be a list of strings
2020-03-19 16:23:04 +08:00
4556f727ff (bugfix): fix org-roam-capture not saving file, and org-roam date functions (#321)
* (bugfix): fix org-roam-captures not saving file

* (bugfix): fix org-roam date functions
2020-03-18 01:11:08 +08:00
6775f15ad1 (bugfix): prevent file open if capture is cancelled (#316) 2020-03-17 17:20:55 +08:00
8f8ccf6797 (feat): clean-ups for org-roam-capture system (#315)
This introduces 2 user-facing changes:

1. If a capture process is aborted, the file is not created if it
doesn't yet exist

2. If a capture process is aborted, org-roam-insert will not insert a
link
2020-03-17 17:06:49 +08:00
81dd880357 (bugfix): fix ugly node labels in org-roam graph (#314) 2020-03-17 13:00:45 +08:00
c14ac7b613 (bugfix): fix Helm completing-read containing extra spaces on non-match (#309) 2020-03-16 17:42:57 +08:00
08667d9c7d (bugfix): Fix Helm integration for completing-read (#306)
Fixes #304, using PR #305 as the base, thanks @khinsen
2020-03-16 13:00:12 +08:00
f544bd9ca1 hexify file url for org-protocol link (#299)
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2020-03-15 21:55:54 +08:00
66aff57cdb (bugfix): capture: prepend header template only on new file (#302) 2020-03-15 21:50:25 +08:00
f238e3fe02 (feat): order backlinks by filename (#300)
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2020-03-15 15:26:24 +08:00
98fc273a0f (internal): less abusive use of org-capture (#294)
`org-roam--capture-new-file` does not write anything to a file, all the templating is delegated to vanilla `org-capture`
2020-03-15 13:41:36 +08:00
a4df95b518 Create FUNDING.yml 2020-03-14 17:52:51 +08:00
6f1154c90e (bugfix): remove nonexistent/redundant code (#297) 2020-03-14 14:55:53 +08:00
486ba9c5a8 (feat): upgrade org-roam-graph-exclude-matcher to accept a list (#296)
Closes #295
2020-03-14 01:17:32 +08:00
d28a83c992 (bugfix): fix unintuitive behaviour of capture insertion (#293)
Ref #285
2020-03-13 18:13:04 +08:00
62ed117eb6 (feat): Support multiple org-roam-directories for company backend (#292)
Fixes #276
2020-03-13 14:03:53 +08:00
a44b847596 (docs): add documentation for using neato (#291)
Some prefer using neato for generating a graph (ref #263). This
documents how to do so.
2020-03-13 13:37:55 +08:00
e64890c80e (feat): add org-roam-date-title-format and org-roam-date-filename-format (#290)
This PR supercedes #280. It allows users who use the date
functionality in Org-roam to customize the filename and title formats
of the created files.
2020-03-13 13:29:49 +08:00
4eaf69465e (feat): add 'ido and 'ivy support for completing-read (#289)
Also adds org-roam-fuzzy-match, which for ivy and helm controls
whether completion candidates are fuzzy matched.
2020-03-13 13:11:22 +08:00
0950ae3cc6 (feature): add support for Helm's completion system (#284)
adds org-roam-completion-system, supporting helm as the default completion option.
2020-03-12 19:34:27 +08:00
0cab668d9e (bugfix): propagate org-roam-directory to temp buffers (#275) 2020-03-11 15:41:18 +08:00
6095d01ef4 (feat): add a company-mode for link completion (#257)
Adds company-org-roam, a company backend which autocompletes text into org file links
2020-03-11 14:32:58 +08:00
bd425e4427 (docs):fix typo in platypus installation (#274) 2020-03-11 11:37:01 +08:00
65ead3c9ed (chore): fix more checkdoc errors (#270) 2020-03-11 00:55:42 +08:00
be1d1f1d7b (feat): add org-roam-graphviz-extra-options (#269) 2020-03-11 00:44:07 +08:00
f5d5b83b49 (bugfix): fix missed org-roam-link-title-format uses (#268)
In #261 we allowed org-roam-link-title-format to be a function, but missed some of its uses during the update. h.t. @alanz
2020-03-11 00:34:08 +08:00
8a3945945b (bugfix): emove duplicate line from `org-roam--db-clear' (#267) 2020-03-10 15:35:34 +08:00
7f09c76baf (fix): allow org-roam-insert in Org-roam file indirect buffers (#266) 2020-03-10 10:57:49 +08:00
f6e75f995a (chore): cleanup buffer-file-name calls (#265)
buffer-file-name uses the current-buffer if the argument is not passed
2020-03-10 10:41:43 +08:00
6ba9ffe9c8 (fix): Error if org-roam-insert is not called from Org-roam file (#264) 2020-03-10 10:36:36 +08:00
5e0b7440a3 (feat): Allow function for org-roam-link-title-format (#261)
Addresses #255
2020-03-09 22:18:04 +08:00
d16d001b9e (feat): add optional initial-prompt to org-roam-find-file (#259) 2020-03-09 16:43:48 +08:00
f67e0b025a (docs): fix typo in vanilla installation (#254) 2020-03-08 20:49:17 +08:00
b836f9fc35 (bugfix): Don't query about SQL proccess on Emacs exit (#253)
Graceful shutdown is already guaranteed via `kill-emacs-hook`.

Refs #200

Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
2020-03-08 19:57:48 +08:00
e138056115 (docs): fix documentation for manual installation (#252) 2020-03-08 17:43:07 +08:00
63e0558d96 (chore): Cleanups for MELPA release (#251)
* (chore): require minimum Org version 9.3

* fix bytecompile errors for org-roam.el

* fix checkdoc errors

* fix more things
2020-03-08 15:58:13 +08:00
3fccaef967 (chore): change main branch to master (#250) 2020-03-08 15:05:57 +08:00
6eb7238daf (feature): add org-roam-backlink face (#247) 2020-03-08 14:54:56 +08:00
fc79901682 (chore): drop org-roam-filename-noconfirm (#248)
With org-capture integration, it does not seem to be used anymore.
2020-03-08 11:15:41 +08:00
46afa483a9 (docs): add documentation for exporting backlinks in Org file (#244)
h.t. @jdiez17
2020-03-07 23:49:43 +08:00
f63f29ac05 (docs): Add link to slack invite (#242) 2020-03-07 15:05:16 +08:00
13 changed files with 835 additions and 326 deletions

View File

@ -38,7 +38,6 @@ jobs:
fail-fast: false
matrix:
emacs_version:
- 26.3
- snapshot
steps:
- uses: purcell/setup-emacs@master

View File

@ -1,5 +1,22 @@
# Changelog
## 1.0.0 (23-03-2020)
Org-roam is now on MELPA! We have squashed most of the bugs, and Org-roam has
been stable for the most part.
## New Features
* [#269][gh-269] Add `org-roam-graphviz-extra-options`
* [#257][gh-257] Add a company-backend `company-org-roam`
* [#284][gh-284], [#289][gh-289] Configurable `org-roam-completion-system` with options `'default`, `'ido`, `'ivy` and `'helm`
* [#289][gh-289] Add customizable `org-roam-fuzzy-match` to allow fuzzy-matching of candidates
* [#290][gh-290] Add `org-roam-date-title-format` and `org-roam-date-filename-format` for customizing Org-roam's date files
* [#296][gh-296] Allow multiple exclusion matchers in `org-roam-graph-exclude-matcher`
## Bugfixes
* [#293][gh-293] Fix capture templates not working as expected for `org-roam-find-file`
* [#275][gh-275] Fix database rebuild when `org-roam-directory` is set locally
## 1.0.0-rc1 (06-03-2020)
This is a pre-release before the push to MELPA. It contains large
@ -16,6 +33,8 @@ templating system using `org-capture` is introduced.
* [#216][gh-216] Adds templating functionality by extending org-capture.
* [#232][gh-232] Adds a prefix key to `org-roam-show-graph`, to generate graph without opening it.
* [#233][gh-233] Adds `org-roam-graph-exclude-matcher`, which allows exclusion of nodes from graph.
* [#247][gh-247] Add `org-roam-backlink` face, which allows customizing backlinks appearance
* [#259][gh-259] Add optional initial-prompt to `org-roam-find-file`
### Bugfixes
* [#207][gh-207], [#221][gh-221] small bugfixes to Org-roam graph generation
@ -119,6 +138,16 @@ Mostly a documentation/cleanup release.
[gh-216]: https://github.com/jethrokuan/org-roam/pull/216
[gh-221]: https://github.com/jethrokuan/org-roam/pull/221
[gh-230]: https://github.com/jethrokuan/org-roam/pull/230
[gh-247]: https://github.com/jethrokuan/org-roam/pull/247
[gh-257]: https://github.com/jethrokuan/org-roam/pull/257
[gh-259]: https://github.com/jethrokuan/org-roam/pull/259
[gh-269]: https://github.com/jethrokuan/org-roam/pull/269
[gh-275]: https://github.com/jethrokuan/org-roam/pull/275
[gh-284]: https://github.com/jethrokuan/org-roam/pull/284
[gh-289]: https://github.com/jethrokuan/org-roam/pull/289
[gh-290]: https://github.com/jethrokuan/org-roam/pull/290
[gh-293]: https://github.com/jethrokuan/org-roam/pull/293
[gh-296]: https://github.com/jethrokuan/org-roam/pull/296
# Local Variables:
# eval: (auto-fill-mode -1)

View File

@ -1,29 +1,29 @@
[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
[![Documentation Status](https://readthedocs.org/projects/org-roam/badge/?version=latest)](https://org-roam.readthedocs.io/en/latest/?badge=latest)
[![GitHub Release](https://img.shields.io/github/v/release/jethrokuan/org-roam)](https://img.shields.io/github/v/release/jethrokuan/org-roam)
[![MELPA](https://melpa.org/packages/org-roam-badge.svg)](https://melpa.org/#/org-roam)
## Synopsis
Org-roam is a rudimentary [Roam][roamresearch] replica built around
the all-powerful [Org-mode][org].
Org-roam is a [Roam][roamresearch] replica built on top of the
all-powerful [Org-mode][org].
Like Roam, Org-roam offers a powerful and effortless non-hierarchical
note-taking approach. With Org-roam, notes flow naturally, making
note-taking fun and easy. Org-roam *enables* a note-taking workflow that
is not fluid with vanilla Org-mode (more in [this blog
post](https://blog.jethro.dev/posts/how_to_take_smart_notes_org/)).
Org-roam is a solution for effortless non-hierarchical note-taking
with Org-mode. With Org-roam, notes flow naturally, making note-taking
fun and easy. Org-roam should also work as a plug-and-play solution
for anyone already using Org-mode for their personal wiki.
The goal of the project is to implement core features of Roam around
Org-mode, and eventually introduce features enabled by the Emacs
ecosystem.
Visit [the documentation
page](https://org-roam.readthedocs.io/en/latest/) for a tutorial and
more links.
Org-roam aims to implement the core features of Roam, leveraging the
mature ecosystem around Org-mode where possible. Eventually, we hope
to further introduce features enabled by the Emacs ecosystem.
As of February 2020, it is in a very early stage of development.
Important links:
- **[Documentation][docs]**
- **[Org-roam Slack][slack]**
## A Preview
Here's a screenshot of `org-roam`. The `org-roam` buffer shows
@ -36,13 +36,18 @@ structure, and can be used to navigate to the respective files.
## Installation
The recommended method is using use-package and straight, or a similar package manager.
You can install `org-roam` using `package.el`:
```
M-x package-install RET org-roam RET
```
Here's a sample configuration with using `use-package`:
```emacs-lisp
(use-package org-roam
:hook
(after-init . org-roam-mode)
:straight (:host github :repo "jethrokuan/org-roam" :branch "develop")
:custom
(org-roam-directory "/path/to/org-files/")
:bind (:map org-roam-mode-map
@ -53,9 +58,9 @@ The recommended method is using use-package and straight, or a similar package m
(("C-c n i" . org-roam-insert))))
```
For more detailed installation instructions (including instructions for
Spacemacs users), please see [the installation
documentation](https://org-roam.readthedocs.io/en/develop/installation/).
For more detailed installation and configuration instructions (including for
Doom and Spacemacs users), please see [the
documentation](https://org-roam.readthedocs.io/en/master/installation/).
## Knowledge Bases using Org-roam
@ -80,3 +85,5 @@ General Public License, Version 3
[roamresearch]: https://www.roamresearch.com/
[org]: https://orgmode.org/
[badge-license]: https://img.shields.io/badge/license-GPL_3-green.svg
[docs]: https://org-roam.readthedocs.io/
[slack]: https://join.slack.com/t/orgroam/shared_invite/zt-clh0g0tx-j8xg1kVxnrWdKt16gmSGPQ

145
company-org-roam.el Normal file
View File

@ -0,0 +1,145 @@
;;; company-org-roam.el --- Company backend for Org-roam
;; Copyright © 2020 Jethro Kuan <jethrokuan95@gmail.com>
;; Author: Jethro Kuan <jethrokuan95@gmail.com>
;; URL: https://github.com/jethrokuan/org-roam
;; Keywords: org-mode, roam, convenience
;; Version: 1.0.0-rc1
;; Package-Requires: ((emacs "26.1") (company "0.9.0"))
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; `company-org-roam' is a `company' completion backend for Org-roam.
;; To use it, add `company-org-roam' to `company-backends':
;; (require 'company-org-roam)
;; (company-org-roam-init)
;;; Code:
(require 'cl-lib)
(require 'company)
(require 'org-roam)
(defgroup company-org-roam nil
"Company completion backend for Org-roam."
:prefix "company-org-roam-"
:group 'org-roam)
(defcustom company-org-roam-cache-expire 10
"Number of seconds before the caches expire.
A value of nil means the caches never expire."
:type '(integer :tag "Seconds")
:group 'company-org-roam)
(defvar company-org-roam-last-cache-time (make-hash-table :test #'equal)
"Time of last cache.")
(defvar company-org-roam-cache (make-hash-table :test #'equal)
"In-memory cache for completions.")
(defun company-org-roam-time-seconds ()
"Return the number of seconds since the unix epoch."
(cl-destructuring-bind (high low _usec _psec) (current-time)
(+ (lsh high 16) low)))
(defun company-org-roam--post-completion (candidate)
"The post-completion action for `company-org-roam'.
It deletes the inserted CANDIDATE, and replaces it with a
relative file link."
(let* ((cache (gethash (file-truename org-roam-directory) company-org-roam-cache))
(path (gethash candidate cache))
(current-file-path (-> (or (buffer-base-buffer)
(current-buffer))
(buffer-file-name)
(file-truename)
(file-name-directory))))
(delete-region (- (point) (length candidate)) (point))
(insert (format "[[file:%s][%s]]"
(file-relative-name path current-file-path)
candidate))))
(defun company-org-roam--filter-candidates (prefix candidates)
"Filter CANDIDATES that start with PREFIX.
The string match is case-insensitive."
(-filter (lambda (candidate)
(s-starts-with-p prefix candidate t)) candidates))
(defun company-org-roam--update-cache ()
"Update the cache with new entries.
Entries with no title do not appear in the completions."
(let ((dir (file-truename org-roam-directory))
(ht (make-hash-table :test #'equal)))
(dolist (row (org-roam-sql [:select [titles file] :from titles]))
(let ((titles (car row))
(file (cadr row)))
(dolist (title titles)
(puthash title file ht))))
(puthash dir ht company-org-roam-cache)))
(defun company-org-roam--cache-get-titles ()
"Return all the titles."
(let* ((dir (file-truename org-roam-directory))
(last-cache-time (gethash dir company-org-roam-last-cache-time))
(curr-time (company-org-roam-time-seconds)))
(when (or (null last-cache-time)
(< (+ last-cache-time company-org-roam-cache-expire)
curr-time))
(puthash dir curr-time company-org-roam-last-cache-time)
(company-org-roam--update-cache))
(hash-table-keys (gethash dir company-org-roam-cache))))
(defun company-org-roam--get-candidates (prefix)
"Get the candidates for PREFIX."
(->> (company-org-roam--cache-get-titles)
(-flatten)
(company-org-roam--filter-candidates prefix)))
;;;###autoload
(defun company-org-roam (command &optional arg &rest _)
"Define a company backend for Org-roam.
COMMAND and ARG are as per the documentation of `company-backends'."
(interactive (list 'interactive))
(cl-case command
(interactive (company-begin-backend #'company-org-roam))
(prefix
(and
(bound-and-true-p org-roam-mode)
(or (company-grab-symbol) 'stop)))
(candidates
(company-org-roam--get-candidates arg))
(post-completion (company-org-roam--post-completion arg))))
(defun company-org-roam--init-hook ()
"Conditional enabling of the `company-org-roam' backend."
(when (org-roam--org-roam-file-p (buffer-file-name (buffer-base-buffer)))
(setq-local company-backends
(cons'company-org-roam company-backends))))
;;;###autoload
(defun company-org-roam-init ()
"Injects `company-org-roam' as a completion backend."
(add-hook 'org-mode-hook #'company-org-roam--init-hook))
(provide 'company-org-roam)
;;; company-org-roam.el ends here

View File

@ -53,6 +53,9 @@ frame width. For example:
Will result in the Org-roam buffer taking up 40% of the screen width.
You can change backlinks appearance in the buffer by customizing
`org-roam-backlink` face (`M-x customize-face org-roam-backlink`).
## Org-roam Links
By default, links are inserted with the title as the link description.
@ -65,7 +68,7 @@ choose add special indicators for Org-roam links by tweaking
```
If your version of Org is at least `9.2`, you may also choose to
simply style the link differently, by customizing `org-roam-link-face`
simply style the link differently, by customizing `org-roam-link` face
(`M-x customize-face org-roam-link`).
## Org-roam Files
@ -98,9 +101,42 @@ Org-roam tries its best to locate the Graphviz executable from your
(setq org-roam-graphviz-executable "/path/to/dot")
```
You may also choose to use `neato` in place of `dot`, which generates a more compact graph layout.
```
(setq org-roam-graphviz-executable "/path/to/neato")
(setq org-roam-graphviz-extra-options '(("overlap" . "false")))
```
Org-roam also attempts to use Firefox (located on `PATH`) to view the
SVG, you may choose to set it to any compatible program:
```
(setq org-roam-graph-viewer "/path/to/image-viewer")
```
### Excluding Nodes and Edges
One may want to exclude certain files to declutter the graph. You can do so by setting `org-roam-graph-exclude-matcher`.
```
(setq org-roam-graph-exclude-matcher '("private" "dailies"))
```
This setting excludes all files whose path contain "private" or "dailies".
## Org-roam Completion System
Org-roam offers completion when choosing note titles etc.
The completion system is configurable. The default setting,
```
(setq org-roam-completion-system 'default)
```
uses Emacs' standard `completing-read`. If you prefer [Helm](https://emacs-helm.github.io/helm/), use
```
(setq org-roam-completion-system 'helm)
```
Other options included `'ido`, and `'ivy'`.

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

View File

@ -5,11 +5,10 @@
Org-roam is a [Roam][roamresearch] replica built around the
all-powerful [Org-mode][org].
Org-roam is a solution for effortless non-hierarchical note-taking,
building upon Org-mode. This solution is heavily inspired by [Roam
Research][roamresearch]. With Org-roam, notes flow naturally, making
note-taking fun and easy. Org-roam should also work as a plug-and-play
solution for anyone already using Org-mode for their personal wiki.
Org-roam is a solution for effortless non-hierarchical note-taking
with Org-mode. With Org-roam, notes flow naturally, making note-taking
fun and easy. Org-roam should also work as a plug-and-play solution
for anyone already using Org-mode for their personal wiki.
To understand more about Roam, a collection of links are available in
[the appendix](notetaking_workflow.md).

View File

@ -1,13 +1,21 @@
## Installation
## Basic Install and Configuration
The recommended method is using [use-package][use-package] and
[straight][straight], or a similar package manager.
Org-roam is now available on MELPA, so you can install it via the following
command:
```
M-x package-install RET org-roam RET
```
Alternatively, you may use package managers such as [straight][straight] or
[quelpa][quelpa] to install the package.
The recommended method of configuration is to use [use-package][use-package].
```emacs-lisp
(use-package org-roam
:hook
(after-init . org-roam-mode)
:straight (:host github :repo "jethrokuan/org-roam" :branch "develop")
:custom
(org-roam-directory "/path/to/org-files/")
:bind (:map org-roam-mode-map
@ -19,82 +27,55 @@ The recommended method is using [use-package][use-package] and
(("C-c n i" . org-roam-insert))))
```
If not using package.el, you can also clone it into your Emacs
directory and add it to your load path:
```
git clone https://github.com/jethrokuan/org-roam/ ~/.emacs.d/elisp/org-roam
```
```emacs-lisp
(use-package org-roam
:load-path "elisp/"
:hook
(after-init . org-roam-mode)
:straight (:host github :repo "jethrokuan/org-roam" :branch "develop")
:custom
(org-roam-directory "/path/to/org-files/")
:bind (:map org-roam-mode-map
(("C-c n l" . org-roam)
("C-c n f" . org-roam-find-file)
("C-c n b" . org-roam-switch-to-buffer)
("C-c n g" . org-roam-show-graph))
:map org-mode-map
(("C-c n i" . org-roam-insert))))
```
Or without `use-package`:
```emacs-lisp
(add-to-list 'load-path "./elisp")
(require 'org-roam)
(define-key 'org-roam-mode-map (kbd "C-c n l") #'org-roam)
(define-key 'org-roam-mode-map (kbd "C-c n f") #'org-roam-find-file)
(define-key 'org-roam-mode-map (kbd "C-c n b") #'org-roam-switch-to-buffer)
(define-key 'org-roam-mode-map (kbd "C-c n g") #'org-roam-switch-to-buffer)
(define-key 'org-mode-map (kbd "C-c n i") #'org-roam-insert)
(define-key org-roam-mode-map (kbd "C-c n l") #'org-roam)
(define-key org-roam-mode-map (kbd "C-c n f") #'org-roam-find-file)
(define-key org-roam-mode-map (kbd "C-c n b") #'org-roam-switch-to-buffer)
(define-key org-roam-mode-map (kbd "C-c n g") #'org-roam-show-graph)
(define-key org-mode-map (kbd "C-c n i") #'org-roam-insert)
(org-roam-mode +1)
```
The [Configuration](configuration.md) page details some of the common
configuration options available.
[use-package]: https://github.com/jwiegley/use-package
[straight]: https://github.com/raxod502/straight.el
## Spacemacs
If you are using Spacemacs, install org-roam by creating a simple
layer that wraps Org-roam. Paste the following into a new file
If you are using Spacemacs, install org-roam by creating a simple layer that
wraps Org-roam. Paste the following into a new file
`~/.emacs.d/private/org-roam/packages.el`.
```emacs-lisp
(defconst org-roam-packages
'((org-roam :location
(recipe :fetcher github :repo "jethrokuan/org-roam" :branch "develop"))))
(recipe :fetcher github :repo "jethrokuan/org-roam"))))
(defun org-roam/init-org-roam ()
(use-package org-roam
:hook
(after-init . org-roam-mode)
:custom
(org-roam-directory "/path/to/org-files/")
:init
(progn
(spacemacs/declare-prefix "ar" "org-roam")
(spacemacs/set-leader-keys
"arl" 'org-roam
"art" 'org-roam-today
"arf" 'org-roam-find-file
"arg" 'org-roam-show-graph)
(use-package org-roam
:hook
(after-init . org-roam-mode)
:custom
(org-roam-directory "/path/to/org-files/")
:init
(progn
(spacemacs/declare-prefix "ar" "org-roam")
(spacemacs/set-leader-keys
"arl" 'org-roam
"art" 'org-roam-today
"arf" 'org-roam-find-file
"arg" 'org-roam-show-graph)
(spacemacs/declare-prefix-for-mode 'org-mode "mr" "org-roam")
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"rl" 'org-roam
"rt" 'org-roam-today
"rb" 'org-roam-switch-to-buffer
"rf" 'org-roam-find-file
"ri" 'org-roam-insert
"rg" 'org-roam-show-graph))))
(spacemacs/declare-prefix-for-mode 'org-mode "mr" "org-roam")
(spacemacs/set-leader-keys-for-major-mode 'org-mode
"rl" 'org-roam
"rt" 'org-roam-today
"rb" 'org-roam-switch-to-buffer
"rf" 'org-roam-find-file
"ri" 'org-roam-insert
"rg" 'org-roam-show-graph))))
```
Next, append `org-roam` to the `dotspacemacs-configuration-layers`
@ -104,7 +85,8 @@ the prefix `SPC a r` and `, r` when visiting an org-mode buffer.
## Doom Emacs
If you are using [Doom Emacs](https://github.com/hlissner/doom-emacs), configure packages as explained in the [getting started](https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#configuring-packages) guide.
If you are using [Doom Emacs][doom], configure packages as explained in the
[getting started][doom-getting-started] guide.
Declare Org-roam as a package in your `~/.doom.d/packages.el`:
@ -112,7 +94,7 @@ Declare Org-roam as a package in your `~/.doom.d/packages.el`:
;; ~/.doom.d/packages.el
(package! org-roam
:recipe (:host github :repo "jethrokuan/org-roam" :branch "develop"))
:recipe (:host github :repo "jethrokuan/org-roam"))
```
Subsequently, in your `~/.doom.d/config.el` file, configure Org-roam:
@ -131,3 +113,9 @@ Subsequently, in your `~/.doom.d/config.el` file, configure Org-roam:
:config
(org-roam-mode +1))
```
[use-package]: https://github.com/jwiegley/use-package
[straight]: https://github.com/raxod502/straight.el
[quelpa]: https://github.com/quelpa/quelpa
[doom]: https://github.com/hlissner/doom-emacs
[doom-getting-started]: https://github.com/hlissner/doom-emacs/blob/develop/docs/getting_started.org#configuring-packages

23
doc/org_export.md Normal file
View File

@ -0,0 +1,23 @@
To include the backlinks in your Org file export -- whether using Org's
in-built publishing or ox-hugo -- use the following snippet to add a
"Backlinks" section at the end of the page:
```emacs-lisp
(defun my/org-roam--backlinks-list (file)
(if (org-roam--org-roam-file-p file)
(--reduce-from
(concat acc (format "- [[file:%s][%s]]\n"
(file-relative-name (car it) org-roam-directory)
(org-roam--get-title-or-slug (car it))))
"" (org-roam-sql [:select [file-from] :from file-links :where (= file-to $s1)] file))
""))
(defun my/org-export-preprocessor (backend)
(let ((links (my/org-roam--backlinks-list (buffer-file-name))))
(unless (string= links "")
(save-excursion
(goto-char (point-max))
(insert (concat "\n* Backlinks\n") links)))))
(add-hook 'org-export-before-processing-hook 'my/org-export-preprocessor)
```

View File

@ -102,7 +102,7 @@ instructions for setting up with Platypus and Chrome:
1. Install and launch Platypus (with [Homebrew](https://brew.sh/)):
```sh
brew cask install playtpus
brew cask install platypus
```
2. Create a script `launch_emacs.sh`:

View File

@ -3,6 +3,10 @@ repo_url: https://github.com/jethrokuan/org-roam/
edit_uri: edit/master/doc/
copyright: "Copyright (C) 2020 Jethro Kuan and contributors"
docs_dir: doc
extra:
social:
- type: 'slack'
link: 'https://join.slack.com/t/orgroam/shared_invite/zt-clh0g0tx-j8xg1kVxnrWdKt16gmSGPQ'
nav:
- Home: index.md
- A Tour of Org-roam: tour.md
@ -14,6 +18,7 @@ nav:
- Similar Packages: comparison.md
- "Appendix: Note-taking Workflow": notetaking_workflow.md
- "Appendix: Roam Protocol": roam_protocol.md
- "Appendix: Org Export": org_export.md
markdown_extensions:
- admonition
- pymdownx.betterem:

View File

@ -5,7 +5,7 @@
;; URL: https://github.com/jethrokuan/org-roam
;; Keywords: org-mode, roam, convenience
;; Version: 1.0.0-rc1
;; Package-Requires: ((emacs "26.1") (org "9.0"))
;; Package-Requires: ((emacs "26.1") (org "9.3"))
;; This file is NOT part of GNU Emacs.
@ -67,7 +67,7 @@ It opens or creates a note with the given ref.
(val (cdr k.v)))
(cons key (org-link-decode val)))) alist)))
(unless (assoc 'ref decoded-alist)
(error "No ref key provided."))
(error "No ref key provided"))
(when-let ((title (cdr (assoc 'title decoded-alist))))
(push (cons 'slug (org-roam--title-to-slug title)) decoded-alist))
(let* ((org-roam-capture-templates org-roam-ref-capture-templates)

File diff suppressed because it is too large Load Diff