`spell-fu` is not working as expected in *most* programming comments

What happened?

spell-fu is working to check the spelling in comments as expected on my system, but only in elsip-mode: is not working in any other prog-mode derivative on my system that I’ve checked.

What did you expect to happen?

I expected spell-fu to underline mispelled words in comments, and to find spelling errors when I run spell-fu-buffer.

Steps to reproduce

  1. I have (spell +everywhere) configured.
  2. I ensure spell-fu is running in the modes (e.g., python or ocaml) via SPC h m (and also that flyspell is not running).
  3. Type some nonsense string in a comment in a buffer reading some Python or OCaml, and observe no overlay for the error, and no errors detected whenn running spull-fu-buffer.
  4. But spelling in comments is checked in .el files running elsip-mode.

System information

Loading data dump...

Thanks in advance for any tips on how to debug here! I’ve tried looking at the doom config for the :checker spell setting, comparing spell-fu variables, running thru relevant advice in How to debug issues, updating, running doctor, etc. I’m not sure what else to do here to figure out what’s going wrong! :pray:

I got it: I am using tree-sitter based highlighting for most languages I work with these days, and they have a different font-face than what is expected by spell-fu in prog-mode. The default configuration is:

A fix (tho probably not the optimal one) is to add the following to my config:

 (after! spell-fu
   ;; Ensure spell-fu works in prog-modes
   (setq spell-fu-faces-include

I think this is actually something missing in the doom config, and should be added automatically when both tree-sitter and spell-fu are working together…

Hopefully you’ve solved this by now. For the sake of others who happen upon this, I had the same problem and it was caused by spell-fu needing to be configured to work with tree-sitter. I fixed it by adding the needed faces:

(after! spell-fu
  (add-hook! prog-mode
    (setq spell-fu-faces-include
1 Like

Thank you for posting! I fixed this the same way right after posting, and I updated here with a reply, but my reply got trapped in moderation and was never published. That probably cost others lost time :(

Your post should help save them now! <3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.