(Emacs+Org-Mode) If You Go Insane Trying To Deal With Lisp Code Squashed Into One Line Then Read On To See The Fix

There are two situations where I end up with really important Lisp code that is squashed up into one un-readable and consequently painful line:

• Reading Backtrace when toggle-debug-on-error is true
• Using Lisp in a YAS template like this for example

The thing is that those lines are really important to me. I need to get them readable.

My solution had always been to manually re-indent them. Uggh. But after doing this way too many times, I ran into an issue tonight that demanded my full attention. Fortunately there is a really simple solution.

abo-abo’s lispy package provides functions to make a s-exp either a single or multi-line expression: he answered this very question here.

Amazing. This is a brilliant, thousand dollar function that every Lisp programmer needs to know about!!!

Here is how I set it up:

(use-package lispy
:ensure t)
(local-set-key (kbd "s-8") #'lispy-multiline)
(local-set-key (kbd "s-*") #'lispy-oneline)