31.5.2 Multiple Lines of Comments
If you are typing a comment and wish to continue it on another line,
you can use the command C-M-j or M-j
(comment-indent-new-line
). If comment-multi-line
(see Options for Comments) is non-nil
, it moves to a new
line within the comment. Otherwise it closes the comment and starts a
new comment on a new line. When Auto Fill mode is on, going past the
fill column while typing a comment causes the comment to be continued
in just this fashion.
To turn existing lines into comment lines, use the M-x
comment-region command (or type C-c C-c in C-like buffers). It
adds comment delimiters to the lines that start in the region, thus
commenting them out. With a negative argument, it does the
opposite—it deletes comment delimiters from the lines in the region.
With a positive argument, comment-region
duplicates the last
character of the comment start sequence it adds; the argument specifies
how many copies of the character to insert. Thus, in Lisp mode,
C-u 2 M-x comment-region adds ‘;;’ to each line. Duplicating
the comment delimiter is a way of calling attention to the comment. It
can also affect how the comment is indented. In Lisp, for proper
indentation, you should use an argument of two or three, if between defuns;
if within a defun, it must be three.
You can configure C Mode such that when you type a ‘/’ at the
start of a line in a multi-line block comment, this closes the
comment. Enable the comment-close-slash
clean-up for this.
See Clean-ups.