Subject: bug#22644: CC Mode 5.33 (C++/l); Cache error when editing template

From: Alan Mackenzie <[email-masked]>
Date: Mon, 15 Feb 2016 21:56:39 +0000

Hello, Michael.

On Fri, Feb 12, 2016 at 11:35:11AM -0500, Michael Welsh Duggan wrote:
> This recipe is very specific.  Small deviations have caused this not to
> trigger for no reason that I can determine.

I'm afraid I can't reproduce it at all.  My window size on emacs -Q in X
Windows appears to be two lines higher than yours.  So I tried just
starting emacs -Q, then C-x C-f'ing the file, then proceding as in your
recipe.  I still can't get it to trigger the error.  Yet.

> emacs -Q matchertags.hpp

> M-x c-toggle-parse-state-debug RET
> C-v C-n C-n C-n C-n C-n C-n C-n        // Should be on std::conditional line
> M-f M-f M-f M-f C-f                    // Should be on ::value
> M-d ( )

> This causes the following output:

> c-parse-state inconsistency at 774: using cache: (412 (368 . 391) 293), from scratch: ((706 . 708) 412 (368 . 391) 293)
> Old state:
> (setq c-state-cache ’(412 (368 . 391) 293)  c-state-cache-good-pos 708  c-state-nonlit-pos-cache nil  c-state-nonlit-pos-cache-limit 802  c-state-semi-nonlit-pos-cache nil  c-state-semi-nonlit-pos-cache-limit 802  c-state-brace-pair-desert ’(412 . 803)  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 711)
> c-parse-state inconsistency at 778: using cache: (412 (368 . 391) 293), from scratch: ((706 . 708) 412 (368 . 391) 293)
> Old state:
> (setq c-state-cache ’(412 (368 . 391) 293)  c-state-cache-good-pos 708  c-state-nonlit-pos-cache nil  c-state-nonlit-pos-cache-limit 802  c-state-semi-nonlit-pos-cache nil  c-state-semi-nonlit-pos-cache-limit 802  c-state-brace-pair-desert ’(412 . 803)  c-state-point-min 1  c-state-point-min-lit-type nil  c-state-point-min-lit-start nil  c-state-min-scan-pos 1  c-state-old-cpp-beg nil  c-state-old-cpp-end nil  c-parse-state-point 774)

The sad thing there is that the first "old state" shown is already
wrong: seeing as how the previous `c-parse-state' was done with point at
711 (the value of `c-parse-state-point'), it should have recorded the
brace pair at (706 . 708).  I don't know why this didn't show up itself
as an inconsistency.

If I don't manage to make progress, I may well be asking you to run a
changed version of cc-engine.elc which would record every
`c-parse-state' call, not just those generating inconsistencies.

[ .... ]

> -- 
> Michael Welsh Duggan
> ([email-masked])

-- 
Alan Mackenzie (Nuremberg, Germany).