[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: Drew Adams
Subject: RE: one key-press to comment out lines of code?
Date: Wed, 30 Apr 2014 09:22:08 -0700 (PDT)

> Whilst I'm still learning emacs and gnus I'm constantly adding code to my
> "setup-testbed.el" file, and then finding later that it doesn't do what its
> expected to do, or I don't like the outcome, so I then comment it
> out. Currently, I'm doing it laboriously by hand, but is it possible to
> highlight it and then with one key-press insert ";" in front of each and
> every
> line of the code please?
> I haven't seen this ability anywhere, but being able to do it would make
> things a whole lot easier for me, so, can it be done please folks?

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

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

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.)

reply via email to

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