I am using Doom Emacs with the spell-fu package for spellchecking. I would like to modify spell-fu to ignore words that start with a capital letter and are not at the start of a sentence.

For example, in the sentence: "/This is an Example sentence. Yet Another example? Yes, another Indeed./"

I want the spellchecking to ignore the words "Example" in the first sentence, "Another" in the second sentence, and "Indeed" in the third sentence, as these words fulfil the conditions mentioned.

I have considered three possible approaches:

  1. Modifying +spell-excluded-faces-alist: this seems to bring in a lot of unnecessary complexity.

  2. Modifying ispell-skip-region-alist: I am unsure how to identify one-word regions, especially based on surrounding context.

  3. Modifying a spell-fu range checking command: seems to be the most in-depth approach, but also the most challenging.

I have spent a lot of time trying options 1 and 2, by myself or with GPT-4, to no avail. Surprisingly, there are no blog content/SO questions about this. Also tried trawling dotfiles on GitHub for a spell-fu approach, same result.

Does anyone have an idea on how to solve this issue? Seems like a very common requirement for a spellchecker. Is it easier to do with flyspell?

  • spell-fu-word-regexp exists as a buffer-local variable to scan for words to check so you may be able to create an answer to this question by setting this variable as you desire. The default value is "\\b\\([[:alpha:]]+\\(['\u2019][[:alpha:]]+\\)?\\)\\b" - if this helps enough make sure you create an answer to the question :)
    – Trevoke
    Oct 4, 2023 at 12:58
  • Thanks @Trevoke, I now have an idea of which function to change! I've spent another couple hours on this, trying to work around the issue that Emacs Lisp doesn't have negative lookbehind, but I'll give it another go this weekend and an answer.
    – harabat
    Oct 5, 2023 at 15:10


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.