2021-05-04 16:07:40 +00:00
:PROPERTIES:
:ID: 7827b564-59ed-4604-ac2b-630c60c0a4ab
:END:
2021-04-01 16:08:15 +00:00
#+title : Use timestamps for effectively future-proofing your stuff
#+date : "2020-09-16 23:09:01 +08:00"
2021-05-04 16:07:40 +00:00
#+date_modified : "2021-05-04 20:52:09 +08:00"
2021-04-01 16:08:15 +00:00
#+language : en
2020-11-14 21:13:01 +00:00
2021-05-04 16:07:40 +00:00
One of the simplest ways to future-proof your documents with [[id:ccb3bc14-a801-4ed0-b066-50b1bcd853aa ][File metadata ]] is to create a timestamp.
2020-11-14 21:13:01 +00:00
Specifically, two timestamps: one when it's created and one when it was last modified which will be continuously updated each time we modify the file.
2021-05-01 18:18:43 +00:00
This lets you quickly evaluate whether the information is up-to-date without relying on the filesystem.
2021-05-04 16:07:40 +00:00
It also lets you [[id:66337935-420c-40e6-81a6-f74ab0965ed5 ][Maintain your own digital library ]] with relative ease if your focus is on up-to-date information.
2020-11-14 21:13:01 +00:00
2021-05-01 18:18:43 +00:00
In order to make updating the modification timestamp not tedious, it is best to automate that task.
2020-11-14 21:13:01 +00:00
Different files may be applied differently as long as we can create a unified interface to search through them all.
2021-05-01 18:18:43 +00:00
Here's an example with Org mode documents:
2020-11-14 21:13:01 +00:00
2021-04-01 16:08:15 +00:00
#+begin_src org :exports none
2020-11-14 21:13:01 +00:00
\#+DATE: "2020-09-16 23:53:00 +08:00"
\#+DATE_MODIFIED: "2020-09-17 10:33:42 +08:00"
2021-04-01 16:08:15 +00:00
#+end_src
2020-11-14 21:13:01 +00:00
2021-05-01 18:18:43 +00:00
Emacs has a built-in time stamp feature that already took care of that task.
We can then attach the timestamp update with a hook that will occur before saving the file and voila!
Automated timestamp for our text documents. :D
2020-11-14 21:13:01 +00:00
Here's my (Doom Emacs) specific config as of 2020-09-17 for future references:
2021-04-01 16:08:15 +00:00
#+begin_src elisp
2020-11-14 21:13:01 +00:00
(after org!
(setq
; Set a custom time-stamp pattern.
; Even though, it's not recommended, most of the time,
time-stamp-start "DATE_MODIFIED:[ ]+\\\\?[\"<]+ "))
; Modify the time-stamp with each save.
(setq time-stamp-format "%Y-%02m-%02d %02H:%02M:%02S%:z")
(add-hook 'before-save-hook 'time-stamp)
2021-04-01 16:08:15 +00:00
#+end_src