Update a field (#+LAST_MODIFIED: ) at save

@tea4or2wo

Mine is this based on Jethro’s suggestion, and works perfectly in my markdown files (it should work on any other text file types, like org)

(add-hook 'after-init-hook
          (lambda ()
            (my/load-md-roam)
            ;; time stamp
            (setq time-stamp-start "modified:[       ]+\\\\?")
            (setq time-stamp-end "$")
            (setq time-stamp-format "%Y-%m-%dT%H%M%S")
            (add-hook 'before-save-hook #'time-stamp)))

For where you can see the recommendation not to change the variable:

The documentation of the variable time-stamp-pattern – you should be able to view it via C-h v (describe-variable)