Crazy idea for Emacs: Random Emacs taglines

| emacs

Would anyone happen to know of a way to select a random symbol with a
description?

Actually. Hmm.

(progn
  (apropos ".")
  (write-file "~/.taglines.random-emacs-symbols")
  (delete-matching-lines "Plist")
  (delete-matching-lines "not documented")
  (replace-regexp "\n  " " - " nil)
  (delete-non-matching-lines " - "))

Et voila! Random Emacs taglines together with the code:

(defun sacha/random-tagline (&optional file)
  "Return a random tagline and put it in the kill ring."
  (interactive)
  (with-current-buffer (find-file-noselect (or file "~/.taglines"))
    (goto-char (random (point-max)))
    (let ((string
           (buffer-substring (line-beginning-position)
                             (line-end-position))))
      (kill-new string)
      string)))

(defadvice remember (after sacha-tagline activate)
  "Add random tagline."
  (save-excursion
  (goto-char (point-max))
  (insert "\n\nRandom Emacs symbol: "
          (sacha/random-tagline "~/.taglines.random-emacs-symbols")
          "\n\n")))))

Random Emacs symbol: eshell-remove-entries – Function: From PATH, remove all of the given FILES, perhaps interactively.

You can comment with Disqus or you can e-mail me at sacha@sachachua.com.