emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-26 712cc15: Fix a CC Mode brace stack cache bug.


From: Alan Mackenzie
Subject: [Emacs-diffs] emacs-26 712cc15: Fix a CC Mode brace stack cache bug.
Date: Mon, 2 Oct 2017 10:53:23 -0400 (EDT)

branch: emacs-26
commit 712cc158772697058c1436a6e5bacc00d262f49c
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Fix a CC Mode brace stack cache bug.
    
    * lisp/progmodes/cc-engine.el (c-update-brace-stack): Call
    c-beginning-of-current-token after a failing search operation, to ensure we
    don't cache a point inside a token.
---
 lisp/progmodes/cc-engine.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 05b391a..9d65383 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -5410,8 +5410,7 @@ comment at the start of cc-engine.el for more info."
   ;; value.
   (let (match kwd-sym (prev-match-pos 1)
              (s (cdr stack))
-             (bound-<> (car stack))
-             )
+             (bound-<> (car stack)))
     (save-excursion
       (cond
        ((and bound-<> (<= to bound-<>))
@@ -5472,6 +5471,9 @@ comment at the start of cc-engine.el for more info."
            (setq s (cdr s))))
         ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds)
          (push 0 s))))
+      ;; The failing `c-syntactic-re-search-forward' may have left us in the
+      ;; middle of a token, which might be a significant token.  Fix this!
+      (c-beginning-of-current-token)
       (cons (point)
            (cons bound-<> s)))))
 



reply via email to

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