To get rid of the errors, I have to defer running “flyspell-buffer” as late as possible. For example, using idle timer with 0s idle interval for “flyspell-buffer” will work. However, idle timer is a bit tricky to use and will cause warnings in other modes (e.g. markdown mode). So this workaround is still not ideal. I wonder what would be the proper fix for this issue. Thank you for the help!
Best, Ruiyang > On Mar 9, 2023, at 1:29 PM, Ruiyang Wu <ywwr...@gmail.com> wrote: > > Hi, > > I use the following code to load “flyspell-mode” automatically and run > "flyspell-buffer” once immediately after opening a tex file: > >> (add-hook 'text-mode-hook >> (lambda () (turn-on-flyspell))) >> (add-hook 'flyspell-mode-hook >> (lambda () (flyspell-buffer))) > > This used to work very well, but since commit ab3bfaf1, I started to get a > lot of error messages in *Messages* buffer, all having the following format: >> Error during redisplay: (internal--syntax-propertize 102952) signaled (error >> "Font-lock trying to use keywords before setting them up”) > > Aside from the error messages, everything seems to work correctly, i.e., > "flyspell-buffer” gives the expected result. But I would still like to get > rid of the errors. Could you help me with that? Thank you very much! > > Best, > Ruiyang >