diff options
| author | Alan Mackenzie | 2024-12-31 18:39:57 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2024-12-31 18:39:57 +0000 |
| commit | 643e32340d1342cee8af3f1f604ea1c1ad12837a (patch) | |
| tree | e5597d78930ed7a734892da7d33b2ee621d4b8d5 /doc | |
| parent | 2f1052d9b0de551dc3a463ed54e21c63517497ab (diff) | |
| download | emacs-643e32340d1342cee8af3f1f604ea1c1ad12837a.tar.gz emacs-643e32340d1342cee8af3f1f604ea1c1ad12837a.zip | |
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.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/cc-mode.texi | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index 5f46c1577da..d2358268a9e 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi | |||
| @@ -6192,6 +6192,33 @@ to perform indentation. | |||
| 6192 | 6192 | ||
| 6193 | @comment ------------------------------------------------------------ | 6193 | @comment ------------------------------------------------------------ |
| 6194 | 6194 | ||
| 6195 | @defun c-lineup-item-after-paren-at-boi | ||
| 6196 | @findex lineup-item-after-paren-at-boi (c-) | ||
| 6197 | Line up under the first entry on the same line as an open parenthesis | ||
| 6198 | when that parenthesis is the lefmost non-space character in its line. | ||
| 6199 | For example: | ||
| 6200 | |||
| 6201 | @example | ||
| 6202 | @group | ||
| 6203 | template <typename T> | ||
| 6204 | requires | ||
| 6205 | ( requires (T t) @{ ++t; @} | ||
| 6206 | && Baz<T>) @hereFn{constraint-cont} | ||
| 6207 | int foo(); | ||
| 6208 | @end group | ||
| 6209 | @end example | ||
| 6210 | |||
| 6211 | |||
| 6212 | This function is intended for use in a list. If the construct being | ||
| 6213 | analyzed doesn't conform to the above description, the function | ||
| 6214 | returns nil. Otherwise it returns a vector containing the indentation. | ||
| 6215 | |||
| 6216 | @workswith{} @code{brace-list-intro}, @code{enum-intro}, | ||
| 6217 | @code{constraint-cont}. | ||
| 6218 | @end defun | ||
| 6219 | |||
| 6220 | @comment ------------------------------------------------------------ | ||
| 6221 | |||
| 6195 | @defun c-lineup-class-decl-init-+ | 6222 | @defun c-lineup-class-decl-init-+ |
| 6196 | @findex lineup-class-decl-init-+ (c-) | 6223 | @findex lineup-class-decl-init-+ (c-) |
| 6197 | Line up the second entry of a class (etc.) initializer | 6224 | Line up the second entry of a class (etc.) initializer |