3

I'm fine-tuning my C++ style using c-add-style, but I've reached an impasse where I cannot convince Emacs to (extra) indent arguments where the first argument starts on a new line.

When I'm forced to start argument lists on a new line I prefer to indent the arguments an extra level to distinguish them from the function body:

void particularlyLongFunctionName(
        particularlyLongTypeName &particularlyLongArgumentName) {
    foo(particularlyLongArgumentName);
    bar();
}

My configuration, on the other hand, indents the argument list no more than the following code block:

void particularlyLongFunctionName(
    particularlyLongTypeName &particularlyLongArgumentName) {
    foo(particularlyLongArgumentName);
    bar();
}

Which field in the c-style-alist controls this setting?

Caterpillar
  • 274
  • 1
  • 8

1 Answers1

6

Set point on the line in question and press C-c C-s to call c-show-syntactic-information. This shows you which variable you need to set.

I set this to:

(c-offsets-alist . (
    (arglist-intro . c-lineup-arglist-intro-after-paren))) ;; first parameter after open paren

which is not quite that what you want, but instead of c-lineup-arglist-intro-after-paren you could use ++.

Test another offset with C-c C-o (which calls c-set-offset).

Also have a look at the cc-mode manual and more concrete at the c-offset-alist docu node. Or at the Wiki.

jue
  • 4,476
  • 8
  • 20