From: Alan Mackenzie Date: Thu, 26 Jul 2018 19:55:47 +0000 (+0000) Subject: Correctly indent C++ brace lists in member init lists. X-Git-Tag: emacs-27.0.90~4664^2~22 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=99a93dae241b3f779bdf9484a54f1096785c6f84;p=emacs.git 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. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 3961ea647cf..d1eb3c3d06f 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -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)))