comment out more than 1 line at once?
roy at panix.com
Tue Nov 30 14:45:45 CET 2004
Riko Wichmann <riko.wichmann at remove-this.desy.de> wrote:
> I'm using emacs (with python-mode) to do most of my editing. also tried
> IDLE from python already, which is nice but an old dog doesn't like to
> learn new tricks :)
Emacs is great for stuff like this. There's probably other ways to do
it, but what I would do is a quick keyboard macro. Go to the beginning
of the first line and type:
C-X ( # C-A C-N C-X )
That defines a macro which inserts a # then moves to the beginning of
the next line. Then you need to execute that once for each additional
line you want to comment out. If there's 17 additional lines, you would
C-U 1 7 C-X E
Hmmm. I just did help-appropos on "comment" and of course I found the
better way I suspected must exist :-) You can just use M-X
comment-region or M-X py-comment-region.
Still, learning how to do keyboard macros will really improve your
productivity in emacs. There's often a better way to do something, but
for simple repetitive tasks, you can often write and execute a keyboard
macro faster than you can look up the better way.
More information about the Python-list