Utility package: org-roam-timestamps

Hi all!

Over at org-roam-ui HQ, we’ve been thinking about doing more with dates: sort your notes by most recently written, see notes that haven’t gotten much attention, generate github like activity plots etc.
Unfortunately that was not really possibly with stock org-roam, as the only info stored is the last access and modification time of the file, not the node.

To that end I wrote a small package called org-roam-timestamps, which allows you to add mtime and ctime properties to your property drawers and keep them up to date, like this

You can choose to keep a modification history, or to just keep the last mtime. I chose a filebased approach over an extension to the db structure because the org-roam db is somewhat ephemeral, in that you should be able to regenerate the complete db from the files at any point in time. Just putting this info in a new table/column would therefore not be a good idea.

As said before, the main use-case for this will be in org-roam-ui, but I’m sure someone might be able to use it for something else as well :slight_smile:

The main drawback atm is that updating is somewhat slow and only updates the node your cursor is on at the time of saving. I might try to rework that, if someone has any good ideas (outside of the ones listed in the repo) I’ll be happy to discuss this!

5 Likes

Lil gif of it in action

output

2 Likes

That looks really nice! So far I’ve been using Update a field (#+LAST_MODIFIED: ) at save - #28 by savnk but that’s rather an adhoc solution.

1 Like

Thanks! Coincidentally I just updated this package today so it should work somewhat better than before. Let me know if you run into any problems!

Nice. This was on my todo list for org-roam v2. For future reference, midas said org-expiry auto stamps creation time.

I chose a filebased approach over an extension to the db structure because the org-roam db is somewhat ephemeral, in that you should be able to regenerate the complete db from the files at any point in time.

I think placing in database is useful for sorting and filtering as I do so in org roam search.

The properties are included in the database, however they only appear in the “properties” column which is kind of hard to filter by itself through emacsql, do you perhaps have an idea how to do that?

I probably could force org-roam-timestamps to write this data to the database, but I don’t think it’s a good idea to do that if org-roam itself will overwrite that.