Skip to content

Instantly share code, notes, and snippets.

@emres
Created November 12, 2015 22:14
Show Gist options
  • Save emres/9ee29a2dd3af8da1077e to your computer and use it in GitHub Desktop.
Save emres/9ee29a2dd3af8da1077e to your computer and use it in GitHub Desktop.
Emacs Lisp function to check whether the current date is Friday the 13th with full moon
(require 'cl)
(defun friday-the-13th-full-moon-p ()
"Return true if the current day is Friday the 13th with a full moon."
(let ((value)
(current-day (nth 3 (decode-time)))
(current-month (nth 4 (decode-time)))
(current-year (nth 5 (decode-time)))
(full-moon 2))
(dolist (elt (lunar-phase-list current-month current-year) value)
(let ((year (caddar elt))
(day (cadar elt))
(month (caar elt))
(lunar-phase (car (last elt))))
(when (and (eq day current-day)
(eq month current-month)
(eq year current-year)
(eq lunar-phase full-moon))
(setq value 't))))))
(provide 'friday-the-13th-full-moon-p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment