Quite frequently, syntax highlighting in a given buffer is broken (i.e., a big fraction of the code is not highlighted). This is definitely not due to syntax errors, and the point at which highlighting stops quite often is in the middle of an identifier. Then, a
revert-buffer regularly restores the highlighting. Of course, it is annoying to be forced to do so over and over again. What is the root cause of this, and how can one make the syntax highlighting more robust?
I observe this on python-mode buffers since I program almost exclusively in that language, but I have observed this in other modes, too.