aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorAlan Mackenzie2018-07-26 19:55:47 +0000
committerAlan Mackenzie2018-07-26 19:55:47 +0000
commit99a93dae241b3f779bdf9484a54f1096785c6f84 (patch)
tree5cde9e9b8e903e26d9c837176ad8afa203a4b70b /lisp
parenta8f2d97b12bf2c5cc8ef1a1e7e4eb2ed05cf3af8 (diff)
downloademacs-99a93dae241b3f779bdf9484a54f1096785c6f84.tar.gz
emacs-99a93dae241b3f779bdf9484a54f1096785c6f84.zip
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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/cc-engine.el12
1 files changed, 10 insertions, 2 deletions
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."
12607 (= (point) containing-sexp))) 12607 (= (point) containing-sexp)))
12608 (if (eq (point) (c-point 'boi)) 12608 (if (eq (point) (c-point 'boi))
12609 (c-add-syntax 'brace-list-close (point)) 12609 (c-add-syntax 'brace-list-close (point))
12610 (setq lim (c-most-enclosing-brace state-cache (point))) 12610 (setq lim (or (save-excursion
12611 (and
12612 (c-back-over-member-initializers)
12613 (point)))
12614 (c-most-enclosing-brace state-cache (point))))
12611 (c-beginning-of-statement-1 lim nil nil t) 12615 (c-beginning-of-statement-1 lim nil nil t)
12612 (c-add-stmt-syntax 'brace-list-close nil t lim paren-state))) 12616 (c-add-stmt-syntax 'brace-list-close nil t lim paren-state)))
12613 12617
@@ -12636,7 +12640,11 @@ comment at the start of cc-engine.el for more info."
12636 (goto-char containing-sexp)) 12640 (goto-char containing-sexp))
12637 (if (eq (point) (c-point 'boi)) 12641 (if (eq (point) (c-point 'boi))
12638 (c-add-syntax 'brace-list-intro (point)) 12642 (c-add-syntax 'brace-list-intro (point))
12639 (setq lim (c-most-enclosing-brace state-cache (point))) 12643 (setq lim (or (save-excursion
12644 (and
12645 (c-back-over-member-initializers)
12646 (point)))
12647 (c-most-enclosing-brace state-cache (point))))
12640 (c-beginning-of-statement-1 lim) 12648 (c-beginning-of-statement-1 lim)
12641 (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state))) 12649 (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state)))
12642 12650