Emacs Bookmarks: Cheap File Metadata (publ. 2024-11-01)

Something I've been exploring lately is using Emacs bookmarks as a file metadata system. The basic idea is that Emacs bookmarks allow annotations to be attached to them, and so I can create bookmarks for files, and attach annotations to the bookmarks giving some additional information about them. Here are some example use cases from my life:

(1) Attaching additional model or part numbers to a data sheet file that I have downloaded, since the file name by itself might not be descriptive enough when doing a search through my data sheet file directory.

(2) Attaching summary information or notes about source code files without changing the source code itself.

With the added bookmark+ functionality, it is possible to view all file annotations in one buffer, along with the file names, and search through them. So that is kind of like a metadata search.

Bookmark Plus

The bookmarks do not automatically follow the files, if the name or location is changed, so I can't really see using this approach for all your files. But if you could some project files or a directory of files, where the name and tree organization doesn't get modified much, it could be useful.

The bookmark+ package makes a lot of API available for creating bookmarks and adding annotations, as well as more functionality for organizing bookmarks and browsing them. In a recent project at work, I used this API, along with some of my own Elisp, to extract a bunch of documentation data out of 1200 old Fortran source code files, and translate those into Bookmarks with annotations. Screenshot:

annotations extracted from Fortran source code

My code:

sldoc-annotations repository

I don't want to oversell bookmarks as a wonderful general solution for file metadata. But there is a lot more power and possibilities to bookmarks than just a way to record positions in files, at least with bookmark+ loaded.

This work © 2024 by Christopher Howard is licensed under Attribution-ShareAlike 4.0 International.

CC BY-SA 4.0 Deed

Proxied content from gemini://gem.librehacker.com/gemlog/starlog/20241101-0.gmi

Gemini request details:

Original URL
gemini://gem.librehacker.com/gemlog/starlog/20241101-0.gmi
Status code
Success
Meta
text/gemini
Proxied by
kineto

Be advised that no attempt was made to verify the remote SSL certificate.