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?
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?
The answer from this question worked for me:
How to enable automatic spell check by default?
Furthermore, it appears to be more general, unlike the current voted answer. Add the following lines to your
.emacs
orinit.el
.I couldn't say when, but flyspell-mode now does a pretty good job of knowing what mode it is in and reacting accordingly. Here is my use-package implementation with an interface to company-completion.
You can add the following to your Emacs init file:
(flyspell-all-modes)
The function description states:
EDIT: Apparently the above function is only included in the version of flyspell that is in Emacs 24. If you can't use that version, you should instead use the solution suggested by Trey to "semi-globally" enable flyspell. To disable XML tag checking with NXML, you can add the following line to your Emacs init file:
Note: This line is already in the flyspell.el included in Emacs 24.
Chances are, you don't really want
flyspell-mode
enabled for all modes, but instead wantflyspell-mode
enabled for modes that deal primarily with text (text-mode, message-mode, etc.), andflyspell-prog-mode
for the programming modes (C/C++, Java, Ruby, Lisp, etc.). The difference between the two modes is that the first checks all words, whereas theflyspell-prog-mode
only checks words in comments and strings (thereby avoiding checking the code, which generally isn't words).Either way, there is no single place to enable flyspell in all files/buffers because it has been written to always be buffer local. A close approximation would be
That doesn't cover buffers which don't have associated files, and I don't advise using it because it doesn't distinguish between the programming modes and non-programming modes - which I think is useful.
Because there is no way to know whether certain modes are programming modes or not, you need to manually add customizations for all the programming modes you care about, with something like:
Note: the two chunks of code probably don't play well together.
And, regarding the XML, flyspell already has customizations for
sgml-mode
,html-mode
, andnxml-mode
to not spell check the tags (as of Emacs 23.2). If you're using an older version of Emacs (back to 21.1), you should be able to add this to your .emacs to get the support fornxml-mode
: