Little Fun with Emacs Start Buffer

fortune in emacs

Emacs is essential to my daily work flow in the past couple of years, and there are so many things that I love about it. On top of the list is the fact that customization is built to the core of the editor. The extensions written for Emacs are really not in any way different than most other part of the editor. In fact, Emacs itself can be considered as the extension of a tiny little core.

How easy is it to enjoy a little wisdom from a naughty cow when you open up your favorite editor?

1
2
3
4
5
6
(defun cowsay-fortune-fun ()
  "customzied scratch buffer"
  (let ((my-buffer (get-buffer "*scratch*")))
    (with-current-buffer my-buffer
      (insert (shell-command-to-string "cowsay $(fortune)")))
    (switch-to-buffer my-buffer)))

That’s it! Just remember to have cowsay and fortune installed :stuck_out_tongue:

Written on September 12, 2014