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
frustration.
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
happy with.
The gif above speaks for itself, so I’ll just give you the code and let you play
with it.
A comment-or-uncomment-sexp command
17 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 frustration.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 happy with.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.
Tags: clojure, lisp, programming, init.el, emacs,
Making Ispell work with org-mode »
« Markdown style link IDs in org-mode
Related Posts
Turbo up your Ruby console in Emacs in programming
A few paredit keys that take over the world in programming
Restarting the compilation buffer in comint-mode in programming
Content © 2019, All rights reserved. Icons under CC3.0.