(or emacs irrelevant)

Happy New Year!


As 2020 is almost running out, I have noticed that I didn't manage to post anything this year. So here's a haphazard attempt to fix that.


I'd like to share a wonderful Emacs package I've started using this year: org-roam. Even though in my Org notes I see that I encountered this package in February 2020, I've actually started using it on December 10, trying to figure out what Zettelkasten are and how to deal with them.

Overall, 22 days isn't a whole lot of experience, and I'm looking forward to see how useful Zettelkasten and org-roam will be to me in a year. But I already have written down 341 notes, which amounts to around 15 notes per day.

In my previous/current system, plain-org-wiki, I organize my knowledge into 209 tag categories. For instance, one of them, Linux, has 290 entries. Another, VPN, has 15 entries. I'll show an example of how org-roam improved my workflow by showing a note I've added:

#+title: Use a custom DNS when resolving a specific host on Linux

On Linux, I have a DNS server that can resolve certain VPN-only websites. But the problem is that it's only available if I'm connected to my work VPN. So I can't configure it in a common way, since the common way would simply use that DNS always, whether or not it's up. The =dnsmasq= package solves all these issues.

The code: local, and permalink

Above is one zettel - a note named "Use a custom DNS when resolving a specific host on Linux" that's liked to two other notes: "Linux", and "DNS". Both of those notes are basically empty files that are used for tagging purposes. I use M-x org-roam-buffer-activate to see what other notes are linked to them.

Suppose, instead of using org-roam, I wanted to add the above piece of knowledge to my old system of tagged data. Does this information belong in Linux.org or in VPN.org? Moreover, do I really want to add one more entry to Linux.org? It's getting really crowded with 290 entries already there. So with the old system, it's the anxiety on where to put the note combined with the pressure of keeping it short. Both things are solved by using Zettelkasten!

Org-roam config

Here's my config for org-roam so far.

All of the functionality that I use is in the hydra below:

(defhydra hydra-org-roam (:exit t :idle 0.8)
  "Launcher for `org-roam'."
  ("i" org-roam-insert "insert")
  ("f" ora-org-roam-find-file "find-file")
  ("v" org-roam-buffer-activate "backlinks")
  ("t" ora-roam-todo "todo"))

The only difference between ora-org-roam-find-file and org-roam-find-file is that my variant supports ivy actions.

And ora-roam-todo is a small wrapper around this code, which gives me an overview of loose ends in my notes that I'd like to follow up on:

  (setq unread-command-events
        (listify-key-sequence (kbd "C-c C-o M->")))
  (counsel-rg "^\\* TODO" org-roam-directory "--sort modified"))

What the above does technically: runs counsel-rg on my org-roam-directory looking for * TODO, while sorting on the file modification date, instead of the default sorting by path. Here, C-c C-o is the binding of ivy-occur, and M-> is end-of-buffer. And the whole code overall produces an ivy-occur buffer without having to go into minibuffer and press C-c C-o manually. The unread-command-events trick is a nice way to automate this.


I'd like to thank the creators of org-roam. Well done!

Happy New Year! I wish everyone good health, justice, equality, and happiness!