From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: turn-on-*-mode Date: Wed, 17 May 2006 11:18:16 +0900 Message-ID: References: <4469D3B6.2040904@student.lu.se> Reply-To: Miles Bader NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1147832340 10585 80.91.229.2 (17 May 2006 02:19:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 17 May 2006 02:19:00 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 17 04:18:54 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FgBcP-0004NX-WD for ged-emacs-devel@m.gmane.org; Wed, 17 May 2006 04:18:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FgBcP-0000tb-By for ged-emacs-devel@m.gmane.org; Tue, 16 May 2006 22:18:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FgBcE-0000tO-3N for emacs-devel@gnu.org; Tue, 16 May 2006 22:18:22 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FgBcB-0000t7-Ki for emacs-devel@gnu.org; Tue, 16 May 2006 22:18:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FgBcB-0000t4-G6 for emacs-devel@gnu.org; Tue, 16 May 2006 22:18:19 -0400 Original-Received: from [203.180.232.82] (helo=mgate02.necel.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FgBev-0001nt-Rh; Tue, 16 May 2006 22:21:10 -0400 Original-Received: from relay21.aps.necel.com (relay21 [10.29.19.50]) by mgate02.necel.com (8.13.6/8.13.1) with ESMTP id k4H1Z5Af004628; Wed, 17 May 2006 11:18:17 +0900 (JST) Original-Received: from relay21.aps.necel.com ([10.29.19.16] [10.29.19.16]) by relay21.aps.necel.com with ESMTP; Wed, 17 May 2006 11:18:16 +0900 Original-Received: from dhapc248.dev.necel.com ([10.114.97.235] [10.114.97.235]) by relay21.aps.necel.com with ESMTP; Wed, 17 May 2006 11:18:16 +0900 Original-Received: by dhapc248.dev.necel.com (Postfix, from userid 31295) id C584D3E3; Wed, 17 May 2006 11:18:16 +0900 (JST) Original-To: emacs-devel@gnu.org System-Type: i686-pc-linux-gnu Blat: Foop In-Reply-To: (Reiner Steib's message of "Tue, 16 May 2006 17:48:59 +0200") Original-Lines: 30 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:54613 Archived-At: Reiner Steib writes: > An advantage of turn-on-... (and turn-off-...) is that is simplifies > adding it to a hook: > > (add-hook 'text-mode-hook 'turn-on-auto-fill) > (add-hook 'text-mode-hook (lambda () (flyspell-mode 1))) > > BTW, AFAICS the `flyspell-mode' entry in the defcustom of > `text-mode-hook' toggles `flyspell-mode' instead of turning it on: Stefan had a (what I thought was) clever suggestion to deal with this: Make "...-mode" functions toggle only when used interactively (just as they only print a message when used interactively), and otherwise have them just enable the state unconditionally. This is not a strictly compatible change, but in practice probably would fix more problems than it would cause -- nobody in their right mind puts a mode-function in a hook with the intention to toggle the state, but people _do_ put mode functions in hooks _thinking_ that they unconditionally enable the mode. A possible variant of this idea that might be more compatible is to have `run-hooks' bind a global variable to t when running a hook (e.g. `running-hook'), and have mode function unconditionally enable the mode when that variable is non-nil. -Miles -- It wasn't the Exxon Valdez captain's driving that caused the Alaskan oil spill. It was yours. [Greenpeace advertisement, New York Times, 25 February 1990]