Where parallels cross

Interesting bits of life

Moldable Emacs: taking lispy notes that are easier to search!

Too long; didn't read

How about taking lispy notes? Here I am going to show a still immature but promising way of taking notes via molds.

The problem

I love Org Mode! You can say that it was the start of my Emacs adventure. From important dates to my mumbling and aspirations, Org Mode is always sustaining my planning. I would like Org Mode everywhere if possible. And I guess I am not alone, since people actually developed apps to bring it on mobile.

One place I would like Org Mode is in my projects. Say I am thinking about something related to a line of code. Now I have to capture a note with a link. When I want to find that note, I need to jump in an Org buffer. Not really dynamic enough, is it?

And then, sometimes I discover some cool command for eshell or vterm. If I take a note about that, I would have to search it when I need it! Indeed, so far I would use an Org Roam note and I would add a label (e.g., "eshell") in the title. Why do I need to tell my computer where to search? Often the context is clear: the computer should guess for me!

It is a problem indeed

If you are a habitual reader of my blog, you may know by now that context-switching is my nemesis. When I have to stop to find the related Org Mode file for "that note I am sure I had somewhere", well that is a pain. By the time that I find what I need, I need to recover what I was doing in the first place!!

This happens a lot with my note taking. Even the splendid Org Mode suffers this issue. The answer for coding (I very much appreciate) was Org Babel, which lets you bring the code in Org Mode. As much as I practice that, it is not an universal answer. I can tangle code for small projects, but maintaining source blocks is too big of a challenge. So I say: if the code cannot go to the notes, let's make the notes go to the code!

And there is a solution

This is an experiment that is working well for my work, so I feel it already valuable. I am missing a bunch of features I would like to have (e.g., deleting a note XD). Get in touch if you have ideas on how to use this with more comfort.

Let me demo this for you first.

As you can see, I am in a buffer, I highlight something, call the "AnnotateWithOrg" mold and add an Org Mode note. Then I can retrieve notes by buffer or even by mode!!! And I can list notes in the Lisp or Org Mode format.

This is how a lispy note looks like.

(:given
 (:node
  (:key "2021-06-05+17:54:05" :type position :text "    ;; TODO make this smarter" :begin 919874 :end 919903 :buffer "config.org" :buffer-file "~/config.org" :mode org-mode))
 :when nil :then
 (:string "TODO I need to act on the internal representation of molds!"))

The format is in a story-telling style. Given something (a node position in this case), then I have a note. I believe this structure will let me make some cool features later on. I am craving to have some time with :when really, to make things a bit more dynamic.

Anyway, I recently added also an optional :git-hash attribute. The idea here is to make notes stick to a particular commit. We could make an history of our notes!

Ah and by the way, you can also see all your notes as a journal since the ids contain dates.

As you could see you can take notes as Org Mode files, so we can inherit Org superpowers too. This flexibility makes simple to export notes to Org Roam too: we could upgrade our notes to a Zettelkasten!

The thing that I like most of this (immature) system is that I can stick notes to buffers. That provides a natural way to focus my search.

Also notes are easy to program. Lisp comes first. The Org Mode format is just a way to manipulate Lisp. As soon as we are done, it returns to be something we can program. This is why it is so simple to group notes by mode or project.

I have few notes for now, so I guess I will have to look into storage later. But maybe I don't have to: at that point I could export notes to Org Roam path, and so I could reuse their database system. Imagine a note system that migrates to the best host every time we need to!

I hope this is just a great start of an useful mold!

Conclusion

Again this is all available in moldable-emacs. Grab a copy, let me know if it difficult to install, and take a note!

Happy note taking!

Comments