I am using Emacs, Slime, Paredit, and other packages to work on Common Lisp (SBCL). It is really useful to comment out multiple expressions while debugging.
For instance, suppose I have these placeholder expressions:
( ( )
(
(( )
( ( )
))))
I can use the keybinding C-M-SPC
which run's the command mark-sexp
on the second line. This character -!-
will be used to represent the cursor position.
( ( )
-!-(
(( )
( ( )
))))
After invoking selecting the region, I can use the command comment-dwin
to comment the appropriate expressions. Then, Emacs automatically does (using ParEdit):
( ( )
-!-;; (
;; (( )
;; ( ( )
;; )))
)
This is great. I just need to learn how to revert this after some editions inside the content of the expressions. Since there were other modifications, I cannot use undo
. So, how can I remove the ;;
comments in a smart way?
A friend mentioned something like rectangle-select
but I could not find it.
comment-region
is (IMO) more flexible/useful thancomment-dwim
for both commenting and uncommenting multiple lines. It deals with nesting blocks of comments as one expects. – Drew Jul 20 '21 at 21:08