A comment-or-uncomment-sexp command17 Aug 2015, by Artur Malabarba.
Commenting is a very frequent piece of a programmer’s workflow, and it’s
important to make it seamless and simple. For the more statemental languages,
that’s as easy as writing a custom
comment-line command. However, when
you’re writing in Lisp languages, that just won’t do. Trying to comment out
lines in a sexp-oriented structure, feels a lot like trying to hit a nail with a
heavy screwdriver—it sometimes gets the job done, but it mostly just leads to
That said, a
comment-sexp command is considerably more complicated to write.
Not because commenting sexps is hard, but because it is quite difficult to
identify sexps when removing comments. Still, I’m nothing if not stubborn. So
after much hair pulling and teeth gritting, I have finally found a version I’m
The gif above speaks for itself, so I’ll just give you the code and let you play with it.
And, of course, don’t forget to bind it.