As I consume a lot of drugs, I created an org-mode file that updates the status of my stock every day. It is done at the start of Emacs and it slows down significantly. As I sometimes run Emacs on a single day, I would like a test to see if the file has been updated in the current day.

(defun file-updated-today-p (file) .....)

Here's a function that compares today's date with the last modification date of FILE. If both strings are equal, return t.

(defun file-updated-today-p (file)
  (string= (format-time-string "%F")
           (format-time-string "%F" (nth 6 (file-attributes file)))))

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.