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
: is recognized as an argument
separator, but of course only between operand specifications, not in the
expressions for the operands.
Line up lines starting with an infix operator under the open paren.
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))
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.
c-lineup-assignments but indent with
if no assignment operator was found on the first line. I.e., this
function is the same as specifying a list
+). It’s provided for compatibility with old configurations.
Line up true and false branches of a ternary operator
?:). More precisely, if the line starts with a colon
which is a part of a said operator, align it with corresponding
question mark. For example:
return arg % 2 == 0 ? arg / 2 : (3 * arg + 1); <- c-lineup-ternary-bodies
Line up “cascaded calls” under each other. If the line begins with
. 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
Line up C++ stream operators (i.e., ‘<<’ and ‘>>’).
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