Create Custom Org-Mode Links to Open My External Zettelkasten App

I’m a fan of linking into my Zettelkasten. I usually do this via a convention: when a 12-number digit is used to signify a timestamp with accuracy to the minute, like 202102101025 for 2021-02-10 10:25, then I expect this to be a note identifier in my note archive. When the timestamp is accurate to the second, I expect this to be something else outside my note archive, like invoices I filed away. To utilize this information, in the worst case, I have to copy the ID and paste it into Spotlight to get to the note.

For my own note-taking app, The Archive, there is a URL scheme to remote-control the app the exact same way that internal links between notes work: thearchive://match/IDENTIFIER.

That can be used for rich text editors to create hyperlinks.

That can also be used to create outgoing links from my Emacs org-mode files.

For example I picked up a fix to a problem on the web, created a note so I can later remember what and why and how, and then I want to attach this note to a task in my org-mode project files. I can register a new link type, zettel, to make this work. The types are prefixed like URL schemes in org links, so I’d use it like so:

See: how to fix XYZ.[[zettel:202102101033]]

I could also add an optional link anchor text, but I usually don’t like to have a very long clickable link. I prefer links to not take up a whole line, or most of it, because the stark blue color is rather distracting from the text around it.

This is the Emacs lisp code to register the link prefix:,


  :follow (lambda (searchterm)
                  (browse-url (concat "thearchive://match/" searchterm)))

  ;; Don't fold links but show ID and description:
  ;;   [[zettel:202102101021][Title or description here]]”
  :display 'full)

With that in place, zettel:-prefixed links in org files execute the URL scheme for The Archive. You can replace the URL scheme with something else, if you don’t use my app.

There’s a ton of customization I just skipped. I got the inspiration for this while reading How do I make a new link type? in Musa Al-hassy’s article on org-special-block-extras – it is packed with a ton of customizations to transform org-mode blocks into interactive HTML pieces, argument trees, and whatnot. It’s crazy and I don’t understand half of it. Go read it.