Org-Roam User Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

Org-roam User Manual https://www.orgroam.com/manual.

html

Org-roam User Manual


Next: Introduction, Up: (dir)   [Index]

Org-roam User Manual


This manual is for Org-roam version 1.2.3.

Copyright (C) 2020-2020 Jethro Kuan


<jethrokuan95@gmail.com>

You can redistribute this document and/or modify it


under the terms of the GNU General Public License as
published by the Free Software Foundation, either
version 3 of the License, or (at your option) any later
version.

This document 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.

• 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

• Diagnosing and Repairing Files:


• Finding Unlinked References:   
• Performance Optimization:
• Appendix:   
• FAQ:
• Keystroke Index:   
• Command Index:
• Function Index:   
• Variable Index:

— The Detailed Node Listing —

A Brief Introduction to the Zettelkasten Method

• Fleeting notes:   
• Permanent notes:

Installation

• Installing from MELPA:


• Installing from Apt:   
• Installing from the Git Repository:
• Post-Installation Tasks:   

Files

• File Titles:   
• File Tags:
• File Refs:   

File Titles

• Customizing Title Extraction:   

File Tags

• Customizing Tag Extraction:   

The Templating System

2 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

• Template Walkthrough:
• Org-roam Template Expansion:   

Concepts and Configuration

• Directories and Files:   


• The Org-roam Buffer:
• Org-roam Files:   
• Org-roam Faces:
• The Database:   

Completions

• Link Completion:   
• Tag Completion:

Link Completion

• Link Completions Everywhere:

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

• Profiling Key Operations:   


• Garbage Collection:

Appendix

• Note-taking Workflows:
• Ecosystem:   

Ecosystem

• Browsing History with winner-mode:   


• Versioning Notes:
• Full-text search interface with Deft:   
• Org-journal:
• Note-taking Add-ons:   

Note-taking Add-ons

• Org-download:   
• mathpix.el:
• Org-noter / Interleave:   
• Bibliography:
• Spaced Repetition:   

FAQ

• How do I have more than one Org-roam directory?:   


• How do I migrate from Roam Research?:
• How do I create a note whose title already matches one of
  
the candidates?:

Next: Target Audience, Previous: Top, Up: Top   [Index]

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

Roam Research’s 1 features within the all-powerful Org-mode.

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 keeps closely to Org syntax,
and will work for anyone already using Org-mode for their
personal wiki.

Org-roam gains its superpowers by leveraging the mature


ecosystem around Org-mode. For example, it has first-class
support for org-ref for citation management.

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.

Org-roam provides several benefits over other tooling:

Privacy and Security: Keep your personal wiki entirely


offline and in your control. Encrypt your notes with GPG.
Longevity of Plain Text: Unlike web solutions like Roam
Research, the notes are first and foremost plain Org-mode
files – Org-roam simply builds an auxiliary database to give
the personal wiki superpowers. Having your notes in plain-
text is crucial for the longevity of your wiki. Never have to
worry about proprietary web solutions being taken down.
The notes are still functional even if Org-roam ceases to
exist.
Free and Open Source: Org-roam is free and open-
source, which means that if you feel unhappy with any part
of Org-roam, you may choose to extend Org-roam, or open
a pull request.
Leverage the Org-mode ecosystem: Over the years,
Emacs and Org-mode has developed into a mature system
for plain-text organization. Building upon Org-mode already
puts Org-roam light-years ahead of many other solutions.
Built on Emacs: Emacs is also a fantastic interface for
editing text, and we can inherit many of the powerful text-
navigation and editing packages available to Emacs.

Next: A Brief Introduction to the Zettelkasten Method, Previous:


Introduction, Up: Top   [Index]

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.

Org-roam assumes basic familiarity with these tools. It is not


difficult to get up and running with basic text-editing
functionality, but one will only fully appreciate the power of
building Roam functionality into Emacs and Org-mode when the
usage of these tools become more advanced.

One key advantage to Org-roam is that building on top of Emacs


gives it malleability. This is especially important for note-taking
workflows. It is our belief that note-taking workflows are
extremely personal, and there is no one tool that’s perfect for
you. Org-mode and Org-roam allows you to discover what works
for you, and build that perfect tool for yourself.

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.

Emacs outshines all other editing software in


approximately the same way that the noonday sun
does the stars. It is not just bigger and brighter; it
simply makes everything else vanish. – Neal
Stephenson, In the Beginning was the Command Line
(1998)

Next: Installation, Previous: Target Audience, Up: Top   [Index]

3 A Brief Introduction to the Zettelkasten


Method

6 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Org-roam provides utilities for maintaining a digital slip-box. This


section aims to provide a brief introduction to the “slip-box”, or
“Zettelkasten” method. By providing some background on the
method, we hope that the design decisions of Org-roam will
become clear, and that will aid in using Org-roam appropriately.
In this section we will introduce terms commonly used within the
Zettelkasten community and the Org-roam forums.

The Zettelkasten is a personal tool for thinking and writing. It


places heavy emphasis on connecting ideas, building up a web
of thought. Hence, it is well suited for knowledge workers and
intellectual tasks, such as conducting research. The Zettelkasten
can act as a research partner, where conversations with it may
produce new and surprising lines of thought.

This method is attributed to German sociologist Niklas Luhmann,


who using the method had produced volumes of written works.
Luhmann’s slip-box was simply a box of cards. These cards are
small – often only large enough to fit a single concept. The size
limitation encourages ideas to be broken down into individual
concepts. These ideas are explicitly linked together. The
breakdown of ideas encourages tangential exploration of ideas,
increasing the surface for thought. Making linking explicit
between notes also encourages one to think about the
connections between concepts.

At the corner of each note, Luhmann ascribed each note with an


ordered ID, allowing him to link and jump between notes. In Org-
roam, we simply use hyperlinks.

Org-roam is the slip-box, digitalized in Org-mode. Every zettel


(card) is a plain-text, Org-mode file. In the same way one would
maintain a paper slip-box, Org-roam makes it easy to create new
zettels, pre-filling boilerplate content using a powerful
templating system.

• Fleeting notes:
• Permanent notes:   

Next: Permanent notes, Up: A Brief Introduction to the


Zettelkasten Method   [Index]

3.1 Fleeting notes

7 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

A slip-box requires a method for quickly capturing ideas. These


are called fleeting notes: they are simple reminders of
information or ideas that will need to be processed later on, or
trashed. This is typically accomplished using org-capture (see
(org)Capture), or using Org-roam’s daily notes functionality (see
Daily-notes). This provides a central inbox for collecting
thoughts, to be processed later into permanent notes.

Previous: Fleeting notes, Up: A Brief Introduction to the


Zettelkasten Method   [Index]

3.2 Permanent notes

Permanent notes are further split into two categories: literature


notes and concept notes. Literature notes can be brief
annotations on a particular source (e.g. book, website or paper),
that you’d like to access later on. Concept notes require much
more care in authoring: they need to be self-explanatory and
detailed. Org-roam’s templating system supports the addition of
different templates to facilitate the creation of these notes.

Next: Getting Started, Previous: A Brief Introduction to the


Zettelkasten Method, Up: Top   [Index]

4 Installation
Org-roam can be installed using Emacs’ package manager or
manually from its development repository.

• Installing from MELPA:   


• Installing from Apt:   
• Installing from the Git Repository:   
• Post-Installation Tasks:   

Next: Installing from Apt, Up: Installation   [Index]

4.1 Installing from MELPA

Org-roam is available from Melpa and Melpa-Stable. If you


haven’t used Emacs’ package manager before, you may
familiarize yourself with it by reading the documentation in the
Emacs manual, see (emacs)Packages. Then, add one of the

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)

Org-roam also depends on a recent version of Org, which can be


obtained in Org’s package repository (see (org)Installation). To
use Org’s ELPA archive:

(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

Once you have added your preferred archive, you need to


update the local package list using:

M-x package-refresh-contents RET

Once you have done that, you can install Org-roam and its
dependencies using:

M-x package-install RET org-roam RET

Now see Post-Installation Tasks.

Next: Installing from the Git Repository, Previous: Installing from


MELPA, Up: Installation   [Index]

4.2 Installing from Apt

Users of Debian 11 or later or Ubuntu 20.10 or later can simply


install Org-roam using Apt:

apt-get install elpa-org-roam

Org-roam will then be autoloaded into Emacs.

9 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Next: Post-Installation Tasks, Previous: Installing from Apt, Up:


Installation   [Index]

4.3 Installing from the Git Repository

You may install Org-roam directly from the repository on GitHub


if you like. This will give you access to the latest version hours or
days before it appears on MELPA, and months (or more) before it
is added to the Debian or Ubuntu repositories. This will also give
you access to various developmental branches that may be
available.

Note, however, that development version, and especially any


feature branches, may not always be in working order. You’ll
need to be prepared to do some debugging, or to manually roll-
back to working versions, if you install from GitHub.

Installing from GitHub requires that you clone the repository:

git clone https://github.com/org-roam/org-roam.git /path/to/org/roam

where ./path/to/org/roam is the location you will store your


copy of the code.

Next, you need to add this location to your load path, and
require the Org-roam library. Add the following code to your
.emacs:

(add-to-list 'load-path "/path/to/org/roam")


(require 'org-roam)

You now have Org-roam installed. However, you don’t


necessarily have the dependencies that it requires. These
include:

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.

To compile the .texi source file, from a terminal navigate to the


/doc subdirectory of the Org-roam repository, and run the
following:

make infodir=/path/to/my/info/files install-info

Where /path/to/my/info/files is the location where you keep


info files. This target directory needs to be stored in the variable
‘Info-default-directory-list‘. If you aren’t using one of the default
info locations, you can configure this with the following in your
.emacs file:

(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

If you do this, you’ll need to make sure you have write-access to


that location, or run the above make command as root.

Now that the info file is ready, you need to add it to the
corresponding dir file:

install-info /path/to/my/info/files/org-roam.info /path/to/my/info/files/dir

Previous: Installing from the Git Repository, Up: Installation  


[Index]

4.4 Post-Installation Tasks

Org-roam uses emacsql-sqlite3, which requires sqlite3 to be


located on exec-path. Please ensure that sqlite3 is installed
appropriately on your operating system. You can verify that this
is the case by executing:

11 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

(executable-find "sqlite3")

If you have sqlite3 installed, and executable-find still reports


nil, then it is likely that the path to the executable is not a
member of the Emacs variable exec-path. You may rectify this
by manually adding the path within your Emacs configuration:

(add-to-list 'exec-path "path/to/sqlite3")

Next: Files, Previous: Installation, Up: Top   [Index]

5 Getting Started
This short tutorial describes the essential commands used in
Org-roam, to help you get started.

First, it is important to understand how Org-roam was designed.


Org-roam was built to support a workflow that was not possible
with vanilla Org-mode. This flow is modelled after the
Zettelkasten Method, and many of Roam Research’s workflows.
Org-roam does not magically make note-taking better – this
often requires a radical change in your current note-taking
workflow. To understand more about the methods and madness,
see Note-taking Workflows.

To first start using Org-roam, one needs to pick a location to


store the Org-roam files. The directory that will contain your
notes is specified by the variable org-roam-directory. This
variable needs to be set before any calls to Org-roam functions,
including enabling org-roam-mode. For this tutorial, create an
empty directory, and set org-roam-directory:

(make-directory "~/org-roam")
(setq org-roam-directory "~/org-roam")

We encourage using a flat hierarchy for storing notes, but some


prefer using folders for storing specific kinds of notes (e.g.
websites, papers). This is fine; Org-roam searches recursively
within org-roam-directory for notes. Instead of relying on the
file hierarchy for any form of categorization, one should use links
between files to establish connections between notes.

Next, we need to enable the global minor mode org-roam-mode.

12 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

This sets up Emacs with several hooks, building a cache that is


kept consistent as your slip-box grows. We recommend starting
org-roam-mode on startup:

(add-hook 'after-init-hook 'org-roam-mode)

To build the cache manually, one can run M-x org-roam-db-


build-cache. Cache builds may take a while the first time, but
is often instantaneous in subsequent runs because it only
reprocesses modified files.

Let us now create our first note. Call M-x org-roam-find-file.


This shows a list of titles for notes that reside in org-roam-
directory. It should show nothing right now, since there are no
notes in the directory. Entering the title of the note you wish to
create, and pressing RET should begin the note creation process.
This process uses org-capture’s templating system, and can be
customized (see The Templating System). Using the default
template, pressing C-c C-c finishes the note capture.

By default, Org-roam updates the cache asynchronously in the


background to avoid getting in the way of writing. Org-roam
queues updates to the files, waits for you to be idle for 2
seconds, and then automatically triggers updating the cache.
After the cache has been updated, running M-x org-roam-
find-file again should show the note you have created, and
selecting that entry will bring you to that note 2. One can
customize the waiting time by setting org-roam-db-update-
idle-seconds; or change the cache update to be triggered
immediately after buffer save by setting org-roam-db-update-
method to 'immediate.

For experienced org-capture users, the behavior of M-x org-


roam-find-file may seem unfamiliar: after finishing a capture
with C-c C-c, you are returned not to the original buffer from
which you called M-x org-roam-find-file, but to a buffer
pointing to the note you just created. For the usual org-capture
behavior you can call M-x org-roam-capture instead of M-x
org-roam-find-file.

Org-roam makes it easy to create notes, and link them together.


To link notes together, we call M-x org-roam-insert. This
brings up a prompt with a list of title for existing notes. Selecting
an existing entry will create and insert a link to the current file.

13 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Entering a non-existent title will create a new note with that


title. Good usage of Org-roam requires liberally linking files: this
facilitates building up a dense graph of inter-connected notes.

Org-roam provides an interface to view backlinks. It shows


backlinks for the currently active Org-roam note, along with
some surrounding context. To toggle the visibility of this buffer,
call M-x org-roam.

For a visual representation of the notes and their connections,


Org-roam also provides graphing capabilities, using Graphviz. It
generates graphs with notes as nodes, and links between them
as edges. The generated graph can be used to navigate to the
files, but this requires some additional setup (see Roam
Protocol).

Next: The Templating System, Previous: Getting Started, Up: Top


  [Index]

6 Files
In Org-roam, notes typically consist of multiple files, where each
file is a zettel.

While the bulk of Org-roam’s functionality is built on top of


vanilla Org-mode, Org-roam adds several Org-roam-specific
keywords to support additional functionality.

This section explains the important components of a file, and


the extensions to Org-mode.

• File Titles:   
• File Tags:   
• File Refs:   

Next: File Tags, Up: Files   [Index]

6.1 File Titles

To easily find a note, a title needs to be prescribed to a note.

A note can have many titles: this allows a note to be referred to


by different names, which is especially useful for topics or
concepts with acronyms. For example, for a note like “World War

14 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

2”, it may be desirable to also refer to it using the acronym


“WWII”.

Org-roam calls org-roam--extract-titles to extract titles. It


uses the variable org-roam-title-sources, to control how the
titles are extracted. The title extraction methods supported are:

'title: This extracts the title using the file #+title


property
'headline: This extracts the title from the first headline in
the Org file
'alias: This extracts a list of titles using the #+roam_alias
property. The aliases are space-delimited, and can be multi-
worded using quotes.

Take for example the following org file:

#+title: World War 2


#+roam_alias: "WWII" "World War II"

* Headline

Method Titles
'title ’(“World War 2”)
'headline ’(“Headline”)
'alias ’(“WWII” “World War II”)

If no title is provided, Org-roam defaults to using the file-path.

• Customizing Title Extraction:   

Up: File Titles   [Index]

6.1.1 Customizing Title Extraction

To control how Org-roam extracts titles, customize org-roam-


title-sources. If all methods of title extraction return no
results, the file-name is used as the note’s title.

User Option: org-roam-title-sources

The list of sources from which to retrieve a note title. Each


element in the list is either:

a symbol – this symbol corresponds to a title retrieval


function, which returns the list of titles for the current

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.

The return results of the root list are concatenated.

For example the setting: ’((title headline) alias) means the


following:

Return the ’title + ’alias, if the title of current buffer is


non-empty;
Or return ’headline + ’alias otherwise.

The currently supported symbols are:

'title The #+title property of org file.

'alias The #+roam_alias property of the org file, using


space-delimited strings.

'headline The first headline in the org file.

Adding your own title extraction method requires two steps.


First, define a method (defun org-roam--extract-titles-foo
() ...), where foo a self-prescribed name for the title
extraction method. This method takes no arguments, and
returns a list of strings (titles). Finally, push the symbol foo into
org-roam-title-sources. You may need to rebuild the cache
from scratch to re-process all files to pick up the new titles.

Next: File Refs, Previous: File Titles, Up: Files   [Index]

6.2 File Tags

Tags are used as meta-data for files: they facilitate interactions


with notes where titles are insufficient. For example, tags allow
for categorization of notes: differentiating between
bibliographical and structure notes during interactive
commands.

By default, tags are extracted from the #+roam_tags property. To


add additional extraction methods, see Customizing Tag
Extraction.

16 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

• Customizing Tag Extraction:

Up: File Tags   [Index]

6.2.1 Customizing Tag Extraction

Org-roam calls org-roam--extract-tags to extract tags from


files. The variable org-roam-tag-sources, to control how tags
are extracted.

User Option: org-roam-tag-sources

Sources to obtain tags from.

It should be a list of symbols representing any of the following


extraction methods:

'prop Extract tags from the #+roam_tags property. Tags are


space delimited. Tags may contain spaces if they are double-
quoted. e.g. #+roam_tags: TAG "tag with spaces"

'vanilla Extract vanilla org-mode tags, including #+FILETAGS


and inherited tags.

'all-directories Extract sub-directories relative to org-roam-


directory. That is, if a file is located at relative path foo/bar
/file.org, the file will have tags “foo” and “bar”.

'last-directory Extract the last directory relative to ‘org-


roam-directory’. That is, if a file is located at relative path
foo/bar/file.org, the file will have tag \“bar\”.

'first-directory Extract the first directory relative to org-


roam-directory. That is, if a file is located at relative path
foo/bar/file.org, the file will have tag “foo”

By default, only the 'prop extraction method is enabled. To


enable the other extraction methods, you may modify org-
roam-tag-sources, for example:

(setq org-roam-tag-sources '(prop last-directory))

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.

Previous: File Tags, Up: Files   [Index]

6.3 File Refs

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 allow references to the key to show up in the


backlinks buffer. For instance, with the example above, if
another file then links to https://www.google.com, that will show
up as a “Ref Backlink”.

These keys also come in useful for when taking website notes,
using the roam-ref protocol (see Roam Protocol).

org-ref citation keys can also be used as refs:

#+title: Neural Ordinary Differential Equations


#+roam_key: cite:chen18_neural_ordin_differ_equat

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

an article has a citation key and a URL at the same time.

Next: Concepts and Configuration, Previous: Files, Up: Top  


[Index]

7 The Templating System


Rather than creating blank files on org-roam-insert and org-
roam-find-file, it may be desirable to prefill the file with
templated content. This may include:

Time of creation
File it was created from
Clipboard content
Any other data you may want to input manually

This requires a complex template insertion system. Fortunately,


Org ships with a powerful one: org-capture (see (org)capture).
However, org-capture was not designed for such use. Org-roam
abuses org-capture, extending its syntax and capabilities. To
first understand how org-roam’s templating system works, it
may be useful to look into basic usage of org-capture.

For these reasons, Org-roam capture templates are not


compatible with regular org-capture. Hence, Org-roam’s
templates can be customized by instead modifying the variable
org-roam-capture-templates. Just like org-capture-
templates, org-roam-capture-templates can contain multiple
templates. If org-roam-capture-templates only contains one
template, there will be no prompt for template selection.

• Template Walkthrough:   
• Org-roam Template Expansion:   

Next: Org-roam Template Expansion, Up: The Templating System


  [Index]

7.1 Template Walkthrough

To demonstrate the additions made to org-capture templates.


Here, we walkthrough the default template, reproduced below.

("d" "default" plain (function org-roam--capture-get-point)

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.

Other options you may want to learn about include :immediate-


finish.

Previous: Template Walkthrough, Up: The Templating System  


[Index]

7.2 Org-roam Template Expansion

Org-roam’s template definitions also extend org-capture’s


template syntax, to allow prefilling of strings. We have seen a
glimpse of this in Template Walkthrough.

In org-roam templates, the ${var} syntax allows for the


expansion of variables, stored in org-roam-capture--info. For
example, during org-roam-insert, the user is prompted for a

20 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

title. Upon entering a non-existent title, the title key in org-


roam-capture--info is set to the provided title. ${title} is
then expanded into the provided title during the org-capture
process. Any variables that do not contain strings, are prompted
for values using completing-read.

After doing this expansion, the org-capture’s template expansion


system is used to fill up the rest of the template. You may read
up more on this on org-capture’s documentation page.

To illustrate this dual expansion process, take for example the


template string: "%<%Y%m%d%H%M%S>-${title}", with the title
"Foo". The template is first expanded into %<%Y%m%d%H%M%S>-
Foo. Then org-capture expands %<%Y%m%d%H%M%S> with
timestamp: e.g. 20200213032037-Foo.

All of the flexibility afforded by Emacs and Org-mode are


available. For example, if you want to encode a UTC timestamp
in the filename, you can take advantage of org-mode’s %(EXP)
template expansion to call format-time-string directly to
provide its third argument to specify UTC.

("d" "default" plain (function org-roam--capture-get-point)


"%?"
:file-name "%(format-time-string \"%Y-%m-%d--%H-%M-%SZ--${slug}\" (curre
:head "#+title: ${title}\n"
:unnarrowed t)

Next: Inserting Links, Previous: The Templating System, Up: Top  


[Index]

8 Concepts and Configuration


The number of configuration options is deliberately kept small,
to keep the Org-roam codebase manageable. However, we
attempt to accommodate as many usage styles as possible.

All of Org-roam’s customization options can be viewed via M-x


customize-group org-roam.

• Directories and Files:   


• The Org-roam Buffer:   
• Org-roam Files:   
• Org-roam Faces:   

21 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

• The Database:

Next: The Org-roam Buffer, Up: Concepts and Configuration  


[Index]

8.1 Directories and Files

This section concerns the placement and creation of files.

Variable: org-roam-directory

This is the default path to Org-roam files. All Org files, at


any level of nesting, are considered part of the Org-roam.

Variable: org-roam-db-location

Location of the Org-roam database. If this is non-nil, the


Org-roam sqlite database is saved here.

It is the user’s responsibility to set this correctly, especially


when used with multiple Org-roam instances.

Variable: org-roam-file-exclude-regexp

Files matching this regular expression are excluded from


the Org-roam.

Next: Org-roam Files, Previous: Directories and Files, Up:


Concepts and Configuration   [Index]

8.2 The Org-roam Buffer

The Org-roam buffer displays backlinks for the currently active


Org-roam note.

User Option: org-roam-buffer

The name of the org-roam buffer. Defaults to *org-roam*.

User Option: org-roam-buffer-position

The position of the Org-roam buffer side window. Valid


values are 'left, 'right, 'top, 'bottom.

User Option: org-roam-buffer-width

Width of org-roam-buffer. Has an effect only if org-roam-

22 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

buffer-position is 'left or 'right.

User Option: org-roam-buffer-height

Height of org-roam-buffer. Has an effect only if org-


roam-buffer-position is 'top or 'bottom.

User Option: org-roam-buffer-window-parameters

Additional window parameters for the org-roam-buffer side


window.

For example one can prevent the window from being


deleted when calling delete-other-windows, by setting it
with the following:

(setq org-roam-buffer-window-parameters '((no-


delete-other-windows . t)))

Next: Org-roam Faces, Previous: The Org-roam Buffer, Up:


Concepts and Configuration   [Index]

8.3 Org-roam Files

Org-roam files are created and prefilled using Org-roam’s


templating system. The templating system is customizable (see
The Templating System).

Next: The Database, Previous: Org-roam Files, Up: Concepts and


Configuration   [Index]

8.4 Org-roam Faces

Org-roam introduces several faces to distinguish links within the


same buffer. These faces are enabled by default in Org-roam
notes.

User Option: org-roam-link-use-custom-faces

When t, use custom faces only inside Org-roam notes.


When everywhere, the custom face is applied additionally
to non Org-roam notes. When nil, do not use Org-roam’s
custom faces.

The org-roam-link face is the face applied to links to other

23 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Org-roam files. This distinguishes internal links from external


links (e.g. external web links).

The org-roam-link-current face corresponds to links to the


same file it is in.

The org-roam-link-invalid face is applied to links that are


broken. These are links to files or IDs that cannot be found.

Previous: Org-roam Faces, Up: Concepts and Configuration  


[Index]

8.5 TODO The Database

Org-roam is backed by a Sqlite database.

User Option: org-roam-db-update-method

Method to update the Org-roam database.

'immediate: Update the database immediately upon file


changes.

'idle-timer: Updates the database if dirty, if Emacs idles


for org-roam-db-update-idle-seconds.

User Option: org-roam-db-update-idle-seconds

Number of idle seconds before triggering an Org-roam


database update. This is only valid if org-roam-db-update-
method is 'idle-timer.

Next: Completions, Previous: Concepts and Configuration, Up:


Top   [Index]

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.

file links can be inserted via org-roam-insert. Links to


headlines can be inserted by navigating to the desired headline
and calling org-store-link. This will create an ID for the

24 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

headline if it does not already exist, and populate the Org-roam


database. The link can then be inserted via org-insert-link.

An alternative mode of insertion is using Org-roam’s roam links.


Org-roam registers this link type, and interprets the path as
follows:

[[roam:title]]links to an Org-roam file with title or alias


“title”
[[roam:*headline]]links to the headline “headline” in the
current Org-roam file
[[roam:title*headline]]links to the headline “headline”
in the Org-roam file with title or alias “title”

User Option: org-roam-link-title-format

To distinguish between org-roam links and regular links,


one may choose to use special indicators for Org-roam
links. Defaults to "%s".

If your version of Org is at least 9.2, consider styling the


link differently, by customizing the org-roam-link, and
org-roam-link-current faces.

User Option: org-roam-link-auto-replace

When non-nil, roam links will be replaced with file or id


links when they are navigated to, and on file save, when a
match is found. This is desirable to maintain compatibility
with vanilla Org, but resolved links are harder to edit.
Defaults to t.

Next: Navigating Around, Previous: Inserting Links, Up: Top  


[Index]

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

The list of functions to be used with completion-at-point.

25 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

User Option: org-roam-completion-ignore-case

When non-nil, the roam link completions are ignore case.


For example, calling completion-at-point within
[[roam:fo]] will present a completion for a file with title
“Foo”. Defaults to t.

To use the completions from Org-roam with company-mode,


prepend company-capf to variable company-backends.

• Link Completion:
• Tag Completion:   

Next: Tag Completion, Up: Completions   [Index]

10.1 Link Completion

roam links support auto-completion via completion-at-point:


simply call M-x completion-at-point within a roam link. That
is, where the | character represents the cursor:

[[|]]: completes for a file title


[[roam:]]: completes for a file title
[[*|]]: completes for a headline within this file
[[foo*|]]: completes a headline within the file with title
“foo”
[[roam:foo*|]] completes a headline within the file with
title “foo”

Completions account for the current input. For example, for


[[f|]], the completions (by default) only show for files with
titles that start with “f”.

Function: org-roam-link-complete-at-point

Do appropriate completion for the link at point.

• Link Completions Everywhere:   

Up: Link Completion   [Index]

10.1.1 Link Completions Everywhere

Org-roam is able to provide completions from the current word


at point, enabling as-you-type link completions. However, this is

26 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

disabled by default: the author believes that linking should be a


deliberate action and linking should be performed with great
care.

Setting org-roam-completion-everywhere to t will enable


word-at-point completions.

User Option: org-roam-completion-everywhere

If non-nil, provide completions from the current word at


point. That is, in the scenario this is a sent|, calling
completion-at-point will show completions for titles that
begin with “sent”.

Previous: Link Completion, Up: Completions   [Index]

10.2 Tag Completion

Org-roam facilitates the insertion of existing tags via


completion-at-point.

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.

This functionality is implemented in org-roam-complete-tags-


at-point.

Next: Encryption, Previous: Completions, Up: Top   [Index]

11 Navigating Around

• Index File:   

Up: Navigating Around   [Index]

11.1 Index File

As your collection grows, you might want to create an index


where you keep links to your main files.

In Org-roam, you can define the path to your index file by


setting org-roam-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

Path to the Org-roam index file.

The path can be a string or a function. If it is a string, it


should be the path (absolute or relative to org-roam-
directory) to the index file. If it is is a function, the
function should return the path to the index file. Otherwise,
the index is assumed to be a note in org-roam-index
whose title is "Index".

Function: org-roam-find-index

Opens the Index file in the current org-roam-directory.

Next: Graphing, Previous: Navigating Around, Up: Top   [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.

User Option: org-roam-encrypt-files

Whether to encrypt new files. If true, create files with


.org.gpg extension.

Next: Minibuffer Completion, Previous: Encryption, Up: Top  


[Index]

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

also be navigated: see Roam Protocol.

The entry point to graph creation is org-roam-graph.

Function: org-roam-graph & optional arg file node-query

Build and possibly display a graph for FILE from NODE-


QUERY. If FILE is nil, default to current buffer’s file name.
ARG may be any of the following values:

nil show the graph.


C-u show the graph for FILE.
C-u N show the graph for FILE limiting nodes to N
steps.
C-u C-u build the graph.
C-u - build the graph for FILE.
C-u -N build the graph for FILE limiting nodes to N
steps.

User Option: org-roam-graph-executable

Path to the graphing executable (in this case, Graphviz).


Set this if Org-roam is unable to find the Graphviz
executable on your system.

You may also choose to use neato in place of dot, which


generates a more compact graph layout.

User Option: org-roam-graph-viewer

Org-roam defaults to using Firefox (located on PATH) to


view the SVG, but you may choose to set it to:

A string, which is a path to the program used


a function accepting a single argument: the graph file
path.

nil uses view-file to view the graph.

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:   

Next: Excluding Nodes and Edges, Up: Graphing   [Index]

13.1 Graph Options

Graphviz provides many options for customizing the graph


output, and Org-roam supports some of them. See
https://graphviz.gitlab.io/_pages/doc/info/attrs.html for
customizable options.

User Option: org-roam-graph-extra-config

Extra options passed to graphviz for the digraph (The “G”


attributes). Example: '~(("rankdir" . "LR"))

User Option: org-roam-graph-node-extra-config

Extra options for nodes in the graphviz output (The “N”


attributes). Example: '(("color" . "skyblue"))

User Option: org-roam-graph-edge-extra-config

Extra options for edges in the graphviz output (The “E”


attributes). Example: '(("dir" . "back"))

User Option: org-roam-graph-edge-cites-extra-config

Extra options for citation edges in the graphviz output.


Example: '(("color" . "red"))

Previous: Graph Options, Up: Graphing   [Index]

13.2 Excluding Nodes and Edges

One may want to exclude certain files to declutter the graph.

User Option: org-roam-graph-exclude-matcher

Matcher for excluding nodes from the generated graph. Any


nodes and links for file paths matching this string is
excluded from the graph.

If value is a string, the string is the only matcher.

30 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

If value is a list, all file paths matching any of the strings


are excluded.

(setq org-roam-graph-exclude-matcher '("private" "dailies"))

This setting excludes all files whose path contain “private” or


“dailies”.

Next: Roam Protocol, Previous: Graphing, Up: Top   [Index]

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.

(setq org-roam-completion-system 'default)

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:

(setq org-roam-completion-system 'helm)

Other options include 'ido, and 'ivy.

Next: Daily-notes, Previous: Minibuffer Completion, Up: Top  


[Index]

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:   

Next: The roam-file protocol, Up: Roam Protocol   [Index]

31 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

15.1 Installation

To enable Org-roam’s protocol extensions, you have to add the


following to your init file:

(require 'org-roam-protocol)

The instructions for setting up org-protocol are reproduced


below.

We will also need to create a desktop application for


emacsclient. The instructions for various platforms are shown
below.

For Linux users, create a desktop application in ~/.local/share


/applications/org-protocol.desktop:

[Desktop Entry]
Name=Org-Protocol
Exec=emacsclient %u
Icon=emacs-icon
Type=Application
Terminal=false
MimeType=x-scheme-handler/org-protocol

Associate org-protocol:// links with the desktop application


by running in your shell:

xdg-mime default org-protocol.desktop x-scheme-handler/org-protocol

To disable the “confirm” prompt in Chrome, you can also make


Chrome show a checkbox to tick, so that the Org-Protocol
Client app will be used without confirmation. To do this, run in
a shell:

sudo mkdir -p /etc/opt/chrome/policies/managed/


sudo tee /etc/opt/chrome/policies/managed/external_protocol_dialog.json >/dev
{
"ExternalProtocolDialogShowAlwaysOpenCheckbox": true
}
EOF
sudo chmod 644 /etc/opt/chrome/policies/managed/external_protocol_dialog.json

and then restart Chrome (for example, by navigating to


<chrome://restart>) to make the new policy take effect.

See here for more info on the /etc/opt/chrome/policies

32 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

/managed directory and here for information on the


ExternalProtocolDialogShowAlwaysOpenCheckbox policy.

For MacOS, we need to create our own application.

Launch Script Editor


Use the following script, paying attention to the path to
emacsclient:

on open location this_URL


set EC to "/usr/local/bin/emacsclient --no-wait "
set filePath to quoted form of this_URL
do shell script EC & filePath
tell application "Emacs" to activate
end open location

Save the script in /Applications


/OrgProtocolClient.app, changing the script type to
“Application”, rather than “Script”.
Edit /Applications/OrgProtocolClient.app/Contents
/Info.plist, adding the following before the last </dict>
tag:

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>org-protocol handler</string>
<key>CFBundleURLSchemes</key>
<array>
<string>org-protocol</string>
</array>
</dict>
</array>

Save the file, and run the OrgProtocolClient.app to


register the protocol.

To disable the “confirm” prompt in Chrome, you can also make


Chrome show a checkbox to tick, so that the OrgProtocol app
will be used without confirmation. To do this, run in a shell:

defaults write com.google.Chrome ExternalProtocolDialogShowAlwaysOpenCheckbox

If you’re using Emacs Mac Port, it registered its ‘Emacs.app‘ as


the default handler for the URL scheme ‘org-protocol‘. To make
OrgProtocol.app the default handler instead, run:

33 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHan


'{"LSHandlerPreferredVersions" = { "LSHandlerRoleAll" = "-"; }; LSHandlerRole

Then restart your computer.

For Windows, create a temporary org-protocol.reg file:

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.

Next: The roam-ref protocol, Previous: Installation (1), Up: Roam


Protocol   [Index]

15.2 The roam-file protocol

This is a simple protocol that opens the path specified by the


file key (e.g. org-protocol://roam-file?file=
/tmp/file.org). This is used in the generated graph.

Previous: The roam-file protocol, Up: Roam Protocol   [Index]

15.3 The roam-ref protocol

This protocol finds or creates a new note with a given roam_key


(see Files):

34 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

To use this, create the following bookmarklet in your browser:

javascript:location.href =
'org-protocol://roam-ref?template=r&ref='
+ encodeURIComponent(location.href)
+ '&title='
+ encodeURIComponent(document.title)
+ '&body='
+ encodeURIComponent(window.getSelection())

or as a keybinding in qutebrowser in , using the config.py file


(see Configuring qutebrowser):

config.bind("<Ctrl-r>", "open javascript:location.href='org-protocol://roam-r

where template is the template key for a template in org-roam-


capture-ref-templates (see The Templating System). These
templates should contain a #+roam_key: ${ref} in it.

Next: Diagnosing and Repairing Files, Previous: Roam Protocol,


Up: Top   [Index]

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

Next: Capturing and finding daily-notes, Up: Daily-notes   [Index]

16.1 Configuration

For org-roam-dailies to work, you need to define two


variables:

Variable: org-roam-dailies-directory

Path to daily-notes.

Variable: org-roam-dailies-capture-templates

Capture templates for daily-notes in Org-roam.

Here is a sane default configuration:

(setq org-roam-dailies-directory "daily/")

(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")))

Make sure that org-roam-dailies-directory appears in


:file-name for your notes to be recognized as daily-notes. You
can have different templates placing their notes in different
directories, but the one in org-roam-dailies-directory will be
considered as the main one in commands.

See The Templating System for creating new templates. org-


roam-dailies provides an extra :olp option which allows
specifying the outline-path to a heading:

(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"))

("j" "journal" entry


#'org-roam-capture--get-point
"* %?"
:file-name "daily/%<%Y-%m-%d>"
:head "#+title: %<%Y-%m-%d>\n"

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’.

Next: Navigation, Previous: Configuration, Up: Daily-notes  


[Index]

16.2 Capturing and finding daily-notes

Function: org-roam-dailies-capture-today &optional goto

Create an entry in the daily note for today.

When goto is non-nil, go the note without creating an entry.

Function: org-roam-dailies-find-today

Find the daily note for today, creating it if necessary.

There are variants of those commands for -yesterday and


-tomorrow:

Function: org-roam-dailies-capture-yesterday n &optional


goto

Create an entry in the daily note for yesteday.

With numeric argument n, use the daily note n days in the


past.

Function: org-roam-dailies-find-yesterday

With numeric argument N, use the daily-note N days in the


future.

There are also commands which allow you to use Emacs’s


calendar to find the date

Function: org-roam-dailies-capture-date

Create an entry in the daily note for a date using the


calendar.

Prefer past dates, unless prefer-future is non-nil.

With a ’C-u’ prefix or when goto is non-nil, go the note

37 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

without creating an entry.

Function: org-roam-dailies-find-date

Find the daily note for a date using the calendar, creating it
if necessary.

Prefer past dates, unless prefer-future is non-nil.

Previous: Capturing and finding daily-notes, Up: Daily-notes  


[Index]

16.3 Navigation

You can navigate between daily-notes:

Function: org-roam-dailies-find-directory

Find and open org-roam-dailies-directory.

Function: org-roam-dailies-find-previous-note

When in an daily-note, find the previous one.

Function: org-roam-dailies-find-next-note

When in an daily-note, find the next one.

Next: Finding Unlinked References, Previous: Daily-notes, Up: Top


  [Index]

17 Diagnosing and Repairing Files


Org-roam provides a utility for diagnosing and repairing
problematic files via org-roam-doctor. By default, org-roam-
doctor runs the check on the current Org-roam file. To run the
check only for all Org-roam files, run C-u M-x org-roam-
doctor, but note that this may take some time.

Function: org-roam-doctor &optional this-buffer

Perform a check on Org-roam files to ensure cleanliness. If


THIS-BUFFER, run the check only for the current buffer.

The checks run are defined in org-roam-doctor--checkers. By


default, there are checkers for broken links and invalid ‘ #+roam_*’

38 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

properties.

Each checker is an instance of org-roam-doctor-checker. To


define a checker, use make-org-roam-doctor-checker. Here is
a sample definition:

(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.

Next: Performance Optimization, Previous: Diagnosing and


Repairing Files, Up: Top   [Index]

18 Finding Unlinked References


Unlinked references are occurrences of strings of text that
exactly match the title or alias of an existing note in the Org-
roam database. Org-roam provides facilities for discovering
these unlinked references, so one may decide whether to
convert them into links.

To use this feature, simply call M-x org-roam-unlinked-


references from within an Org-roam note. Internally, Org-roam
uses ripgrep and a clever PCRE regex to find occurrences of the
title or aliases of the currently open note in all Org-roam files.
Hence, this requires a version of ripgrep that is compiled with
PCRE support.

NOTE: Since ripgrep cannot read encrypted files, this


function cannot find unlinked references within

39 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

encrypted files.

Next: Appendix, Previous: Finding Unlinked References, Up: Top  


[Index]

19 Performance Optimization

• Profiling Key Operations:   


• Garbage Collection:   

Next: Garbage Collection, Up: Performance Optimization  


[Index]

19.1 TODO Profiling Key Operations

Previous: Profiling Key Operations, Up: Performance Optimization


  [Index]

19.2 Garbage Collection

During the cache-build process, Org-roam generates a lot of in-


memory data-structures (such as the Org file’s AST), which are
discarded after use. These structures are garbage collected at
regular intervals (see (elisp)info:elisp#Garbage Collection).

Org-roam provides the option org-roam-db-gc-threshold to


temporarily change the threshold value for GC to be triggered
during these memory-intensive operations. To reduce the
number of garbage collection processes, one may set org-roam-
db-gc-threshold to a high value (such as most-positive-
fixnum):

(setq org-roam-db-gc-threshold most-positive-fixnum)

Next: FAQ, Previous: Performance Optimization, Up: Top   [Index]

20 Appendix

• Note-taking Workflows:   
• Ecosystem:   

40 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Next: Ecosystem, Up: Appendix   [Index]

20.1 Note-taking Workflows

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

Previous: Note-taking Workflows, Up: Appendix   [Index]

20.2 Ecosystem

• Browsing History with winner-mode:   


• Versioning Notes:   
• Full-text search interface with Deft:   
• Org-journal:   
• Note-taking Add-ons:   

Next: Versioning Notes, Up: Ecosystem   [Index]

20.2.1 Browsing History with winner-mode

winner-mode is a global minor mode that allows one to undo


and redo changes in the window configuration. It is included
with GNU Emacs since version 20.

winner-mode can be used as a simple version of browser history


for Org-roam. Each click through org-roam links (from both Org
files and the backlinks buffer) causes changes in window
configuration, which can be undone and redone using winner-

41 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

mode. To use winner-mode, simply enable it, and bind the


appropriate interactive functions:

(winner-mode +1)
(define-key winner-mode-map (kbd "<M-left>") #'winner-undo)
(define-key winner-mode-map (kbd "<M-right>") #'winner-redo)

Next: Full-text search interface with Deft, Previous: Browsing


History with winner-mode, Up: Ecosystem   [Index]

20.2.2 Versioning Notes

Since Org-roam notes are just plain text, it is trivial to track


changes in your notes database using version control systems
such as Git. Simply initialize org-roam-directory as a Git
repository, and commit your files at regular or appropriate
intervals. Magit is a great interface to Git within Emacs.

In addition, it may be useful to observe how a particular note


has evolved, by looking at the file history. Git-timemachine
allows you to visit historic versions of a tracked Org-roam note.

Next: Org-journal, Previous: Versioning Notes, Up: Ecosystem  


[Index]

20.2.3 Full-text search interface with Deft

Deft provides a nice interface for browsing and filtering org-roam


notes.

(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.

Next: Note-taking Add-ons, Previous: Full-text search interface


with Deft, Up: Ecosystem   [Index]

20.2.4 Org-journal

Org-journal provides journaling capabilities to Org-mode. A lot of


its functionalities have been incorporated into Org-roam under
the name org-roam-dailies. It remains a good tool if you want
to isolate your verbose journal entries from the ideas you would
write on a scratchpad.

(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

Previous: Org-journal, Up: Ecosystem   [Index]

20.2.5 Note-taking Add-ons

These are some plugins that make note-taking in Org-mode


more enjoyable.

• Org-download:   
• mathpix.el:   
• Org-noter / Interleave:   
• Bibliography:   
• Spaced Repetition:   

Next: mathpixel, Up: Note-taking Add-ons   [Index]

Org-download

Org-download lets you screenshot and yank images from the


web into your notes:

Figure: org-download

(use-package org-download
:after org
:bind
(:map org-mode-map
(("s-Y" . org-download-screenshot)
("s-y" . org-download-yank))))

Next: Org-noter / Interleave, Previous: Org-download, Up: Note-


taking Add-ons   [Index]

44 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

mathpix.el

mathpix.el uses Mathpix’s API to convert clips into latex


equations:

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))

Next: Bibliography, Previous: mathpixel, Up: Note-taking Add-


ons   [Index]

Org-noter / Interleave

Org-noter and Interleave are both projects that allow


synchronised annotation of documents (PDF, EPUB etc.) within
Org-mode.

Next: Spaced Repetition, Previous: Org-noter / Interleave, Up:


Note-taking Add-ons   [Index]

Bibliography

org-roam-bibtex offers tight integration between org-ref, helm-


bibtex and org-roam. This helps you manage your bibliographic

45 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

notes under org-roam.

For example, though helm-bibtex provides the ability to visit


notes for bibliographic entries, org-roam-bibtex extends it with
the ability to visit the file with the right ‘#+roam_key’.

Previous: Bibliography, Up: Note-taking Add-ons   [Index]

Spaced Repetition

Org-fc is a spaced repetition system that scales well with a large


number of files. Other alternatives include org-drill, and
pamparam.

Next: Keystroke Index, Previous: Appendix, Up: Top   [Index]

21 FAQ

• How do I have more than one Org-roam directory?:   


• How do I migrate from Roam Research?:   
• How do I create a note whose title already matches one of
  
the candidates?:

Next: How do I migrate from Roam Research?, Up: FAQ   [Index]

21.1 How do I have more than one Org-roam directory?

Emacs supports directory-local variables, allowing the value of


org-roam-directory to be different in different directories. It
does this by checking for a file named .dir-locals.el.

To add support for multiple directories, override the org-roam-


directory variable using directory-local variables. This is what
.dir-locals.el may contain:

((nil . ((org-roam-directory . ".")


(org-roam-db-location . "./org-roam.db"))))

All files within that directory will be treated as their own


separate set of Org-roam files. Remember to run org-roam-db-
build-cache from a file within that directory, at least once.

46 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Next: How do I create a note whose title already matches one of


the candidates?, Previous: How do I have more than one Org-
roam directory?, Up: FAQ   [Index]

21.2 How do I migrate from Roam Research?

Fabio has produced a command-line tool that converts


markdown files exported from Roam Research into Org-roam
compatible markdown. More instructions are provided in the
repository.

Previous: How do I migrate from Roam Research?, Up: FAQ  


[Index]

21.3 How do I create a note whose title already


matches one of the candidates?

This situation arises when, for example, one would like to create
a note titled “bar” when “barricade” already exists.

The solution is dependent on the mini-buffer completion


framework in use. Here are the solutions:

Ivycall ivy-immediate-done, typically bound to C-M-j.


Alternatively, set ivy-use-selectable-prompt to t, so
that “bar” is now selectable.
HelmOrg-roam should provide a selectable “[?] bar”
candidate at the top of the candidate list.

Next: Command Index, Previous: FAQ, Up: Top   [Index]

Appendix A Keystroke Index

Next: Function Index, Previous: Keystroke Index, Up: Top   [Index]

Appendix B Command Index

Next: Variable Index, Previous: Command Index, Up: Top  


[Index]

47 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Appendix C Function Index

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 

Previous: Function Index, Up: Top   [Index]

Appendix D Variable Index

Jump to:   O 
Index Entry Section

48 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

org-roam-buffer: The Org-roam Buffer


org-roam-buffer-height: The Org-roam Buffer
org-roam-buffer-position: The Org-roam Buffer
org-roam-buffer-width: The Org-roam Buffer
org-roam-buffer-window- The Org-roam Buffer
parameters:
org-roam-completion-everywhere: Link Completions
Everywhere
org-roam-completion-functions: Completions
org-roam-completion-ignore- Completions
case:
org-roam-dailies-capture- Configuration
templates:
org-roam-dailies-directory: Configuration
org-roam-db-location: Directories and Files
org-roam-db-update-idle- The Database
seconds:
org-roam-db-update-method: The Database
org-roam-directory: Directories and Files
org-roam-encrypt-files: Encryption
org-roam-file-exclude-regexp: Directories and Files
org-roam-graph-edge-cites- Graph Options
extra-config:
org-roam-graph-edge-extra- Graph Options
config:
org-roam-graph-exclude-matcher: Excluding Nodes and
Edges
org-roam-graph-executable: Graphing
org-roam-graph-extra-config: Graph Options
org-roam-graph-node-extra- Graph Options
config:
org-roam-graph-viewer: Graphing
org-roam-index-file: Index File
org-roam-link-auto-replace: Inserting Links
org-roam-link-title-format: Inserting Links
org-roam-link-use-custom-faces: Org-roam Faces
org-roam-tag-sources: Customizing Tag
Extraction
org-roam-title-sources: Customizing Title
Extraction

49 de 50 11/2/21 21:33
Org-roam User Manual https://www.orgroam.com/manual.html

Jump to:   O 

Emacs 28.0.50 (Org mode 9.5)

Footnotes

(1)

To understand more about Roam, a collection of links are


available in Note-taking Workflows.

(2)

Depending on your completion framework, you may need to


press TAB to see the list.

50 de 50 11/2/21 21:33

You might also like