Skip to content

Instantly share code, notes, and snippets.

@saintaardvark
Created January 16, 2015 15:09
Show Gist options
  • Save saintaardvark/375aa054c15f02c42f45 to your computer and use it in GitHub Desktop.
Save saintaardvark/375aa054c15f02c42f45 to your computer and use it in GitHub Desktop.
Emacs tip-of-the-day
(defun totd ()
(interactive)
(with-output-to-temp-buffer "*Tip of the day*"
(let* ((commands (loop for s being the symbols
when (commandp s) collect s))
(command (nth (random (length commands)) commands)))
(princ
(concat "Your tip for the day is:\n"
"========================\n\n"
(describe-function command)
"\n\nInvoke with:\n\n"
(with-temp-buffer
(where-is command t)
(buffer-string)))))))
@saintaardvark
Copy link
Author

Can't remember where I came across this, but it's a wonderful thing.

@kmdouglass
Copy link

I changed loop to cl-loop in Emacs 26.1 to make this work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment