Go to the first, previous, next, last section, table of contents.


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 (indent-new-comment-line). This terminates the comment you are typing, creates a new blank line afterward, and begins a new comment indented under the old one. 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. If point is not at the end of the line when C-M-j is typed, the text on the rest of the line becomes part of the new comment line.

To turn existing lines into comment lines, use the M-x comment-region command. 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, if between defuns, and three, if within a defun.

The variable comment-padding specifies how many spaces comment-region should insert on each line between the comment delimiter and the line's original text. The default is 1.


Go to the first, previous, next, last section, table of contents.