Skip to content

Instantly share code, notes, and snippets.

@arocks
Created September 21, 2020 08:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arocks/cfae962a38ceab2f3c44f01660913cc7 to your computer and use it in GitHub Desktop.
Save arocks/cfae962a38ceab2f3c44f01660913cc7 to your computer and use it in GitHub Desktop.
Emacs greeting appearing in the *scratch* buffer that changes based on the time of the day and day of the week.
;; Initial scratch buffer greeting
(defun arun/greet-by-hour ()
"Greet morning/evening/afternoon based on time of the day"
(let ((hour (string-to-number (format-time-string "%H"))))
(cond ((< hour 12) "morning")
((< hour 18) "afternoon")
(t "evening"))))
(setq user-full-name "Arun Ravindran")
(setq-default initial-scratch-message
(concat ";; Happy hacking " "on a " (format-time-string "%A") " " (arun/greet-by-hour) ", " user-full-name " - Emacs ♥ you!\n\n"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment