Page 1 of 1

Uncomment Line/Region

Posted: Mon Feb 22, 2010 11:26 am
by hewih
how do you do that?
i don't really know what the manual means by "negative argument". if i do C-u -4 M-x comment-region, i get an error. and besides that... it's a long-cut.

Re: Uncomment Line/Region

Posted: Mon Feb 22, 2010 11:53 am
by ramarren
I use ParEdit, which makes manipulating s-expressions much easier, but for this particular case has paredit-comment-dwim bound to M-;, which usually does what I mean. Without paredit it is bound to comment-dwim, which does something similar, if less specialized for editing Lisp.

There is also just uncomment-region. Why would you want to call comment-region with negative argument anyway? Unless this was changed in Emacs 23, which I use, negative argument there would subtract "comment characters", which is rather rarely necessary. Doing just C-u M-x comment-region is equivalent to M-x uncomment-region.

Anyway, I recommend using M-; combined with (possibly temporary) transient mark to comment/uncomment regions.

Re: Uncomment Line/Region

Posted: Mon Feb 22, 2010 11:57 am
by hewih
sorry, had to be more specific. i use Lisp Works and there is no uncomment region comment even though it's very closely related to Emacs.

Re: Uncomment Line/Region

Posted: Mon Feb 22, 2010 12:11 pm
by ramarren
That sort of thing was a reason why I gave up on LispWorks environment and just used Emacs/Slime with it. Well, one of the reasons, the primary being of course that I focus on SBCL anyway and am used to Emacs/Slime.

Anyway, using a negative, but unspecified, argument in Emacs at least would be M-- M-x comment-region. Hope this helps.