all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* flyspelling at undesirable/unneeded moments
@ 2008-03-06 15:32 Sébastien Vauban
  2008-03-10  4:54 ` Kevin Rodgers
       [not found] ` <mailman.8630.1205124899.18990.help-gnu-emacs@gnu.org>
  0 siblings, 2 replies; 3+ messages in thread
From: Sébastien Vauban @ 2008-03-06 15:32 UTC (permalink / raw)
  To: help-gnu-emacs

Hello,

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---

The problem is that, even in its fastest mode ...

--8<---------------cut here---------------start------------->8---
;; extra switches to pass to the `aspell' program
(setq ispell-extra-args '("--sug-mode=ultra"))
--8<---------------cut here---------------end--------------->8---

... it takes some amount of time - what's annoying for looooong
documents.

It is much more annoying when, in fact, the only thing you want
to do is to `ediff' it, just before committing it into
subversion: while you have worked on it, the fact it re-opens it
makes it go through it (for checking the ortograph) once more!

#1. How could we avoid that (i.e., not being called when open by
    ediff)?

More generally, it'd be normal to activate the minor mode only
once you begin editing the document, not when you're opening it
just for reading.

#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?

Thank you very much for your helpful answers,
  Seb

-- 
Sébastien Vauban


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: flyspelling at undesirable/unneeded moments
  2008-03-06 15:32 flyspelling at undesirable/unneeded moments Sébastien Vauban
@ 2008-03-10  4:54 ` Kevin Rodgers
       [not found] ` <mailman.8630.1205124899.18990.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Rodgers @ 2008-03-10  4:54 UTC (permalink / raw)
  To: help-gnu-emacs

Sébastien Vauban wrote:
> Hello,
> 
> 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?

> The problem is that, even in its fastest mode ...
> 
> --8<---------------cut here---------------start------------->8---
> ;; extra switches to pass to the `aspell' program
> (setq ispell-extra-args '("--sug-mode=ultra"))
> --8<---------------cut here---------------end--------------->8---
> 
> ... it takes some amount of time - what's annoying for looooong
> documents.
> 
> It is much more annoying when, in fact, the only thing you want
> to do is to `ediff' it, just before committing it into
> subversion: while you have worked on it, the fact it re-opens it
> makes it go through it (for checking the ortograph) once more!
> 
> #1. How could we avoid that (i.e., not being called when open by
>     ediff)?
> 
> More generally, it'd be normal to activate the minor mode only
> once you begin editing the document, not when you're opening it
> just for reading.
> 
> #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))))

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: flyspelling at undesirable/unneeded moments
       [not found] ` <mailman.8630.1205124899.18990.help-gnu-emacs@gnu.org>
@ 2008-03-10 11:19   ` Sébastien Vauban
  0 siblings, 0 replies; 3+ messages in thread
From: Sébastien Vauban @ 2008-03-10 11:19 UTC (permalink / raw)
  To: help-gnu-emacs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-10 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-06 15:32 flyspelling at undesirable/unneeded moments Sébastien Vauban
2008-03-10  4:54 ` Kevin Rodgers
     [not found] ` <mailman.8630.1205124899.18990.help-gnu-emacs@gnu.org>
2008-03-10 11:19   ` Sébastien Vauban

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.