diff options
| author | Alan Mackenzie | 2016-06-19 11:25:07 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2016-06-19 11:25:07 +0000 |
| commit | 65885ccf29ce4723f100a45756005781e8e7ab46 (patch) | |
| tree | d1d614a2d7f653cb3c7c4a5917cec1da6d7f3f50 | |
| parent | 13feb31c633a26ce47799315326e43d1e8b9345a (diff) | |
| download | emacs-65885ccf29ce4723f100a45756005781e8e7ab46.tar.gz emacs-65885ccf29ce4723f100a45756005781e8e7ab46.zip | |
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.
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 12 |
1 files changed, 8 insertions, 4 deletions
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." | |||
| 2752 | (setq ptr (cdr ptr))) | 2752 | (setq ptr (cdr ptr))) |
| 2753 | 2753 | ||
| 2754 | (when (consp ptr) | 2754 | (when (consp ptr) |
| 2755 | (if (eq (cdr ptr) c-state-cache) | 2755 | (if (or (eq (cdr ptr) c-state-cache) |
| 2756 | (and (consp (cadr ptr)) | ||
| 2757 | (> (cdr (cadr ptr)) (point-min)))) ; Our new point-min is | ||
| 2758 | ; inside a recorded | ||
| 2759 | ; brace pair. | ||
| 2756 | (setq c-state-cache nil | 2760 | (setq c-state-cache nil |
| 2757 | c-state-cache-good-pos c-state-min-scan-pos) | 2761 | c-state-cache-good-pos c-state-min-scan-pos) |
| 2758 | (setcdr ptr nil) | 2762 | (setcdr ptr nil) |
| @@ -3603,7 +3607,7 @@ comment at the start of cc-engine.el for more info." | |||
| 3603 | conses-not-ok)) | 3607 | conses-not-ok)) |
| 3604 | 3608 | ||
| 3605 | (defun c-debug-parse-state () | 3609 | (defun c-debug-parse-state () |
| 3606 | (let ((here (point)) (res1 (c-real-parse-state)) res2) | 3610 | (let ((here (point)) (min-point (point-min)) (res1 (c-real-parse-state)) res2) |
| 3607 | (let ((c-state-cache nil) | 3611 | (let ((c-state-cache nil) |
| 3608 | (c-state-cache-good-pos 1) | 3612 | (c-state-cache-good-pos 1) |
| 3609 | (c-state-nonlit-pos-cache nil) | 3613 | (c-state-nonlit-pos-cache nil) |
| @@ -3630,8 +3634,8 @@ comment at the start of cc-engine.el for more info." | |||
| 3630 | ;; "using cache: %s, from scratch: %s") | 3634 | ;; "using cache: %s, from scratch: %s") |
| 3631 | ;; here res1 res2))) | 3635 | ;; here res1 res2))) |
| 3632 | (message (concat "c-parse-state inconsistency at %s: " | 3636 | (message (concat "c-parse-state inconsistency at %s: " |
| 3633 | "using cache: %s, from scratch: %s") | 3637 | "using cache: %s, from scratch: %s. POINT-MIN: %s") |
| 3634 | here res1 res2) | 3638 | here res1 res2 min-point) |
| 3635 | (message "Old state:") | 3639 | (message "Old state:") |
| 3636 | (c-replay-parse-state-state)) | 3640 | (c-replay-parse-state-state)) |
| 3637 | 3641 | ||