[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: flyspelling at undesirable/unneeded moments
From: |
Sébastien Vauban |
Subject: |
Re: flyspelling at undesirable/unneeded moments |
Date: |
Mon, 10 Mar 2008 12:19:53 +0100 |
User-agent: |
Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) |
Hi Kevin,
>> I've turned on (the great) `flyspell' in many major editing
>> modes with the following code:
--8<---------------cut here---------------start------------->8---
;; turn on `flyspell' for various major modes
(mapc (lambda (hook)
(add-hook hook 'my-turn-on-flyspell-french))
'(message-mode-hook
text-mode-hook
latex-mode-hook
tex-mode-hook
nuweb-mode-hook
html-mode-hook)))
--8<---------------cut here---------------end--------------->8---
> Don't all those modes run text-mode-hook as a matter of
> course?
No, it seems they don't. I just let `text-mode-hook', and then
it's not enabled for messages or latex buffers...
Is there a way to see from which mode the current major mode is
inheriting properties?
>> The problem is that, even in its fastest mode, it takes some
>> amount of time - what's annoying for looooong documents.
>>
>> #1. How could we avoid that (i.e., not being called when open
>> by ediff)?
>>
>> #2. Is it possible to hook it in such a way (that it's only
>> enabled at the time we begin modifying the document)?
>> Does such hook concept exist?
>
> (defvar my-flyspell-major-mode-list
> '(text-mode-hook))
>
> (add-hook 'first-change-hook
> (lambda ()
> (when (and (memq major-mode my-flyspell-major-mode-list)
> (not flyspell-mode))
> (my-turn-on-flyspell-french))))
Just one word: GREAT! Thank you very much...
I really appreciate your help (BTW, not only when you answer my
questions).
Though, I just had to make a couple of adaptations to
`my-flyspell-major-mode-list' as `text-mode' is not sufficient
(see my above comment), and the `hook' suffix is too much.
Here's my adapted version:
--8<---------------cut here---------------start------------->8---
(defvar my-flyspell-major-mode-list
'(latex-mode
message-mode
muse-mode
nuweb-mode
nxml-mode
text-mode))
(add-hook 'first-change-hook
(lambda ()
;; (message "major-mode is %s" major-mode)
(when (and (memq major-mode my-flyspell-major-mode-list)
(not flyspell-mode))
(my-turn-on-flyspell-french))))
--8<---------------cut here---------------end--------------->8---
Best regards,
Seb
--
Sébastien Vauban