Feeds:
Posts
Comments

Posts Tagged ‘neat trick’

Clever Emacs Lisp

Here’s another clever trick. Don’t embed the data together with the logic, as I do with my directory aliases. Save it in a separate file and load it in using (read).

Okay, it’s not that clever – I do it all the time in Perl using YAML and what-not. Slightly concerning, though, is that I didn’t automatically translate the knowledge gained from Perl to lisp. What was I thinking?

The code fragment is beautiful:

(defvar variable-name)

(with-temp-buffer
  (insert-file-contents-literally <filename>)
  (setq variable-name (read (current-buffer))))

Read Full Post »

Follow

Get every new post delivered to your Inbox.