(or emacs irrelevant)

Transform a LISP case into a cond with lispy

Just a little extension to the old xc (lispy-to-cond) command that I've added today to lispy:

lispy-case-to-cond.png

Previously, xc could only transform a series of nested if into a cond. You can even chain xcxi to transform a case statement into equivalent if statements.

Note also that unwanted whitespace is properly removed. What you see in the picture is actually an ERT test that's being run each time I commit new stuff. It makes sure that starting in the first buffer state and pressing xc really results in the second buffer state. With this test, it's reasonable to believe that xc will actually work the same way in an interactive scenario. Right now, there are 599 of these type of tests in lispy-test.el. To view them like in the screenshot, you can press xv.

Final note, I realize that it should be eql instead of eq, but I like eq more: it's 33% more efficient.