From: Robert Thorpe <rt@robertthorpeconsulting.com>
To: Haines Brown <haines@engels.histomat.net>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Automatic flyspell
Date: Mon, 23 Feb 2015 03:46:14 +0000 [thread overview]
Message-ID: <87sidx2su1.fsf@robertthorpeconsulting.com> (raw)
In-Reply-To: <87ioeuwa5v.fsf@engels.histomat.net> (message from Haines Brown on Sun, 22 Feb 2015 04:46:52 -0500)
Haines Brown <haines@engels.histomat.net> writes:
> Emanuel Berg <embe8573@student.uu.se> writes:
...
>> If so, try this:
>>
>> (set-default 'major-mode 'text-mode)
>
> Emanuel, thanks. I actually have Flyspell working in Fundamental mode
> with these lines:
>
> (defun turn-on-flyspell () (flyspell-mode 1))
> (add-hook 'find-file-hooks 'turn-on-flyspell)
In Emacs all modes are derived from fundamental-mode. From there the
modes are divided into two great kingdoms, text-modes and prog-modes.
As you've found these need to be treated differently for the purposes of
flyspell. Programming languages contain things that are considered
spelling errors in normal languages.
The best solution is to use hooks as Emanuel suggested:
(add-hook 'text-mode-hook 'turn-on-flyspell-prog)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)
I'd advise not using fundamental-mode at all. There are few differences
between it and text-mode and in most cases text-mode's default behaviour
is more useful.
In general it's not a good idea to use find-file-hooks for something
like this. What happens if you create an empty buffer and then change
the major mode later? In that case flyspell won't be turned on.
BR,
Robert Thorpe
next prev parent reply other threads:[~2015-02-23 3:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-20 16:46 Automatic flyspell Haines Brown
2015-02-21 23:38 ` Emanuel Berg
2015-02-22 0:48 ` Emanuel Berg
2015-02-22 9:46 ` Haines Brown
2015-02-22 23:24 ` Emanuel Berg
2015-02-23 3:46 ` Robert Thorpe [this message]
[not found] <mailman.664.1424663182.31049.help-gnu-emacs@gnu.org>
2015-02-23 19:19 ` Emanuel Berg
2015-02-23 21:05 ` Robert Thorpe
[not found] <mailman.708.1424725551.31049.help-gnu-emacs@gnu.org>
2015-02-25 17:01 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sidx2su1.fsf@robertthorpeconsulting.com \
--to=rt@robertthorpeconsulting.com \
--cc=haines@engels.histomat.net \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.