[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: one key-press to comment out lines of code?

From: Emanuel Berg
Subject: Re: one key-press to comment out lines of code?
Date: Wed, 30 Apr 2014 21:03:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Drew Adams <address@hidden> writes:

> Others will no doubt tell you to use `M-;'
> (`comment-dwim') after selecting the text.

Easy to remember! - as the Lisp comment char (the
initiator for one-line comments).

> I prefer to use `comment-region', which I bind to
> `C-x ;'.

Why not use M-; for that as well? C-SPC, move point,
M-; last.

> To uncomment, provide a plain prefix arg (`C-u'):
> `C-u C-x ;'.  To comment using N comment chars, use a
> numeric prefix arg: `C-3 C-x ;'.  (And you can use
> that to nest commented text.)

Yeah, but again, I think it is much simpler to C-SPC,
move point, and M-; (if the region is commented) to

So for all three cases: M-;.

Note that in all programming modes it is still M-; - so
it is not M-// in C++, M-% in LaTeX, etc., or anything
like that.

Even if there is no commenting style defined, hit M-;
and Emacs will ask you what char to use. (Though if
that happens a lot, you should probably configure it
for a file extension, a hash bang or something like

underground experts united:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]