Re: Font-lock error when using "flyspell-buffer" upon opening a tex file
Ruiyang Wu writes: > Thanks for the suggestion. Adding (font-lock-update) works for me. Thanks for your feedback, and glad we could solve this. Best, Arash
Re: Font-lock error when using "flyspell-buffer" upon opening a tex file
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 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 >
Re: Font-lock error when using "flyspell-buffer" upon opening a tex file
Ruiyang Wu 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
Re: Font-lock error when using "flyspell-buffer" upon opening a tex file
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 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 >