0

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) .....)

1 Answer 1

3

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 agree to our terms of service and acknowledge you have read our privacy policy.

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