I usually change dictionaries when writing a git commit, however since I have a mapping to to change dictionary and run (flyspell-buffer) right after I see that flyspell goes beyond the commit message to check also comment lines starting with #.
How can I tell "flyspell, please ignore lines starting with # symbol"?
I've read that I can use flyspell-generic-check-word-predicate however my elisp is far from good :(, I came up with this:
(defun flyspell-ignore-comments ()
"Used for 'flyspell-generic-check-word-predicate' to ignore comments."
(not (string-match "^ *#" (thing-at-point 'line t))))
(put 'git-commit-mode 'flyspell-mode-predicate 'flyspell-ignore-comments)
However it doesn't work. What I'm doing wrong?
Ok, thanks to @KyleMeyer for make me doubt about my configuration, the issue was that I had enabled flyspell in a
text-mode-hook, and that was interfering with the config for thegit-commit-mode. Removingflyspellfor loading in thetext-mode-hooksolved the problem.Thanks.