Next: Operator Line-Up Functions, Previous: Brace and Parenthesis Line-Up Functions, Up: Line-Up Functions [Contents][Index]
The line-up functions here calculate the indentation for lines which form lists of items, usually separated by commas.
The function c-lineup-arglist-close-under-paren, which is mainly for indenting a close parenthesis, is also useful for the lines contained within parentheses.
Line up the current argument line under the first argument.
As a special case, if an argument on the same line as the open
parenthesis starts with a brace block opener, the indentation is
c-basic-offset
only. This is intended as a “DWIM” measure in
cases like macros that contain statement blocks, e.g.:
A_VERY_LONG_MACRO_NAME ({ some (code, with + long, lines * in[it]); }); <--> c-basic-offset
This is motivated partly because it’s more in line with how code blocks are handled, and partly since it approximates the behavior of earlier CC Mode versions, which due to inaccurate analysis tended to indent such cases this way.
Works with: arglist-cont-nonempty
, arglist-close
.
Line up a line to just after the open paren of the surrounding paren or brace block.
Works with: defun-block-intro
, brace-list-intro
,
statement-block-intro
, statement-case-intro
,
arglist-intro
.
Line up the second entry of a brace block under the first, when the first line is also contained in an arglist or an enclosing brace on that line.
I.e. handle something like the following:
set_line (line_t {point_t{0.4, 0.2}, point_t{0.2, 0.5}, <- brace-list-intro .....}); ^ enclosing parenthesis.
The middle line of that example will have a syntactic context with
three syntactic symbols, arglist-cont-nonempty
,
brace-list-intro
, and brace-list-entry
(see Brace List Symbols).
This function is intended for use in a list. If the construct being
analyzed isn’t like the preceding, the function returns nil
.
Otherwise it returns the function
c-lineup-arglist-intro-after-paren
, which the caller then uses
to perform indentation.
Works with: brace-list-intro
.
Line up the second entry of a class (etc.) initializer
c-basic-offset
characters in from the identifier when:
I.e. we have a construct like this:
struct STR { int i; float f; } str_1 = {1, 1.7}, str_2 = {2, 3.1 <- brace-list-intro }; <--> c-basic-offset
Note that the syntactic context of the brace-list-intro
line
also has a syntactic element with the symbol brace-list-entry
(see Brace List Symbols).
This function is intended for use in a list. If the above structure
isn’t present, the function returns nil
, allowing a different
offset specification to indent the line.
Works with: brace-list-intro
.
Line up the second entry of a class (etc.) initializer after its opening brace when:
I.e. we have a construct like this:
struct STR { int i; float f; } str_1 = {1, 1.7}, str_2 = {2, 3.1 <- brace-list-intro };
Note that the syntactic context of the brace-list-intro
line
also has a syntactic element with the symbol brace-list-entry
(see Brace List Symbols). Also note that this function works by
returning the symbol c-lineup-arglist-intro-after-paren
, which
the caller then uses to perform the indentation.
This function is intended for use in a list. If the above structure
isn’t present, the function returns nil
, allowing a different
offset specification to indent the line.
Works with: brace-list-intro
.
Line up the classes in C++ multiple inheritance clauses and member initializers under each other. E.g.:
Foo::Foo (int a, int b): Cyphr (a), Bar (b) <- c-lineup-multi-inher
and
class Foo : public Cyphr, public Bar <- c-lineup-multi-inher
and
Foo::Foo (int a, int b) : Cyphr (a) , Bar (b) <- c-lineup-multi-inher
Works with: inher-cont
, member-init-cont
.
Line up Java implements and extends declarations. If class names
follow on the same line as the ‘implements’/‘extends’
keyword, they are lined up under each other. Otherwise, they are
indented by adding c-basic-offset
to the column of the keyword.
E.g.:
class Foo extends Bar <- c-lineup-java-inher <--> c-basic-offset
and
class Foo extends Cyphr, Bar <- c-lineup-java-inher
Works with: inher-cont
.
Line up Java throws declarations. If exception names follow on the
same line as the throws keyword, they are lined up under each other.
Otherwise, they are indented by adding c-basic-offset
to the
column of the ‘throws’ keyword. The ‘throws’ keyword itself
is also indented by c-basic-offset
from the function declaration
start if it doesn’t hang. E.g.:
int foo() throws <- c-lineup-java-throws Bar <- c-lineup-java-throws <--><--> c-basic-offset
and
int foo() throws Cyphr, Bar, <- c-lineup-java-throws Vlod <- c-lineup-java-throws
Works with: func-decl-cont
.
Line up the arguments of a template argument list under each other, but only in the case where the first argument is on the same line as the opening ‘<’.
To allow this function to be used in a list expression, nil
is
returned if there’s no template argument on the first line.
Works with: template-args-cont
.
For Objective-C code, line up selector args as Emacs Lisp mode does with function args: go to the position right after the message receiver, and if you are at the end of the line, indent the current line c-basic-offset columns from the opening bracket; otherwise you are looking at the first character of the first method call argument, so lineup the current line with it.
Works with: objc-method-call-cont
.
For Objective-C code, line up the colons that separate args. The colon on the current line is aligned with the one on the first line.
Works with: objc-method-args-cont
.
Similar to c-lineup-ObjC-method-args
but lines up the colon on
the current line with the colon on the previous line.
Works with: objc-method-args-cont
.
Next: Operator Line-Up Functions, Previous: Brace and Parenthesis Line-Up Functions, Up: Line-Up Functions [Contents][Index]