r/orgmode • u/vfclists • 10d ago
question What methods are there for checking when the content of an org headline or node was updated?
The places that come to mind readily are LOGBOOK timestamps and date values like the DEADLINE, CLOSED AND SCHEDULED values.
The only others I can think of are custom properties which are manually updated, eg an UPDATED-TIMESTAMP property.
Any others?
Is there an API for checking the
6
Upvotes
2
u/mmarshall540 10d ago
Not sure if you are including this in the above, but pressing
C-c C-zlets you add a "note" to a heading. It can either go in a LOGBOOK drawer or as a list item at the top of a heading's content and includes an inactive timestamp...TIMESTAMP_IA property
Since it is placed immediately after the headline or properties drawer, you can use the
TIMESTAMP_IAspecial property in a custom agenda-view to get a list of notes from the last 30 days or some other date range.It's a manual approach, so you have to remember that your updates to an existing heading should go into this kind of note. Alternatively, you could just type
C-c C-z C-c C-cto add the note and timestamp without any text.So it doesn't automatically catch every single update the way that your filesystem's
mtimewould in a single-file-per-note type system (e.g. Denote or Org-roam). But I like it better this way. If I correct a minor typo in an old note, I don't necessarily want that to push the note to the top of my recent-notes list. Also, by preferring this top-note style of updating, it provides a better view of how my thoughts on a topic have changed over time.Here's the entry in my
org-agenda-custom-commandslist for showing notes created or updated in the last 30 days.custom MODIFIED property (not recommended)
Before this, I would use a custom
MODIFIEDproperty. But I stopped using that because it was hard to maintain the code that sets it, and it would update the timestamps even when minor changes were made. Basically the code would calculate a hash for each heading in a file and compare it with the heading's existingHASHproperty. If they were different, it would update both the hash property and the timestamp stored in theMODIFIEDproperty. This meant that any minor change to a note always updated the timestamp.So I don't recommend trying to automate tracking of modification times. The built-in
C-c C-zway work best for me.custom CREATED property (recommended)
You may notice this in the custom agenda-view code above. This is something I saw the Orgzly-revived android app doing, so I added it to my Emacs config to match.
All it requires is some simple code that adds the property with a timestamp whenever a new note is created. It only adds the property upon note creation, so it's much easier to maintain and doesn't cause problems if some new package makes automated changes to your headings.
Here's the code I use to automatically add this property to new notes.
This adds the
CREATEDproperty when adding notes withM-RET,C-RETandorg-capture. But it doesn't add the property if you just manually type a heading into your file with asterisks and a space at the beginning of a line. Didn't feel the need for that.