]> git.eshelyaron.com Git - emacs.git/commitdiff
Correctly indent C++ brace lists in member init lists.
authorAlan Mackenzie <acm@muc.de>
Thu, 26 Jul 2018 19:55:47 +0000 (19:55 +0000)
committerAlan Mackenzie <acm@muc.de>
Thu, 26 Jul 2018 19:55:47 +0000 (19:55 +0000)
* 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.

lisp/progmodes/cc-engine.el

index 3961ea647cf5d7ea1e493fd133ff2a8082767d51..d1eb3c3d06f9e620a53bce6343161e8c6676e35c 100644 (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)))