Emacs: Roaming Roam (publ. 2024-04-18)

I feel like a big hole in the Org Roam paradigm, or at least the implementation, is how do you deal conveniently with multiple projects. I.e., you want to be able to keep your nodes segregated in some way, by project or context, but all your nodes will go into the same directory and database, creating a lot of noise during completions, or forcing you to add prefixes or such like onto node titles.

One solution is to just change your active roam directory and database file by setting the corresponding variables, namely roam-dir and roam-db. Of course, that is a lot of typing so it begs for some convenient emacs function. For this, I fell back to using an alist plus completion. Here is some code in my init.el:

A very simple approach. The select-roam interactive function allows you to quickly select a configuration from your alist. However, it raises the question of how do you conveniently keep track of which roam you are using at any given moment. My approach was to put this information in the mode line. This can be done by implementing a simple minor mode that adds this information to global-mode-string, a variable affecting the format of part of the mode line. I threw one together quickly, using the example tracking minor mode in the rcirc code.

This code adds a string to the mode line, based on the name of the top-level directory component of roam-dir. This is simple, but does require you to take some thought as to what name you want to give to your roam directories, so as to make the corresponding mode-line output both short and descriptive. E.g., you probably want to name the directory "homework-roam" rather than just "roam" or "roam-for-homework-notes".

I'm considering the above code to be trivial, and therefore not requiring a license for reuse. But it would be nice to have something like this developed a little more and either packaged or integrated into org-roam itself.

This work © 2024 by Christopher Howard is licensed under Attribution-ShareAlike 4.0 International.

CC BY-SA 4.0 Deed

Proxied content from gemini://gem.librehacker.com/gemlog/starlog/20240418-0.gmi

Gemini request details:

Original URL
gemini://gem.librehacker.com/gemlog/starlog/20240418-0.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.