Binary notes files

Hi all,

First of all many thanks for the development of org-roam, it’s been a remarkable tool to use.

I have a question about how people are handling binary files.

I take a lot of notes by text but I also take many notes that can’t be easily reduced to just text but should be first-class citizens in the notes system. For example a calculation in Mathematica or a Jupyter notebook, something hand written in Write as svgz file, a photo of a whiteboard.

For more formal references like research publications I use Zotero and ORB and I add notes to my org-roam database with lose coupling to the reference via the citekey. But there are a lot of files that I don’t want in Zotero, or they are still changing (I might add to a calculation in Mathematica or Write for instance).

My current solution is to have a Files/ dir in my notes dir, and every binary file should have a ‘shadow’ org note with a link to that binary file in #+ROAM_REF. The relative path of the file is a unique id. The org file then has a description of the binary file and handles any metadata like tags and links.

This sort of works but feels clumsy and is easy to break by adding a binary file and forgetting to create the shadow org file. Also sometimes a directory is the object I want to add to my notes - e.g. a latex file with figures, the individual files are not the ‘note’, and the generated pdf is too static.

So I’ve been toying with the idea that each note should be a directory .note/ which must contain a .org but may also the contain binary files. This structure is conceptually simple, robust, easy to write scripts for but potentially heavy if most notes are just text.

Does anybody else have a similar need and have some neat solutions?

Hi,

My binary files are static images that I just put in a separate directory. Moreover, they are mainly screenshots taken with org-download and therefore filing them is done automatically.

In general, Org Roam is what its name implies - a collection of Org Mode notes. I don’t think it should even attempt to become something more, a general database or whatever. Org files are first-class citizens and from my perspective it’s not feasible to have something else as first-class citizens. It seems to me that you currently use Org Roam as a sort of aggregator of heterogeneous data. This is conceptually wrong. Using filesystem capabilities or specialised tagging/indexing software has much more to offer in this respect. I hardly believe Org Roam’s paradigm is going to change – its task and goal are simple – provide a way to aggregate and interlink Org Mode files. No less, no more. So for the use case like yours, it’ll be more productive to accept this paradigm as a postulate and then use the infinite extensibility of Emacs to build your workflow around it. You must shift you paradigm from an Org Roam note being a “shadow” into it being a central point of your note-taking or even organisational workflow.

So, in this paradigm a note is an Org Mode file. Everything else is an attachment, extension, blob — whatever. If you want to file a Mathematica calculation or a photo, you create an Org Roam note first. This way you won’t be able to forget to create it, right? Moreover, after some period of getting used to this workflow, you’ll notice that you have a couple of words or thoughts to be added into the note. You can, for example, document all the changes to your Mathematica script explaining how and when you came up with these changes and so on. With timestamps, tags, links, source code blocks – all the perks Org Mode and Emacs have to offer.

Now, for a practical implementation of your note-per-directory idea, this is easily achievable with org-roam-capture-templates:

(("d" "default" plain #'org-roam-capture--get-point "%?" 
   :file-name "%<%Y%m%d%H%M%S>-${slug}/metadata.org" 
   :head "#+title: ${title}\n" :unnarrowed t))

Voìla! Run “M-x org-roam-find-file”, type your title, say “My Mathematica calculation”, and you instantly get the file “metadata.org” in the automatically created directory “20201017160715-my_mathematica_calculation”. The file only contains “#+TITLE: My Mathematica calculation”, but you can add many more things in your template. It would be more or less easy, for example, to use org-attach machinery or standard shell tools to semi- or even fully automatically copy any binary data into the directory, either from one of the org-capture- hooks, or directly from the template.

1 Like