Next: , Previous: Brace/Paren Line-Up, Up: Line-Up Functions

11.3.2 List Line-Up Functions

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.

— Function: c-lineup-arglist

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.:

                  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.

— Function: c-lineup-arglist-intro-after-paren

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.

— Function: c-lineup-multi-inher

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


          class Foo
              : public Cyphr,
                public Bar      <- c-lineup-multi-inher


          Foo::Foo (int a, int b)
              : Cyphr (a)
              , Bar (b)         <- c-lineup-multi-inher

Works with: inher-cont, member-init-cont.

— Function: c-lineup-java-inher

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
                  Bar           <- c-lineup-java-inher
              <--> c-basic-offset


          class Foo
              extends Cyphr,
                      Bar       <- c-lineup-java-inher

Works with: inher-cont.

— Function: c-lineup-java-throws

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


          int foo() throws Cyphr,
                           Bar,    <- c-lineup-java-throws
                           Vlod    <- c-lineup-java-throws

Works with: func-decl-cont.

— Function: c-lineup-template-args

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.

— Function: c-lineup-ObjC-method-call

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.

— Function: c-lineup-ObjC-method-args

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.

— Function: c-lineup-ObjC-method-args-2

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.