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. $a[b$).

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?

  • font-latex.el parser doesn't use texmathp (which in turn doesn't rely on font-locking) so there may well be a bug in font-latex.el. To be honest, it happened to me a couple of times that a large part of Elisp code was fontified like if it were all a single string, which wasn't. I'm also very interested in advice about how to debug font-locking. – giordano Feb 23 '16 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.