From: Alan Mackenzie Date: Mon, 2 Oct 2017 14:42:13 +0000 (+0000) Subject: Fix a CC Mode brace stack cache bug. X-Git-Tag: emacs-26.0.90~66 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=712cc158772697058c1436a6e5bacc00d262f49c;p=emacs.git 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. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 05b391a3d38..9d65383e258 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)))))