From: Alan Mackenzie Date: Sun, 19 Jun 2016 11:25:07 +0000 (+0000) Subject: c-renarrow-state-cache: take care when new point is inside old brace pair. X-Git-Tag: emacs-26.0.90~1840^2~208 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=65885ccf29ce4723f100a45756005781e8e7ab46;p=emacs.git c-renarrow-state-cache: take care when new point is inside old brace pair. Also add display of point-min to the c-parse-state debugging output. * lisp/progmodes/cc-engine.el (c-renarrow-state-cache): When the new point is inside an old recorded brace pair, clear the cache. (c-debug-parse-state): Output the value of point-min. --- diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 32eca3e2bdd..011d08031d1 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -2752,7 +2752,11 @@ comment at the start of cc-engine.el for more info." (setq ptr (cdr ptr))) (when (consp ptr) - (if (eq (cdr ptr) c-state-cache) + (if (or (eq (cdr ptr) c-state-cache) + (and (consp (cadr ptr)) + (> (cdr (cadr ptr)) (point-min)))) ; Our new point-min is + ; inside a recorded + ; brace pair. (setq c-state-cache nil c-state-cache-good-pos c-state-min-scan-pos) (setcdr ptr nil) @@ -3603,7 +3607,7 @@ comment at the start of cc-engine.el for more info." conses-not-ok)) (defun c-debug-parse-state () - (let ((here (point)) (res1 (c-real-parse-state)) res2) + (let ((here (point)) (min-point (point-min)) (res1 (c-real-parse-state)) res2) (let ((c-state-cache nil) (c-state-cache-good-pos 1) (c-state-nonlit-pos-cache nil) @@ -3630,8 +3634,8 @@ comment at the start of cc-engine.el for more info." ;; "using cache: %s, from scratch: %s") ;; here res1 res2))) (message (concat "c-parse-state inconsistency at %s: " - "using cache: %s, from scratch: %s") - here res1 res2) + "using cache: %s, from scratch: %s. POINT-MIN: %s") + here res1 res2 min-point) (message "Old state:") (c-replay-parse-state-state))