emacs-diffs
[Top][All Lists]
Advanced

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

master 1d43c18: CC Mode: Fix calculation of c-parse-state when there're


From: Alan Mackenzie
Subject: master 1d43c18: CC Mode: Fix calculation of c-parse-state when there're macros with braces
Date: Sat, 6 Mar 2021 10:24:14 -0500 (EST)

branch: master
commit 1d43c1854a5cd8305200f6cff8ff8e80cb2b4b8a
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    CC Mode: Fix calculation of c-parse-state when there're macros with braces
    
    This fixes bug #46951.
    
    * lisp/progmodes/cc-engine.el (c-append-lower-brace-pair-to-state-cache):
    Ensure the starting point for backward scanning is not within a macro which
    doesn't contain HERE.
---
 lisp/progmodes/cc-engine.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 5a8b2f4..b7ad02c 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3793,12 +3793,14 @@ mhtml-mode."
                     (point)))
             (bra                       ; Position of "{".
              ;; Don't start scanning in the middle of a CPP construct unless
-             ;; it contains HERE - these constructs, in Emacs, are "commented
-             ;; out" with category properties.
-             (if (eq (c-get-char-property macro-start-or-from 'category)
-                       'c-cpp-delimiter)
-                   macro-start-or-from
-                 from))
+             ;; it contains HERE.
+             (if (and (not (eq macro-start-or-from from))
+                      (< macro-start-or-from here) ; Might not be needed.
+                      (progn (goto-char macro-start-or-from)
+                             (c-end-of-macro)
+                             (>= (point) here)))
+                 from
+               macro-start-or-from))
             ce)                        ; Position of "}"
        (or upper-lim (setq upper-lim from))
 



reply via email to

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