Hi Arash, Thanks for the suggestion. Adding (font-lock-update) works for me.
Best, Ruiyang > On Apr 4, 2023, at 4:00 AM, Arash Esbati <ar...@gnu.org> wrote: > > Maybe I missed the Emacs version you're using, but you can try to update > the fontification before you turn-on-flyspell. So with Emacs 28, you > could write something like this: > > (add-hook 'LaTeX-mode-hook > (lambda () > (font-lock-update) > (turn-on-flyspell) > (flyspell-buffer)) > t) > > which doesn't throw an error for me. > > HTH. Best, Arash >