I frequently have color-bleed issues in emacs, most often with AUCTeX: all of a sudden and for no apparent reason, the line I'm writing will be fontified as math.
First things first: no, I do not have any lone
$ character in a verbatim context.
When it happens, I have a couple workarounds: I use
font-lock-fontify-buffer (I have now hooked it into various commands such as
save-file), or I scroll back up and back down. Occasionally, when it does not help, I can locate a line at which the font-issue starts, and sometimes there is a visible problem in that line (e.g.
The problem is not related to AUCTeX's syntactic parser, for example
texmathp returns the correct answer, regardless of the font.
Given the lack of results from google about it, I'm pretty sure it is a problem in my configuration. But I can't reproduce the bleeding consistently, so proceeding on a dichotomy search in my init files looks like a daunting task.
Is it possible to examine
font-lock's mechanic in vivo, so that I can investigate the bug when I see it?