Uncomment Line/Region

Discussion of programming Lisps using Emacs, including SLIME and other tools
Post Reply
hewih
Posts: 30
Joined: Tue Jan 19, 2010 9:36 am

Uncomment Line/Region

Post by hewih » Mon Feb 22, 2010 11:26 am

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.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Uncomment Line/Region

Post by ramarren » Mon Feb 22, 2010 11:53 am

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.

hewih
Posts: 30
Joined: Tue Jan 19, 2010 9:36 am

Re: Uncomment Line/Region

Post by hewih » Mon Feb 22, 2010 11:57 am

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.

ramarren
Posts: 613
Joined: Sun Jun 29, 2008 4:02 am
Location: Warsaw, Poland
Contact:

Re: Uncomment Line/Region

Post by ramarren » Mon Feb 22, 2010 12:11 pm

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.

Post Reply