How to enable flyspell-mode in emacs for all files and all major modes?

mart1n picture mart1n · Jul 28, 2011 · Viewed 7.5k times · Source

How do you enable flyspell-mode to be automatically used for every file and every major mode as soon as Emacs is started?

Also, is there an XML dictionary that does not mark XML tags as misspelled words?

Answer

b4hand picture b4hand · Nov 19, 2013

The answer from this question worked for me:

How to enable automatic spell check by default?

Furthermore, it appears to be more general compared to the other prior answers. Add the following lines to your .emacs or init.el.

(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)