From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?iso-8859-1?Q?S=E9bastien_Vauban?= Newsgroups: gmane.emacs.help Subject: Re: flyspelling at undesirable/unneeded moments Date: Mon, 10 Mar 2008 12:19:53 +0100 Organization: Sebastien Vauban Message-ID: <87skyysu5i.fsf@mundaneum.com> References: <87fxv3zx3q.fsf@mundaneum.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1205149321 8623 80.91.229.12 (10 Mar 2008 11:42:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Mar 2008 11:42:01 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Mar 10 12:42:26 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JYgOa-0004Sb-Id for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Mar 2008 12:42:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JYgO2-0007qr-8W for geh-help-gnu-emacs@m.gmane.org; Mon, 10 Mar 2008 07:41:46 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!multikabel.net!feed20.multikabel.net!news.germany.com!ecngs!feeder.ecngs.de!feed1.news.be.easynet.net!reader0.news.be.easynet.net!not-for-mail Original-Newsgroups: gnu.emacs.help X-Www-site: Under construction... User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:h3FrPP8l0n34zD7bmeDmY5ujI2k= Original-Lines: 79 Original-NNTP-Posting-Date: 10 Mar 2008 11:19:53 GMT Original-NNTP-Posting-Host: 81.188.7.152 Original-X-Trace: 1205147993 reader0.news.be.easynet.net 1588 [::ffff:81.188.7.152]:27385 Original-X-Complaints-To: abuse@be.easynet.net Original-Xref: shelby.stanford.edu gnu.emacs.help:156842 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:52214 Archived-At: 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 --=20 S=E9bastien=A0Vauban