The lineup functions here calculate the indentation for several types of comment structure.
Line up C block comment continuation lines. Various heuristics are used to handle most of the common comment styles. Some examples:
/* /** /* * text * text text */ */ */
/* text /* /** text ** text ** text */ */ */
/************************************************** * text *************************************************/
/**************************************************
Free form text comments:
In comments with a long delimiter line at the
start, the indentation is kept unchanged for lines
that start with an empty comment line prefix. The
delimiter line is whatever matches the
comment-start-skip
regexp.
**************************************************/
The style variable c-comment-prefix-regexp
is used to recognize
the comment line prefix, e.g. the ‘*’ that usually starts every
line inside a comment.
Works with: The c
syntactic symbol.
Line up a comment-only line according to the style variable
c-comment-only-line-offset
. If the comment is lined up with a
comment starter on the previous line, that alignment is preserved.
This style variable specifies the extra offset for the line. It can contain an integer or a cons cell of the form
(non-anchored-offset . anchored-offset)
where non-anchored-offset is the amount of offset given to
non-column-zero anchored lines, and anchored-offset is the amount
of offset to give column-zero anchored lines. Just an integer as value
is equivalent to (value . -1000)
.
Works with: comment-intro
.
Line up a comment in the “K&R region” with the declaration. That is the region between the function or class header and the beginning of the block. E.g:
int main() /* Called at startup. */ <- c-lineup-knr-region-comment { return 0; }
Return nil
if called in any other situation, to be useful in list
expressions.
Works with: comment-intro
.