The line-up functions here calculate the indentation for lines which start with an operator, by lining it up with something on the previous line.
Line up a continued argument. E.g:
foo (xyz, aaa + bbb + ccc + ddd + eee + fff); <- c-lineup-argcont
Only continuation lines like this are touched, nil
is returned on
lines which are the start of an argument.
Within a gcc asm
block, :
is recognized as an argument
separator, but of course only between operand specifications, not in the
expressions for the operands.
Works with: arglist-cont
, arglist-cont-nonempty
.
Indent a continued argument c-basic-offset
spaces from the
start of the first argument at the current level of nesting on a
previous line.
foo (xyz, uvw, aaa + bbb + ccc + ddd + eee + fff); <- c-lineup-argcont-+ <--> c-basic-offset
Only continuation lines like this are touched, nil
being
returned on lines which are the start of an argument.
Within a gcc asm
block, :
is recognized as an argument
separator, but of course only between operand specifications, not in the
expressions for the operands.
Works with: arglist-cont
, arglist-cont-nonempty
.
Line up lines starting with an infix operator under the open paren.
Return nil
on lines that don’t start with an operator, to leave
those cases to other line-up functions. Example:
if ( x < 10
|| at_limit (x, <- c-lineup-arglist-operators
list) <- c-lineup-arglist-operators returns nil
)
Since this function doesn’t do anything for lines without an infix
operator you typically want to use it together with some other lineup
settings, e.g. as follows (the arglist-close
setting is just a
suggestion to get a consistent style):
(c-set-offset 'arglist-cont '(c-lineup-arglist-operators 0)) (c-set-offset 'arglist-cont-nonempty '(c-lineup-arglist-operators c-lineup-arglist)) (c-set-offset 'arglist-close '(c-lineup-arglist-close-under-paren))
Works with: arglist-cont
, arglist-cont-nonempty
.
Line up the current line after the assignment operator on the first line in the statement. If there isn’t any, return nil to allow stacking with other line-up functions. If the current line contains an assignment operator too, try to align it with the first one.
Works with: topmost-intro-cont
, statement-cont
,
arglist-cont
, arglist-cont-nonempty
.
Like c-lineup-assignments
but indent with c-basic-offset
if no assignment operator was found on the first line. I.e. this
function is the same as specifying a list (c-lineup-assignments
+)
. It’s provided for compatibility with old configurations.
Works with: topmost-intro-cont
, statement-cont
,
arglist-cont
, arglist-cont-nonempty
.
Line up true and false branches of a ternary operator
(i.e. ?:
). More precisely, if the line starts with a colon
which is a part of a said operator, align it with the corresponding
question mark. For example:
return arg % 2 == 0 ? arg / 2 : (3 * arg + 1); <- c-lineup-ternary-bodies
Works with: arglist-cont
, arglist-cont-nonempty
and
statement-cont
.
Line up “cascaded calls” under each other. If the line begins with
->
or .
and the preceding line ends with one or more
function calls preceded by the same token, then the arrow is lined up
with the first of those tokens. E.g:
r = proc->add(17)->add(18)
->add(19) + <- c-lineup-cascaded-calls
offset; <- c-lineup-cascaded-calls (inactive)
In any other situation nil
is returned to allow use in list
expressions.
Works with: topmost-intro-cont
, statement-cont
,
arglist-cont
, arglist-cont-nonempty
.
Line up C++ stream operators (i.e. ‘<<’ and ‘>>’).
Works with: stream-op
.
Line up a continued string under the one it continues. A continued string in this sense is where a string literal follows directly after another one. E.g:
result = prefix + "A message " "string."; <- c-lineup-string-cont
nil
is returned in other situations, to allow stacking with other
lineup functions.
Works with: topmost-intro-cont
, statement-cont
,
arglist-cont
, arglist-cont-nonempty
.