Ruiyang Wu <ywwr...@gmail.com> writes:

> 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!

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

Reply via email to