Is there a way to make a spell check of comments in C++ codes using emacs?
Asked
Active
Viewed 3,091 times
4 Answers
9
To spell check comments already in the file:
M-x ispell-comments-and-strings
To spell check comments as you type:
M-x flyspell-prog-mode
and the .emacs
hooks kindahero suggested.

sligocki
- 6,246
- 5
- 38
- 47
4
as mirk said flyspell-prog-mode
is the obvious way.
To share my config,
;;; for prog modes turn on flyspell-prog-mode (checks spell only in comments)
(dolist (hook '(lisp-mode-hook
emacs-lisp-mode-hook
ruby-mode-hook
yaml-mode
python-mode-hook
shell-mode-hook
php-mode-hook
css-mode-hook
nxml-mode-hook
crontab-mode-hook
perl-mode-hook
javascript-mode-hook
LaTeX-mode-hook))
(add-hook hook 'flyspell-prog-mode))
Remove those modes you don't use/want.

kindahero
- 5,817
- 3
- 25
- 32
1
Edit -> Spelling -> Ispell -> Spell-Check Comments

Matthias
- 8,018
- 2
- 27
- 53
-
1I am unable to find this menu item. Is this emacs 24.0? – mirk Apr 16 '12 at 08:58
-
You have possibly to install the ispell package. I use 23.3.50.1. – Matthias Apr 16 '12 at 12:08