Don't mark code comments as incorrect Flyspell

138 Views Asked by At

In emacs flyspell-prog-mode, comments are spell-checked. However, many of my comments are commented blocks of code, and are highlighted as spelling errors. How can I tell Flyspell to ingore all of the symbols used in the program code?

1

There are 1 best solutions below

2
Michael Markert On

Short answer: You can't.

Long answer: You have to program it yourself. An entry point is the variable flyspell-generic-check-word-predicate where you can supply a function that returns nil if it shouldn't be checked and non-nil if it should, (point) is here after the word you want to analyze.

If you have this requirement only for certain modes you can set the flyspell-mode-predicate for the mode. E.g. for python-mode

(put 'python-mode 'flyspell-mode-predicate 'your-python-predicate-function)