Hi Arash, Thanks for your reply. You are right, I just figured out this is not a bug of auctex, but a bug of polymode instead. L224 in `polymode-compat.el' messes up with font lock, and causes this problem in LaTeX mode. Although this is not quite relevant to auctex, a temporary workaround would be: (with-eval-after-load "polymode-compat" (advice-remove 'font-lock-extend-region-multiline 'pm-check-for-real-change-in-extend-multiline)) Best, Ruiyang On Tue, Nov 12, 2019 at 1:11 PM Arash Esbati wrote: > Hi Ruiyang, > > Ruiyang Wu writes: > > > The problem can be reproduced with the `test.tex' file attached below. > When > > I tried to add more characters to the `align' environment in `test.tex', > > the syntax highlighting becomes extremely unstable, switching between > math > > and plain text highlighting. > > I can't reproduce what you describe. Your file looks like this for me > where adding additional characters is no problem: > > > > Emacs : GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) > > of 2019-08-29 > > I'm using Emacs 27 pretest. Maybe you can try it as well and see if the > issue persists. You can fetch it from here: > > https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-27/ > > Best, Arash > -- Ruiyang Wu Graduate Student Department of Mathematics University of Arizona Tucson, AZ, 85721 USA