]> git.eshelyaron.com Git - emacs.git/commit
CC Mode: Fix various minor indentation bugs
authorAlan Mackenzie <acm@muc.de>
Tue, 31 Dec 2024 18:39:57 +0000 (18:39 +0000)
committerEshel Yaron <me@eshelyaron.com>
Sat, 4 Jan 2025 20:26:20 +0000 (21:26 +0100)
commitcbf474448090d874411f23aa9d75529bf85a1ced
tree2a9ad36dc9099920e90649c3723e25fefe6b88b0
parent73f9e070b7335ecdbebf98be2341dd87d348fd9f
CC Mode: Fix various minor indentation bugs

As part of this, introduce a second anchor point to the
syntactic symbols brace-list-intro and enum-intro, the position
of the opening brace.

* lisp/progmodes/cc-align.el
(c-lineup-item-after-paren-at-boi): New function.

* /lisp/progmodes/cc-engine.el
(c-foreign-truncate-lit-pos-cache)
(c-foreign-init-lit-pos-cache): Use
c-truncate-lit-pos/state-cache in place of an older function.
(c-no-bracelist-cache): Update its definition to exclude
conses.
(c-strip-conses): New function.
(c-inside-bracelist-p): Use c-strip-conses.
(c-add-stmt-syntax): In the "go out a block" loop, go out of a
brace at BOI when there's non-whitespace text after it.
Refactor an `if' form containing a cond form into a cond form.
Add the new second second anchor point into syntactic contexts
with brace-list-intro and enum-intro.  Anchor brace-list-close
and enum-close elements on the individual declarations in
struct, etc., variable declarations.
(c-guess-basic-syntax, CASE 20): Use the new constraint-cont
syntactic symbol.
(c-guess-basic-syntax, CASE 9B): Anchor brace-list-close and
enum-close elements on the individual declarations in struct,
etc., variable declarations.
(c-guess-basic-syntax, CASEs 9C, 9D): Add the new second anchor
point into brace-list-intro and enum-intro syntactic contexts.

* lisp/progmodes/cc-mode.el (c-locate-first-punctuation-prop):
New function.
(c-depropertize-CPP): Use c-locate-first-punctuation-prop.

* lisp/progmodes/cc-vars.el (c-offsets-alist): Amend the
entries for constraint-cont, brace-list-intro, and enum-intro,
using c-lineup-item-after-paren-at-boi.

* doc/misc/cc-mode.texi (List Line-Up): Add a description of
c-lineup-item-after-paren-at-boi.

(cherry picked from commit 643e32340d1342cee8af3f1f604ea1c1ad12837a)
doc/misc/cc-mode.texi
lisp/progmodes/cc-align.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-mode.el
lisp/progmodes/cc-vars.el