![]() |
James Thornton |
| Internet Business Consultant |
| Home | Blog | Bio | Projects | Contact | Latest Blog (new site): How to Get to Genius |
|---|
U.5.1 Comment CommandsThe comment commands in this table insert, kill and align comments. They are described in this section and following sections.
The command to create or align a comment is M-;
(
If there is no comment already on the line, M-; inserts a new
comment, aligned at a specific column called the comment column.
The new comment begins with the string Emacs thinks comments should
start with (the value of If the text of the line extends past the comment column, then the comment start string is indented to a suitable boundary (usually, at least one space is inserted). You can also use M-; to align an existing comment. If a line already contains the comment-start string, M-; reindents it to the conventional alignment and moves point after it. (Exception: comments starting in column 0 are not moved.) Even when an existing comment is properly aligned, M-; is still useful for moving directly to the start of the text inside the comment. C-u M-; kills any comment on the current line, along with the whitespace before it. To reinsert the comment on another line, move to the end of that line, do C-y, and then do M-; to realign it.
Note that C-u M-; is not a distinct key; it is M-;
(
M-; does two other jobs when used with an active region in
Transient Mark mode (see section H.2 Transient Mark Mode). Then it either adds or
removes comment delimiters on each line of the region. (If every line
is a comment, it removes comment delimiters from each; otherwise, it
adds comment delimiters to each.) If you are not using Transient Mark
mode, then you should use the commands Some major modes have special rules for indenting certain kinds of comments in certain contexts. For example, in Lisp code, comments which start with two semicolons are indented as if they were lines of code, instead of at the comment column. Comments which start with three semicolons are supposed to start at the left margin. Emacs understands these conventions by indenting a double-semicolon comment using TAB, and by not changing the indentation of a triple-semicolon comment at all.
In C code, a comment preceded on its line by nothing but whitespace is indented like a line of code.
This document was generated on April 2, 2002 using texi2html |
|
James Thornton, jamesthornton.com>Services: Consultant |
Electric Speed: Search Engine Optimization Ranking |