Xah Lee has added another page to his excellent series on Emacs Lisp. This time it’s about printing in Emacs Lisp. Most of us who have written any elisp are familiar with the message
function, which prints a message to the “*Messages*” buffer and echoes it to the minibuffer.
Often times, we want to write messages to some other buffer—the two posts on Xah’s Challenge are examples. The basic mechanism for doing that is to use with-output-to-temp-buffer
in conjunction with the print
, prin1
, or princ
functions. Head over to Lee’s post for all the details if you don’t already know them. It’s a nice summary of the various printing commands.
There are several excellent blogs that cover using Emacs (emacs-fu, Got Emacs?, Mastering Emacs, Xah’s Emacs Tutorial, and many others) but Lee’s Emacs Lisp Tutorial is the only one I know that regularly covers Emacs Lisp and how to use it to solve editing problems. Emacs Lisp is pretty much like other Lisps so anyone using Common Lisp or Scheme will be comfortable with most of it but the problem is that Emacs Lisp has tons of functions that are specific to the Emacs editing environment and none of those will be familiar to someone coming from another Lisp. That’s where Lee’s Emacs Lisp Tutorial is essential. He gives you real working examples and you see those commands in action.