Correctly indent C++ brace lists in member init lists.

* lisp/progmodes/cc-engine.el (c-guess-basic-syntax; CASE 9B, CASE 9C): Set a
limit for a backward search to the ":" introducing the member init list, when
there is one, rather than the enclosing "{" or nil.
This commit is contained in:
Alan Mackenzie 2018-07-26 19:55:47 +00:00
parent a8f2d97b12
commit 99a93dae24

View file

@ -12607,7 +12607,11 @@ comment at the start of cc-engine.el for more info."
(= (point) containing-sexp)))
(if (eq (point) (c-point 'boi))
(c-add-syntax 'brace-list-close (point))
(setq lim (c-most-enclosing-brace state-cache (point)))
(setq lim (or (save-excursion
(and
(c-back-over-member-initializers)
(point)))
(c-most-enclosing-brace state-cache (point))))
(c-beginning-of-statement-1 lim nil nil t)
(c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
@ -12636,7 +12640,11 @@ comment at the start of cc-engine.el for more info."
(goto-char containing-sexp))
(if (eq (point) (c-point 'boi))
(c-add-syntax 'brace-list-intro (point))
(setq lim (c-most-enclosing-brace state-cache (point)))
(setq lim (or (save-excursion
(and
(c-back-over-member-initializers)
(point)))
(c-most-enclosing-brace state-cache (point))))
(c-beginning-of-statement-1 lim)
(c-add-stmt-syntax 'brace-list-intro nil t lim paren-state)))