Discussion:
Filling (first) column with a 'comment' character
(too old to reply)
Alex van der Spek
2013-10-29 11:04:46 UTC
Permalink
Emacs has proved a very valuable tool in a very short time! Using it for
python code, Fortran code, gnuplot scripts and plain text.

One thing I was unable to find:

How can I add a single character in the first column of a region? This to
'comment out' a number of lines in source code/scripts.

All help welcome!
Alex van der Spek
Chris F.A. Johnson
2013-10-29 11:22:36 UTC
Permalink
Post by Alex van der Spek
Emacs has proved a very valuable tool in a very short time! Using it for
python code, Fortran code, gnuplot scripts and plain text.
How can I add a single character in the first column of a region? This to
'comment out' a number of lines in source code/scripts.
(comment-region)
--
Chris F.A. Johnson <http://cfajohnson.com/>
Michael Heerdegen
2013-10-29 12:21:26 UTC
Permalink
Post by Chris F.A. Johnson
Post by Alex van der Spek
Emacs has proved a very valuable tool in a very short time! Using it for
python code, Fortran code, gnuplot scripts and plain text.
How can I add a single character in the first column of a region? This to
'comment out' a number of lines in source code/scripts.
(comment-region)
Or just M-; (`comment-dwim').

For the first, more general question (add something to first column),
you can use e.g. C-x r t (`string-rectangle') or the multiple-cursors
package.


Regards,

Michael.
Barry Margolin
2013-10-29 14:31:43 UTC
Permalink
Post by Michael Heerdegen
Post by Chris F.A. Johnson
Post by Alex van der Spek
Emacs has proved a very valuable tool in a very short time! Using it for
python code, Fortran code, gnuplot scripts and plain text.
How can I add a single character in the first column of a region? This to
'comment out' a number of lines in source code/scripts.
(comment-region)
Or just M-; (`comment-dwim').
For the first, more general question (add something to first column),
you can use e.g. C-x r t (`string-rectangle') or the multiple-cursors
package.
Or M-x replace-regexp RET ^ RET # RET
--
Barry Margolin, ***@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
Martin
2013-11-03 18:43:08 UTC
Permalink
Alex van der Spek writes:

...
Post by Alex van der Spek
How can I add a single character in the first column of a region? This to
'comment out' a number of lines in source code/scripts.
...
M-x comment-region RET
a***@gmail.com
2013-11-06 01:12:10 UTC
Permalink
The above advice is good for commenting but a more general way is:
- highlight the region
- M-x string-insert-rectangle
- type the character(s) then `Return`

-deech

Loading...