Q: how can I get the last time I built the org agenda buffer?

I've set an idle timer to rebuild my org agenda buffer every x minutes. It works fine, but it's inefficient to rebuild if the agenda files have not been modified since the last rebuild.

I can get the last modification time of, say, the first agenda file with (nth 5 (file-attributes (car org-agenda-files))) and compare it to some hypothetical last-agenda-rebuild variable with time-less-p. However, I don't know where to look for the last rebuild time (or if it's even stored anywhere).

1 Answer 1


Idle timer uses current-idle-time to run. So, you can't get last time when it was activate. But you can save the time when it was active.

(defun org-build-agenda ()
  (set last-build-time (current-time-string)
   ;; build agenda)

(setq org-build-timer
      (run-with-idle-timer 5 t 'org-build-agenda))

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.