# Using Emacs's org-mode As Your Zettelkasten

## (And some editorializing on the foundations of mathematics)

Posted on March 25, 2020

I like to write. I don’t do it as often as I’d like to, but nonetheless I do like to do it. I’ve found that one of the best exercises for increasing the bandwidth of the passageway from my brain to my fingers is superfluous note taking. Couple this Good Thing with a Could Appear Like A Good Thing But Is Dubious At Best Thing, namely ADHD/anxiety-induced procrastinatory over-organizing, one could imagine that how I choose to organize those notes is something that I (superfluously) think about. I’ve tried them all, notebooks, Evernote, Google Keep, even a custom markdown-to-jekyll app that was synched by Dropbox. However, when I switched to Emacs about 2 years ago and started using Org mode, it, as a medium, really stuck. Since then I’ve just been spinning and churning with nearly no success on how to organize my org file(s). And then, about a week ago, I encountered neuron in the Haskell Weekly newsletter, and because I’m prone to buy wholesale anything a smart person says about note-taking, my interest was piqued. The neuron author linked to this Zettelkasten overview, which I promptly devoured and, well, I had to do it. Please read what I linked above for a nice narrative on Zettelkasten’s origins. What follows is just a skeletal exposition.

## Zettelkasten

Literally “note box”, the original zettlekasten was a piece of furniture with index card drawers, six-by-six, like one of those bygone cabinets you used to see at the library for filing books’ locations with Dewey Decimal Classification. Those index cards followed four simple rules:

1. A unique id.This id needs to be unique, but is in general arbitrary and needn’t necessarily be related to the note’s content.

2. One idea per card.
3. Tag each idea/card (optionally).
4. Each idea/card links to related ideas.

Given these rules, one can begin to build a cache of knowledge linked together almost like neurons, but definitely like a graph that you can explore from any ingress “idea vertex”Niklas Luhmann, the creator of the original zettelkasten occasionally referred to it as a “conversation partner”.

Aha! A system. What kind of programmer would I be if I didn’t automate as much of this system as possible?

### Step One: A zet Command

To begin, I wanted a way to “start the conversation” with my zettelkasten. To me, that looked like just telling it about a new topic. Something like this:

$zet the sorites paradox  Which I would expect to open an editor and let me try and get this thought from my head to my fingers with as few barriers as possible. To this end, I created a small bash script to put on my path: #! /usr/bin/env bash set -e ZROOT=${ZET_ROOT:=~/Dropbox/zet}

name="$ZROOT/$(date +"%Y-%m-%d-%H%M")"
content="*"

for word in $@; do name+="-$word"
content+=" ${word^}" done if [ ! -e "$name.org" ]; then
echo -e "$content\n\n#+FILETAGS:" >$name.org
fi

emacsclient -n \$name.org

In terms of new code, this is the extent of it for this Org mode-based zettelkasten. It pokes my pretty-much-always-running Emacs server and opens a file whose name is prepended by the date and time, followed by a dash-joined version of what I typed out at the command line. As an example, right now it’s March 26th, 2020 11:58 AM. So given the zet command I ran above, I’d get a file created for me called 2020-03-26-1158-sorites-paradox.org and that file’d have the following content:

* Sorites Paradox

#+FILETAGS:


That I can go on to add content to:

#+FILETAGS: :philosophy:fom:

mathematics, from the Foundations of Mathematics mailing list no less.

#+BEGIN_QUOTE
Maybe ZFC is not the most natural framework in order to express
emergent properties related to the so-called Sorites Paradox. For
example, one neuron is not an intelligent brain. If we have a system
consisting of n neurons that is not an intelligent brain, to add one
neuron more to the system will not transform it into an intelligent
brain. The conclusion seems to be that there are not intelligent
brains in nature, which is contradicted by experience. Therefore,
sciences depending on emergent properties (neurology, biology, etc)
#+END_QUOTE


Then let’s say that I’d had a thought of my own (mind you, one that I cannot and will not defend):

* Category Theory Metatheory

#+FILETAGS: :fom:philosophy:

*Category theory is a metatheory for mathematics.*

This idea brought to you by O explaining multiplication to T about how
it's /like/ addition, but you add one number to itself the other
that sparked the thought, because it captures the arity of the
addition and multiplication operator, which is the point she was
making. They have the same shape. With Cartesian closed categories,
you can give a metatheory for this shape, i.e. with currying, and what
is math if not functions with some arity?


These two ideas are related insofar as one is a dilettante spitballing about the foundations of mathematics and the other is an expert sharing their insight about the foundations of mathematics. While I was writing this post and thinking about the neuron to intelligent brain paradox I remembered the nonsense my own brain synthesized while O explained multiplication to T, so, yeah, I want to link these two things in my zettelkasten—because that’s the whole point!

I’ll add that link by typing ctrl + c ctrl + l (C-c C-l) then start to type file which gives me this menu (I’m using Helm):

When I hit return, it shows my list of files in the current directory. That is, the directory of the file I’m currently visiting:

From here I can use the arrow keys or the completion search that Helm gives me to find the note I’d like to link. Now I’ve got a link in this note:

* Category Theory Metatheory

#+FILETAGS: :fom:philosophy:

*Category theory is a metatheory for mathematics.*

This idea brought to you by O explaining multiplication to T about how
it's /like/ addition, but you add one number to itself the other
that sparked the thought, because it captures the arity of the
addition and multiplication operator, which is the point she was
making. They have the same shape. With Cartesian closed categories,
you can give a metatheory for this shape, i.e. with currying, and what
is math if not functions with arity?



And if I’d like to follow it, I can just do ctrl + c ctrl + o (C-c C-o), or org-open-link-at-point.

Emacs Org mode has something called an agenda, that works as an aggregator over a collection of Org files. It can do some pretty amazing things like build a calendar for you, help you track your habits, or organize your todo list. For us, now, though, we’re going to use its tag and string matching searches. It does require a little setup in your init.el file to enable it, something like this:

(global-set-key (kbd "C-c a") 'org-agenda)
(setq org-agenda-files '("~/Dropbox/org/notes/todo.org" "~/Dropbox/zet/"))

This results in the key sequence ctrl + c a being globally bound to opening Org Agenda, which looks like this:

From here I can use m to search by tag matches, or s for string matches, both of which yield a list of matches:

I can just arrow down and select one of the matching headlines to open the file containing it.

## Valedictions

I’ve only started to build up my own zettelkasten, but it truly feels like I’ve found a thing that fits, that works.

One important factor I’ve found with note taking, at least for me, is for my note compendium to be append-only. I can’t let myself go back and pare down, edit and reëdit endlessly, because, unfailingly, I always end up deleting everything since of course no organizational scheme I can come up with is copacetic. The Zettelkasten approach actually saves me from myself here because there’s a single note per file, and I’m almost never inundated with an entire list.

Using my zettelkasten stirs up that nostalgic feeling of going through an old notebook every time I open it, and I’m only ever confronted with the ideas I’ve asked of it. It narrows the aperture to a topic in a way that saves me from myself and the consequences of the inexorable self-loathing of an anxious mind. If anything from these last few paragraphs resonates at all, I think it may work for you too.

Happy remembering!