[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
cc-mode indentation puzzle
From: |
blue |
Subject: |
cc-mode indentation puzzle |
Date: |
Mon, 31 Jan 2011 14:33:38 -0700 |
User-agent: |
SquirrelMail/1.4.21 |
Hi,
I have been using cc-mode for years to help me adhere
to our corporate C coding style guidelines. However,
there is one corner case that I still haven't got working.
Our standard dictates that if a statement is continued to
another line, the continuation lines (or lines) must each be
indented four spaces from the column where the original
statement started. I have c-basic-offset = 8, and
statement-cont = '*' (which computes to 4). Most of the time
this works fine. But, if the continuation includes a
function call, I get an additional indentation of four
spaces for the next line. The relevant offsets are
arglist-intro, arglist-cont, and arglist-cont-nonempty,
which are all '*' as well. (Setting these all to 0 doesn't
produce the correct result either).
Example:
Indentation I want:
a = b + c +
d + e + f(1,
2, 3);
Indentation I get:
a = b + c +
d + e + f(1,
2, 3);
Here is the c-offsets-alist I use:
(c-add-style "personal"
'((c-basic-offset . 8)
(c-tab-always-indent . nil)
(c-comment-only-line-offset . (0 . 0))
(c-offsets-alist . ((statement-block-intro . +)
(inextern-lang . 0)
(knr-argdecl-intro . +)
(substatement-open . +)
(label . 0)
(statement-case-open . +)
(statement-cont . *)
(statement . 0)
(arglist-intro . *)
(arglist-cont . *)
(arglist-cont-nonempty . *)
(arglist-close . *)))))
I'm trying to find a "legitimate" way to do this, i.e.,
not hacking to cc-*.el files.
Any help is much appreciated -- thanks,
John
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- cc-mode indentation puzzle,
blue <=