Skip to content

Instantly share code, notes, and snippets.

@thomp
Created March 31, 2020 20:15
Show Gist options
  • Save thomp/a1790d76fa5b3937c46b73a94ba09ba7 to your computer and use it in GitHub Desktop.
Save thomp/a1790d76fa5b3937c46b73a94ba09ba7 to your computer and use it in GitHub Desktop.
run emacs diary if idle and we're on a new day
(defvar dat-diary-idle-timer
;; day of week
(let ((dat-ran-diary-on-day -1)
(idle-sec 600))
(run-with-idle-timer
idle-sec
t
#'(lambda ()
;; check if we've run diary yet today
(let ((day-number (calendar-day-of-week (calendar-current-date)))))
(when (not (= (dat-ran-diary-on-day)
day-number))
(setf dat-ran-diary-on-day day-number)
(diary))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment