emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9a1d548: C++ Mode: handle compound identifiers preceding brace li


From: Alan Mackenzie
Subject: master 9a1d548: C++ Mode: handle compound identifiers preceding brace lists correctly
Date: Sun, 29 Aug 2021 10:05:58 -0400 (EDT)

branch: master
commit 9a1d54814e7970638d8fed56c84389b6c49a55cb
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    C++ Mode: handle compound identifiers preceding brace lists correctly
    
    * lisp/progmodes/cc-engine.el (c-looking-at-or-maybe-in-bracelist): early in
    function, check alternatively for c-back-over-compound-identifier when doing
    c-backward-token-2.
    
    * bracelist-36.{cc,res}: New test files.
---
 lisp/progmodes/cc-engine.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 5d2e41a..c305cae 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -12288,12 +12288,15 @@ comment at the start of cc-engine.el for more info."
          pos2 in-paren parens-before-brace
          paren-state paren-pos)
 
-      (setq res (c-backward-token-2 1 t lim))
+      (setq res
+           (or (progn (c-backward-syntactic-ws)
+                      (c-back-over-compound-identifier))
+               (c-backward-token-2 1 t lim)))
       ;; Checks to do only on the first sexp before the brace.
       ;; Have we a C++ initialization, without an "="?
       (if (and (c-major-mode-is 'c++-mode)
               (cond
-               ((and (or (not (eq res 0))
+               ((and (or (not (memq res '(t 0)))
                          (eq (char-after) ?,))
                      (setq paren-state (c-parse-state))
                      (setq paren-pos (c-pull-open-brace paren-state))
@@ -12317,7 +12320,7 @@ comment at the start of cc-engine.el for more info."
                (t nil))
               (save-excursion
                 (cond
-                 ((or (not (eq res 0))
+                 ((or (not (memq res '(t 0)))
                       (eq (char-after) ?,))
                   (and (setq paren-state (c-parse-state))
                        (setq paren-pos (c-pull-open-brace paren-state))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]