Alan Mackenzie writes: > Hi, Michael. > > On Fri, Sep 21, 2012 at 01:47:15PM -0400, Michael Welsh Duggan wrote: >> Michael Welsh Duggan writes: > >> > Michael Welsh Duggan writes: > >> >>>> There is generally no way to re-create it, so I've stopped reporting >> >>>> these. I wish there were some way to record all actions in c-mode >> >>>> buffers such that they could be saved and re-played when this type of >> >>>> problem happens. If there were some sort of debug flag I could turn >> >>>> on, I would turn it on by default and hopefully be able to catch some >> >>>> useful information. > >> >>> M-x c-toggle-parse-state-debug > >> >>> (or (c-toggle-parse-state-debug 1) in your .emacs). Warning: variable >> >>> `c-debug-parse-state' is not buffer local. I wrote this on 19th October >> >>> last year to help sort out the bug you reported a little earlier. :-) > >> >>> It works by calculating c-parse-state twice for each call - The first >> >>> time normally, then again with the internal state bound to "newly >> >>> initialised". If the the two results differ, they are printed to >> >>> *Messages*, together with the saved previous state. If this does >> >>> trigger, please note any recent buffer changes. It may make editing >> >>> intolerably slow. > >> >> I will turn this on. > >> I turned this on, and inserted a (ding) where cc-mode outputs an >> inconsistency message. I can barely stand to edit code now, due to >> what seem to be almost every key press causing a beep. Have you made >> any progress here, or do you need more data? > > I have found the bug which is causing (most of) these dings, though I > don't think it is the one which caused Kim's original bug. Could you try > out the patch below, please. (I have also enhanced/corrected the > debugging routines a bit, too.) Still doesn't seem to help much here. I have attached a file which reliably causes a cache failure. I have attached the smallest file of the set of files I am working on that causes this particular problem. Load the attached file and toggle on parse state debugging. Then scroll to the bottom of the file. (Use C-v multiple times, or just M->.) One reason I have attached this file is that it only triggers the warning message once. Most of my larger files cause this to happen quite a lot.