Denote's file naming scheme and org-roam

Hello,

There is nice Emacs package - Denote for taking notes which lacks graphing capabilities, but it has interesting file naming scheme where filenames e.g. contains tags used in notes’ meta.

It looks that it is is not so simple to adapt org-roam’s naming scheme to Denote to take advantage of org-roam-ui, but wonder about the other way: adapting Denote’s naming to org-roam or this is even more complex considering org-roam’s usage of sqlite3 database?

I think that’s feasible either direction. Denote generates file names based on some rules (programmed). For Org-roam, that’s just part of the capture template. Filenames should not be relevant with use of database. A challenge may be adaptation of “tags”. I’d start without tags and see how far I would get.

You can use Denote to take notes in Org mode, instead of capture, and add IDs so that Org-roam can save the files as nodes.

I was looking into Denote but never tried it due to the lack of graphing capabilities. However, the idea of programmed rules for file naming is appealing. Author of Denote Prot argues that "different field separators, “namely -- and __ introduce an efficient way to anchor searches”.

That is interesting and therefore I wonder how exactly could this workflow work?

You can use Denote take notes in Org mode, instead of capture, and add IDs so that Org-roam can save the files as nodes.

Sure. There are a couple of approaches, but the easiest would be to personalize the front matter.

You can read the relevant part of the manual where Prot talks about changing the front matter.

As a proof of concept, put the snippet below in your init.el before you load/require denote – there is a quirk with Denote at the moment, and you need to set this variable before it is loaded. I have sent a patch to make it easy for users to personalize the front matter. Let’s see how it goes.

(setq denote-org-front-matter
      ":properties:
:ID: %4$s
:end:
#+title:      %1$s
#+date:       %2$s
#+filetags:   %3$s
\n")

If you don’t want to remove the default #+identifier, you can add it with the value %4$s to repeat the same ID inserted – as far as I can see, it’s there only for informational purposes. Prot also shows an example of removing it in the user manual (in the same section above).

The resultant Org note will look like this. The rest should be easy: set the denote-directory to your org–roam-directory, and turn on org-roam-db-autosync-mode before creating the note. Org-roam should use the ID to save it to the database as a normal Org-roam file-node – I have not tested it myself but that should just work. If I recall correctly, even when the ID is not generated with an org-id function, Org-roam adds it to the org-id-locations-file. Any issue, you can come back here; I’m pretty sure we can work out a way.