index all rss twitter github linkedin email

Álvaro Ramírez

17 June 2016 Emacs and emotional vocab

Having read Are You in Despair? That’s Good, I was encouraged to expand my emotional vocabulary. As a zone.el fan (checkout nyan, sl, and rainbow), I looked into writing a zone program. When zone-when-idle is set, zone acts as a screensaver of sorts. We can use this to display random emotional vocab whenever Emacs is idle for a period of time. Let's get to it…

Zone keeps a list of programs to choose from when kicked off. Below is a basic zone-hello program, along with an interactive command for previewing. Not much to these. The tiny program prepares the screen for zoning and inserts text while no input is pending.

(defun zone-hello ()
  (delete-other-windows)
  (setq mode-line-format nil)
  (zone-fill-out-screen (window-width) (window-height))
  (delete-region (point-min) (point-max))
  (goto-char (point-min))
  (while (not (input-pending-p))
    (insert "hello zone\n")
    (zone-park/sit-for (point-min) 0.2)))

(defun zone-hello-preview ()
  (interactive)
  (let ((zone-programs [zone-hello]))
    (zone)))

Here's what zone-hello looks like:

minimal-zone.gif

Back to improving our emotional vocabulary, we'll need a dictionary for our goal. A quick search yields a potential list of words. We can use WordNet to define them while offline. These two sources will do for now. We tie it all together in zone-words.el and the resulting zone program looks as follow:

emotions.gif

UPDATE: Just came across Animations With Emacs. A post with awesome zone examples.