From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: add-hook Date: 10 Nov 2003 10:41:28 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1068481160 30336 80.91.224.253 (10 Nov 2003 16:19:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 10 Nov 2003 16:19:20 +0000 (UTC) Cc: rms@gnu.org, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Nov 10 17:19:11 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJEkx-0006Hg-00 for ; Mon, 10 Nov 2003 17:19:11 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1AJEkw-0006eA-00 for ; Mon, 10 Nov 2003 17:19:11 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJFAu-0005Sk-JP for emacs-devel@quimby.gnus.org; Mon, 10 Nov 2003 11:46:00 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.24) id 1AJF9U-0005Kl-J9 for emacs-devel@gnu.org; Mon, 10 Nov 2003 11:44:32 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.24) id 1AJF94-0005Dm-1G for emacs-devel@gnu.org; Mon, 10 Nov 2003 11:44:29 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.24) id 1AJF7y-00050L-MJ; Mon, 10 Nov 2003 11:42:58 -0500 Original-Received: from vor.iro.umontreal.ca (vor.iro.umontreal.ca [132.204.24.42]) by mercure.iro.umontreal.ca (8.12.9/8.12.9) with ESMTP id hAAFfSbj025162; Mon, 10 Nov 2003 10:41:28 -0500 Original-Received: by vor.iro.umontreal.ca (Postfix, from userid 20848) id 75D563C63E; Mon, 10 Nov 2003 10:41:28 -0500 (EST) Original-To: Miles Bader In-Reply-To: Original-Lines: 26 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-DIRO-MailScanner: Found to be clean X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:17757 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:17757 > Richard Stallman writes: >> ;; Detect the case where make-local-variable was used on a hook >> ;; and do what we used to do. >> (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook))) >> (setq local t))) >> >> That is very confusing, and contradicts what the comment says. >> This needs to be cleaned up somehow. > Call me insane, but wouldn't `local-variable-p' be a nice way to detect > this case...? Well, that's what RMS thought and so he added it and it breaks things: Setting `local' to t ensures that the var will be modified with `set' whereas a setting of nil implies that the hook will be modified with `set-default', so the safe setting is t. The only case where we want to use the unsafe setting of nil is when we indeed want to change the global part of the hook and there is both a local and a global part (i.e when local == nil and when there's a t in the hook's content). You can add an unnecessary test for local-variable-if-set-p, or you can change the comment to make things more clear, but you can't use local-variable-p: we tried that already. Stefan