Org-Roam User Manual
Org-Roam User Manual
Org-Roam User Manual
html
• Introduction:
• Target Audience:
• A Brief Introduction to the Zettelkasten Method:
• Installation:
• Getting Started:
• Files:
• The Templating System:
• Concepts and Configuration:
• Inserting Links:
• Completions:
• Navigating Around:
• Encryption:
• Graphing:
• Minibuffer Completion:
• Roam Protocol:
• Daily-notes:
1 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• Fleeting notes:
• Permanent notes:
Installation
Files
• File Titles:
• File Tags:
• File Refs:
File Titles
File Tags
2 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• Template Walkthrough:
• Org-roam Template Expansion:
Completions
• Link Completion:
• Tag Completion:
Link Completion
Navigating Around
• Index File:
Graphing
• Graph Options:
• Excluding Nodes and Edges:
Roam Protocol
• Installation:
• The roam-file protocol:
• The roam-ref protocol:
Daily-notes
• Configuration:
• Capturing and finding daily-notes:
• Navigation:
3 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Performance Optimization
Appendix
• Note-taking Workflows:
• Ecosystem:
Ecosystem
Note-taking Add-ons
• Org-download:
• mathpix.el:
• Org-noter / Interleave:
• Bibliography:
• Spaced Repetition:
FAQ
1 Introduction
Org-roam is a tool for network thought. It reproduces some of
4 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
5 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
2 Target Audience
Org-roam is a tool that will appear unfriendly to anyone
unfamiliar with Emacs and Org-mode, but is also extremely
powerful to those willing to put effort in mastering the intricacies
of the tools. Org-roam stands on the shoulders on giants. Emacs
was first created in 1976, and remains a top tier tool for editing
text and designing textual interfaces. The malleability of Emacs
allowed the creation of Org-mode, an all-purpose plain-text
system for maintaining TODO lists, planning projects, and
authoring documents. Both of these tools are incredibly vast and
require significant time investment to master.
If you are new to the software, and choose to take this leap of
faith, I hope you find yourself equally entranced as Neal
Stephenson was.
6 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• Fleeting notes:
• Permanent notes:
7 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
4 Installation
Org-roam can be installed using Emacs’ package manager or
manually from its development repository.
8 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
archives to ‘package-archives’:
To use Melpa:
(require 'package)
(add-to-list 'package-archives
'("melpa" . "http://melpa.org/packages/") t)
To use Melpa-Stable:
(require 'package)
(add-to-list 'package-archives
'("melpa-stable" . "http://stable.melpa.org/packages/") t)
Once you have done that, you can install Org-roam and its
dependencies using:
9 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Next, you need to add this location to your load path, and
require the Org-roam library. Add the following code to your
.emacs:
dash
f
s
org
emacsql
emacsql-sqlite3
You can install this manually as well, or get the latest version
from MELPA. You may wish to use use-package, straight.el to
help manage this.
10 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
If you would like to install the manual for access from Emacs’
built-in Info system, you’ll need to compile the .texi source file,
and install it in an appropriate location.
(require 'info)
(add-to-list 'Info-default-directory-list
"/path/to/my/info/files")
You can also use one of the default locations, such as:
usr/local/share/info
usr/share/info
usr/local/share/info
Now that the info file is ready, you need to add it to the
corresponding dir file:
11 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
(executable-find "sqlite3")
5 Getting Started
This short tutorial describes the essential commands used in
Org-roam, to help you get started.
(make-directory "~/org-roam")
(setq org-roam-directory "~/org-roam")
12 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
13 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
6 Files
In Org-roam, notes typically consist of multiple files, where each
file is a zettel.
• File Titles:
• File Tags:
• File Refs:
14 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
* Headline
Method Titles
'title ’(“World War 2”)
'headline ’(“Headline”)
'alias ’(“WWII” “World War II”)
15 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
buffer
a list of symbols – symbols in the list are treated as
with (1). The return value of this list is the first symbol
in the list returning a non-nil value.
16 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Adding your own tag extraction method requires two steps. First,
define a method (defun org-roam--extract-tags-foo (file)
...), where foo a self-prescribed name for the tag extraction
method. This method takes the file path as an argument, and
17 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
returns a list of strings (titles). Finally, push the symbol foo into
org-roam-tag-sources. You may need to rebuild the cache
from scratch to re-process all files to pick up the new tags.
Refs are unique identifiers for files. For example, a note for a
website may contain a ref:
#+title: Google
#+roam_key: https://www.google.com/
These keys also come in useful for when taking website notes,
using the roam-ref protocol (see Roam Protocol).
Figure: org-ref-citelink
You may assign multiple refs to a single file, for example when
you want multiple papers in a series to share the same note, or
18 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Time of creation
File it was created from
Clipboard content
Any other data you may want to input manually
• Template Walkthrough:
• Org-roam Template Expansion:
19 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
"%?"
:file-name "%<%Y%m%d%H%M%S>-${slug}"
:head "#+title: ${title}\n"
:unnarrowed t)
The template has short key "d". If you have only one
template, org-roam automatically chooses this template for
you.
The template is given a description of "default".
plain text is inserted. Other options include Org headings
via entry.
(function org-roam--capture-get-point) should not be
changed.
"%?" is the template inserted on each call to org-roam-
capture--capture. This template means don’t insert any
content, but place the cursor here.
:file-name is the file-name template for a new note, if it
doesn’t yet exist. This creates a file at path that looks like
/path/to/org-roam-directory/20200213032037-
foo.org. This template also allows you to specify if you
want the note to go into a subdirectory. For example, the
template private/${slug} will create notes in /path/to
/org-roam-directory/private.
:head contains the initial template to be inserted (once
only), at the beginning of the file. Here, the title global
attribute is inserted.
:unnarrowed t tells org-capture to show the contents for
the whole file, rather than narrowing to just the entry.
20 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
21 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• The Database:
Variable: org-roam-directory
Variable: org-roam-db-location
Variable: org-roam-file-exclude-regexp
22 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
23 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
9 Inserting Links
The preferred mode of linking is via file links to files, and id
links for headlines. This maintains the strongest compatibility
with Org-mode, ensuring that the links still function without Org-
roam, and work well exporting to other backends.
24 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
10 Completions
Completions for Org-roam are provided via completion-at-
point. Completion suggestions are implemented as separate
functions. Org-roam installs all functions in org-roam-
completion-functions to completion-at-point-functions.
Variable: org-roam-completion-functions
25 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• Link Completion:
• Tag Completion:
Function: org-roam-link-complete-at-point
26 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
That is, suppose you have notes with tags “foo”, and “bar”.
Now, in a note, if you’re on a line beginning with #+roam_tags:,
completions for these will appear as-you-type if they match.
11 Navigating Around
• Index File:
27 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Variable: org-roam-index-file
Function: org-roam-find-index
12 Encryption
One may wish to keep private, encrypted files. Org-roam
supports encryption (via GPG), which can be enabled for all new
files by setting org-roam-encrypt-files to t. When enabled,
new files are created with the .org.gpg extension and
decryption are handled automatically by EasyPG.
Note that Emacs will prompt for a password for encrypted files
during cache updates if it requires reading the encrypted file. To
reduce the number of password prompts, you may wish to cache
the password.
13 Graphing
Org-roam provides graphing capabilities to explore
interconnections between notes. This is done by performing SQL
queries and generating images using Graphviz. The graph can
28 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
If you are using WSL2 and would like to open the graph in
Windows, you can use the second option to set the browser
and network file path:
(setq org-roam-graph-viewer
(lambda (file)
(let ((org-roam-graph-viewer "/mnt/c/Program Files/Mozilla Firefox
(org-roam-graph--open (concat "file://///wsl$/Ubuntu" file)))))
29 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• Graph Options:
• Excluding Nodes and Edges:
30 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
14 Minibuffer Completion
Org-roam allows customization of which minibuffer completion
system to use for its interactive commands. The default setting
uses Emacs’ standard completing-read mechanism.
If you have installed Helm or Ivy, and have their modes enabled,
under the 'default setting they will be used.
In the rare scenario where you use Ivy globally, but prefer Helm
for org-roam commands, set:
15 Roam Protocol
Org-roam extends org-protocol with 2 protocols: the roam-
file and roam-ref protocols.
• Installation:
• The roam-file protocol:
• The roam-ref protocol:
31 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
15.1 Installation
(require 'org-roam-protocol)
[Desktop Entry]
Name=Org-Protocol
Exec=emacsclient %u
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol
32 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>org-protocol handler</string>
<key>CFBundleURLSchemes</key>
<array>
<string>org-protocol</string>
</array>
</dict>
</array>
33 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
REGEDIT4
[HKEY_CLASSES_ROOT\org-protocol]
@="URL:Org Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\org-protocol\shell]
[HKEY_CLASSES_ROOT\org-protocol\shell\open]
[HKEY_CLASSES_ROOT\org-protocol\shell\open\command]
@="\"C:\\Windows\\System32\\wsl.exe\" emacsclient \"%1\""
The above will forward the protocol to WSL. If you run Emacs
natively on Windows, replace the last line with:
@="\"c:\\path\\to\\emacs\\bin\\emacsclientw.exe\" \"%1\""
After executing the .reg file, the protocol is registered and you
can delete the file.
34 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
javascript:location.href =
'org-protocol://roam-ref?template=r&ref='
+ encodeURIComponent(location.href)
+ '&title='
+ encodeURIComponent(document.title)
+ '&body='
+ encodeURIComponent(window.getSelection())
16 Daily-notes
Org-roam provides journaling capabilities akin to Org-journal
with org-roam-dailies.
• Configuration:
• Capturing and finding daily-notes:
• Navigation:
35 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
16.1 Configuration
Variable: org-roam-dailies-directory
Path to daily-notes.
Variable: org-roam-dailies-capture-templates
(setq org-roam-dailies-capture-templates
'(("d" "default" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n\n")))
(setq org-roam-dailies-capture-templates
'(("l" "lab" entry
#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n"
:olp ("Lab notes"))
36 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
:olp ("Journal"))))
The template l will put its notes under the heading ‘Lab notes’,
and the template j will put its notes under the heading ‘Journal’.
Function: org-roam-dailies-find-today
Function: org-roam-dailies-find-yesterday
Function: org-roam-dailies-capture-date
37 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Function: org-roam-dailies-find-date
Find the daily note for a date using the calendar, creating it
if necessary.
16.3 Navigation
Function: org-roam-dailies-find-directory
Function: org-roam-dailies-find-previous-note
Function: org-roam-dailies-find-next-note
38 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
properties.
(make-org-roam-doctor-checker
:name 'org-roam-doctor-broken-links
:description "Fix broken links."
:actions '(("d" . ("Unlink" . org-roam-doctor--remove-link))
("r" . ("Replace link" . org-roam-doctor--replace-link))
("R" . ("Replace link (keep label)" . org-roam-doctor--replace
The :name property is the name of the function run. The function
takes in the Org parse tree, and returns a list of (point error-
message). :description is a short description of what the
checker does. :actions is an alist containing elements of the
form (char . (prompt . function)). These actions are
defined per checker, to perform autofixes for the errors. For
each error detected, org-roam-doctor will move the point to
the current error, and pop-up a help window displaying the error
message, as well as the list of actions that can be taken
provided in :actions.
39 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
encrypted files.
19 Performance Optimization
20 Appendix
• Note-taking Workflows:
• Ecosystem:
40 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Books
How To Take Smart Notes
Articles
The Zettelkasten Method - LessWrong 2.0
Building a Second Brain in Roam…And Why You Might
Want To : RoamResearch
Roam Research: Why I Love It and How I Use It - Nat
Eliason
Adam Keesling’s Twitter Thread
How To Take Smart Notes With Org-mode · Jethro Kuan
Threads
Ask HN: How to Take Good Notes
Videos
How to Use Roam to Outline a New Article in Under 20
Minutes
20.2 Ecosystem
41 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
(winner-mode +1)
(define-key winner-mode-map (kbd "<M-left>") #'winner-undo)
(define-key winner-mode-map (kbd "<M-right>") #'winner-redo)
(use-package deft
:after org
:bind
("C-c n d" . deft)
:custom
(deft-recursive t)
(deft-use-filter-string-for-filename t)
(deft-default-extension "org")
(deft-directory "/path/to/org-roam-files/"))
If the title of the Org file is not the first line, you might not get
nice titles. You may choose to patch this to use org-roam’s
functionality. Here I’m using el-patch:
42 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
(use-package el-patch
:straight (:host github
:repo "raxod502/el-patch"
:branch "develop"))
(eval-when-compile
(require 'el-patch))
(use-package deft
;; same as above...
:config/el-patch
(defun deft-parse-title (file contents)
"Parse the given FILE and CONTENTS and determine the title.
If `deft-use-filename-as-title' is nil, the title is taken to
be the first non-empty line of the FILE. Else the base name of the FILE is
used as title."
(el-patch-swap (if deft-use-filename-as-title
(deft-base-filename file)
(let ((begin (string-match "^.+$" contents)))
(if begin
(funcall deft-parse-title-function
(substring contents begin (match-end 0)))
(org-roam-db--get-title file))))
The Deft interface can slow down quickly when the number of
files get huge. Notdeft is a fork of Deft that uses an external
search engine and indexer.
20.2.4 Org-journal
(use-package org-journal
:bind
("C-c n j" . org-journal-new-entry)
:custom
(org-journal-date-prefix "#+title: ")
(org-journal-file-format "%Y-%m-%d.org")
(org-journal-dir "/path/to/journal/files/")
(org-journal-date-format "%A, %d %B %Y"))
43 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
• Org-download:
• mathpix.el:
• Org-noter / Interleave:
• Bibliography:
• Spaced Repetition:
Org-download
Figure: org-download
(use-package org-download
:after org
:bind
(:map org-mode-map
(("s-Y" . org-download-screenshot)
("s-y" . org-download-yank))))
44 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
mathpix.el
Figure: mathpix
(use-package mathpix.el
:straight (:host github :repo "jethrokuan/mathpix.el")
:custom ((mathpix-app-id "app-id")
(mathpix-app-key "app-key"))
:bind
("C-x m" . mathpix-screenshot))
Org-noter / Interleave
Bibliography
45 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Spaced Repetition
21 FAQ
46 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
This situation arises when, for example, one would like to create
a note titled “bar” when “barricade” already exists.
47 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Jump to: O
Index Entry Section
O
org-roam-dailies-capture- Capturing and finding
date: daily-notes
org-roam-dailies-capture- Capturing and finding
today: daily-notes
org-roam-dailies-capture- Capturing and finding
yesterday: daily-notes
org-roam-dailies-find-date: Capturing and finding
daily-notes
org-roam-dailies-find- Navigation
directory:
org-roam-dailies-find-next- Navigation
note:
org-roam-dailies-find- Navigation
previous-note:
org-roam-dailies-find-today: Capturing and finding
daily-notes
org-roam-dailies-find- Capturing and finding
yesterday: daily-notes
org-roam-doctor: Diagnosing and Repairing
Files
org-roam-find-index: Index File
org-roam-graph: Graphing
org-roam-link-complete-at- Link Completion
point:
Jump to: O
Jump to: O
Index Entry Section
48 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
49 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html
Jump to: O
Footnotes
(1)
(2)
50 de 50 11/2/21 21:33