Insert a comment at the end of the current line, if none is there already4. Then reindent the comment according to comment-column
(see Options for Comments in GNU Emacs Manual) and the variables below. Finally, position the point after the comment starter. C-u M-; kills any comment on the current line, together with any whitespace before it. This is a standard Emacs command, but CC Mode enhances it a bit with two variables:
This style variable allows you to vary the column that M-; puts the comment at, depending on what sort of code is on the line, and possibly the indentation of any similar comment on the preceding line. It is an association list that maps different types of lines to actions describing how they should be handled. If a certain line type isn’t present on the list then the line is indented to the column specified by comment-column
.
See the documentation string for a full description of this variable (use C-h v c-indent-comment-alist).
Normally, when this style variable is nil
, M-; will indent comment-only lines according to c-indent-comment-alist
, just as it does with lines where other code precede the comments. However, if you want it to act just like TAB for comment-only lines you can get that by setting c-indent-comments-syntactically-p
to non-nil
.
If c-indent-comments-syntactically-p
is non-nil
then c-indent-comment-alist
won’t be consulted at all for comment-only lines.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4