Spell Checking Comments
I’m notorious for all the typos I make.1 Thankfully Emacs features an awesome built-in mode named flyspell
to help poor typists like me.
Flyspell highlights misspelled words as you type (a.k.a. on the fly) and has useful keybindings to quickly fix them.
Most people typically enable flyspell
only for major modes derived from text-mode
(e.g. markdown-mode
, adoc-mode
), but it can really help programmers as well by
pointing out typos they make in comments. All you need to do is enable flyspell-prog-mode
. I typically enable it for all programming modes2 like this:
(add-hook 'prog-mode-hook #'flyspell-prog-mode)
Now you’ll get instant feedback when you make some typo in a
comment. To fix a word just press C-c $
(M-x
flyspell-correct-word-before-point
), while your cursor is behind it.3
That’s all I have for you today! Keep fixing those nasty typos!