mirror of
https://github.com/org-roam/org-roam
synced 2025-08-03 12:27:23 -05:00
Compare commits
53 Commits
v1.0.0-rc1
...
v1.0.0
Author | SHA1 | Date | |
---|---|---|---|
1433dbc316 | |||
def3d27d25 | |||
6fae1d8100 | |||
07672213b6 | |||
5406827451 | |||
214a8f771f | |||
57f5e73192 | |||
1352809451 | |||
8b37135aa2 | |||
159e11c842 | |||
63b2eaaf86 | |||
919d08732c | |||
97dfc4b980 | |||
4556f727ff | |||
6775f15ad1 | |||
8f8ccf6797 | |||
81dd880357 | |||
c14ac7b613 | |||
08667d9c7d | |||
f544bd9ca1 | |||
66aff57cdb | |||
f238e3fe02 | |||
98fc273a0f | |||
a4df95b518 | |||
6f1154c90e | |||
486ba9c5a8 | |||
d28a83c992 | |||
62ed117eb6 | |||
a44b847596 | |||
e64890c80e | |||
4eaf69465e | |||
0950ae3cc6 | |||
0cab668d9e | |||
6095d01ef4 | |||
bd425e4427 | |||
65ead3c9ed | |||
be1d1f1d7b | |||
f5d5b83b49 | |||
8a3945945b | |||
7f09c76baf | |||
f6e75f995a | |||
6ba9ffe9c8 | |||
5e0b7440a3 | |||
d16d001b9e | |||
f67e0b025a | |||
b836f9fc35 | |||
e138056115 | |||
63e0558d96 | |||
3fccaef967 | |||
6eb7238daf | |||
fc79901682 | |||
46afa483a9 | |||
f63f29ac05 |
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@ -38,7 +38,6 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
emacs_version:
|
||||
- 26.3
|
||||
- snapshot
|
||||
steps:
|
||||
- uses: purcell/setup-emacs@master
|
||||
|
29
CHANGELOG.md
29
CHANGELOG.md
@ -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)
|
||||
|
47
README.md
47
README.md
@ -1,29 +1,29 @@
|
||||
[![License GPL 3][badge-license]](http://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
[](https://org-roam.readthedocs.io/en/latest/?badge=latest)
|
||||
[](https://img.shields.io/github/v/release/jethrokuan/org-roam)
|
||||
[](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
145
company-org-roam.el
Normal 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
|
@ -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'`.
|
||||
|
BIN
doc/images/company-org-roam.gif
Normal file
BIN
doc/images/company-org-roam.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 120 KiB |
@ -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).
|
||||
|
@ -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
23
doc/org_export.md
Normal 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)
|
||||
```
|
@ -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`:
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)
|
||||
|
744
org-roam.el
744
org-roam.el
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user