Pretty Printing and Macroexpanding the Last Sexpression

As Emacs users, we’re always discovering some new feature of our favorite editor. Here’s one that’s so obscure not even John Wiegley was aware of it.

Over at the Emacs subreddit, glyfo was showing off a bit of elisp that he wrote to macroexpand the last sexpr. Kaushalmodi noted in the comments that there’s already a command for that, pp-macroexpand-last-sexp. That nice to know because it can often be useful. At bit later John commented that he hadn’t been aware of the command but had often needed it.

If you’re writing Elisp or just trying to read and understand some code that uses a macro, this is a command worth knowing. The name is pretty easy to remember and even if I forget, I can find it again by searching Irreal.

This entry was posted in General and tagged , . Bookmark the permalink.