From unknown Sat Aug 16 22:46:00 2025 X-Loop: don@donarmstrong.com Subject: bug#1102: 23.0.60; add-hook should check that its function arg is a function. Reply-To: Phil Hagelberg , 1102@debbugs.gnu.org Resent-From: Phil Hagelberg Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 06 Oct 2008 17:45:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1102 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122331464129578 (code B ref -1); Mon, 06 Oct 2008 17:45:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.9 required=4.0 tests=BAYES_00,FOURLA, IMPRONONCABLE_2,MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 6 Oct 2008 17:37:21 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m96HbGN4029572 for ; Mon, 6 Oct 2008 10:37:17 -0700 Received: from mx10.gnu.org ([199.232.76.166]:59400) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Kmtyx-00035W-7B for emacs-pretest-bug@gnu.org; Mon, 06 Oct 2008 13:34:55 -0400 Received: from dsl017-040-091.sea1.dsl.speakeasy.net ([69.17.40.91]:33971 helo=zimbra.evri.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kmu0y-0004NJ-Pz for emacs-pretest-bug@gnu.org; Mon, 06 Oct 2008 13:37:06 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.evri.com (Postfix) with ESMTP id C707D1A2C008 for ; Mon, 6 Oct 2008 09:59:59 -0700 (PDT) X-Virus-Scanned: amavisd-new at Received: from zimbra.evri.com ([127.0.0.1]) by localhost (zimbra.evri.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dqhnRPFN4K69 for ; Mon, 6 Oct 2008 09:59:58 -0700 (PDT) Received: from pdp10 (unknown [10.75.0.2]) by zimbra.evri.com (Postfix) with ESMTP id 190551A2C007 for ; Mon, 6 Oct 2008 09:59:58 -0700 (PDT) Date: Mon, 06 Oct 2008 09:59:57 -0700 Message-Id: <8763o51wxe.fsf@evri.com> From: Phil Hagelberg To: emacs-pretest-bug@gnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Greylist: delayed 2198 seconds by postgrey-1.27 at monty-python; Mon, 06 Oct 2008 13:36:38 EDT add-hook may be called with a function argument that is not a function: (add-hook 'emacs-lisp-mode-hook 22) This is functionally a no-op since run-mode-hooks will ignore such values, but it would probably be better to get an error when add-hook is called. Here's a patch. I'm not sure what the convention is for how these types of error messages should read, so that could be changed. diff --git a/lisp/subr.el b/lisp/subr.el index d62b38b..49e9470 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1132,6 +1132,7 @@ HOOK is void, it is first set to nil. If HOOK's value is a single function, it is changed to a list of functions." (or (boundp hook) (set hook nil)) (or (default-boundp hook) (set-default hook nil)) + (unless (functionp function) (error "`function' argument was not a function")) (if local (unless (local-variable-if-set-p hook) (set (make-local-variable hook) (list t))) ;; Detect the case where make-local-variable was used on a hook In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of 2008-09-29 on pdp10 Windowing system distributor `The X.Org Foundation', version 11.0.10400090 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Group Minor modes in effect: shell-dirtrack-mode: t jabber-activity-mode: t gnus-topic-mode: t gnus-undo-mode: t show-paren-mode: t recentf-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: o k SPC ' g n u s - a r t i c l e - m o d e - h o o k C-S-h v q SPC ' l o n g l i n e - s - m o d e ) C-S-x C-S-s C-S-x C-S-e C-S-x k C-S-x C-S-o SPC SPC SPC SPC M-x l o n g l i n e s - - m o d e M-x M-p M-< C-S-x o C-S-p C-S-x o C-S-p C-S-n C-S-x o C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-v C-S-v C-S-v SPC SPC SPC SPC SPC C-S-x C-S-o C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n q g p q C-S-n k k k k k k q p n d q g p q p p M-> C-S-p C-S-p C-S-p C-S-n SPC C-S-x o C-S-x o M-u C-S-p q g g p p p p M-> p C-S-x o M-> M-< C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n t t C-S-p C-S-p C-S-p C-S-x o C-S-x o ! C-S-p C-S-p M-u q g M-x r e p o r t - e m a c s - b u g Recent messages: Generating summary...done Mark set [3 times] No more articles [2 times] Reading active file via nnnil...done Reading active file via nnml... nnml: Reading incoming mail from file... nnml: Reading incoming mail (no new mail)...done Reading active file via nnml...done Reading active file from archive via nnfolder...done Checking new news...done From unknown Sat Aug 16 22:46:00 2025 X-Loop: don@donarmstrong.com Subject: bug#1102: Modification of patch Reply-To: Phil Hagelberg , 1102@debbugs.gnu.org Resent-From: Phil Hagelberg Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 06 Oct 2008 18:30:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1102 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 1102-submit@emacsbugs.donarmstrong.com id=B1102.12233174678561 (code B ref 1102); Mon, 06 Oct 2008 18:30:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-1.4 required=4.0 tests=AWL,BAYES_00,FOURLA, IMPRONONCABLE_2,MURPHY_DRUGS_REL8 autolearn=no version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1102) by emacsbugs.donarmstrong.com; 6 Oct 2008 18:24:27 +0000 Received: from spunkymail-a1.g.dreamhost.com (mailbigip.dreamhost.com [208.97.132.5]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m96IOOK0008553 for <1102@emacsbugs.donarmstrong.com>; Mon, 6 Oct 2008 11:24:25 -0700 Received: from dynabook (unknown [63.229.31.77]) by spunkymail-a1.g.dreamhost.com (Postfix) with ESMTP id 56A35FE245 for <1102@emacsbugs.donarmstrong.com>; Mon, 6 Oct 2008 11:24:23 -0700 (PDT) From: Phil Hagelberg To: 1102@debbugs.gnu.org Date: Mon, 06 Oct 2008 11:24:22 -0700 Message-ID: <873aj9mvjd.fsf@hagelb.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Changed the patch from the initial bug report. add-hook should allow symbols since it's reasonable to refer to functions that haven't been defined yet. -Phil diff --git a/lisp/subr.el b/lisp/subr.el index d62b38b..d315c27 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1132,6 +1132,8 @@ HOOK is void, it is first set to nil. If HOOK's value is a single function, it is changed to a list of functions." (or (boundp hook) (set hook nil)) (or (default-boundp hook) (set-default hook nil)) + (unless (or (functionp function) (symbolp function)) + (error "`function' argument was not a function")) (if local (unless (local-variable-if-set-p hook) (set (make-local-variable hook) (list t))) ;; Detect the case where make-local-variable was used on a hook From unknown Sat Aug 16 22:46:00 2025 X-Loop: don@donarmstrong.com Subject: bug#1102: Modification of patch Reply-To: Glenn Morris , 1102@debbugs.gnu.org Resent-From: Glenn Morris Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 16 Oct 2008 06:05:05 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1102 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 1102-submit@emacsbugs.donarmstrong.com id=B1102.122413664523678 (code B ref 1102); Thu, 16 Oct 2008 06:05:05 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-12.2 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED,X_DEBBUGS_NO_ACK autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1102) by emacsbugs.donarmstrong.com; 16 Oct 2008 05:57:25 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9G5vMpJ023672 for <1102@emacsbugs.donarmstrong.com>; Wed, 15 Oct 2008 22:57:23 -0700 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1KqLov-0006oN-3x; Thu, 16 Oct 2008 01:54:49 -0400 From: Glenn Morris To: Phil Hagelberg Cc: 1102@debbugs.gnu.org References: <873aj9mvjd.fsf@hagelb.org> X-Spook: Crypto AG Albright Al Jazeera Honduras government X-Ran: g_[HT[&N8Ow9UCyMQ$z/zuMJp^*L~:"Zs`+@Z'YmJ4D4O=5%VxTgN7@SQ?G9!IN>3fPu?' X-Hue: cyan X-Attribution: GM Date: Thu, 16 Oct 2008 01:54:49 -0400 Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Phil Hagelberg wrote: > add-hook should allow symbols since it's reasonable to refer to > functions that haven't been defined yet. Doesn't it therefore seem a bit pointless to check? There will always be ways to shoot oneself in the foot. I imagine many functions don't check the type of their arguments. From unknown Sat Aug 16 22:46:00 2025 X-Loop: don@donarmstrong.com Subject: bug#1102: Modification of patch Reply-To: Phil Hagelberg , 1102@debbugs.gnu.org Resent-From: Phil Hagelberg Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Thu, 16 Oct 2008 17:35:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1102 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by 1102-submit@emacsbugs.donarmstrong.com id=B1102.12241780711897 (code B ref 1102); Thu, 16 Oct 2008 17:35:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-11.0 required=4.0 tests=BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1102) by emacsbugs.donarmstrong.com; 16 Oct 2008 17:27:51 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9GHRmBD001891 for <1102@emacsbugs.donarmstrong.com>; Thu, 16 Oct 2008 10:27:50 -0700 Received: from rgm by fencepost.gnu.org with local (Exim 4.67) (envelope-from ) id 1KqWb5-0003rd-5w for 1102@emacsbugs.donarmstrong.com; Thu, 16 Oct 2008 13:25:15 -0400 Resent-Message-ID: <18679.30971.135000.155967@fencepost.gnu.org> Resent-Date: Thu, 16 Oct 2008 13:25:15 -0400 Resent-From: Glenn Morris Resent-To: 1102@debbugs.gnu.org References: <873aj9mvjd.fsf@hagelb.org> In-Reply-To: (Glenn Morris's message of "Thu, 16 Oct 2008 01:54:49 -0400") Message-ID: <87hc7ciksj.fsf@hagelb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) Date: Thu, 16 Oct 2008 09:09:32 -0700 From: Phil Hagelberg To: Glenn Morris X-Bogosity: unsure, spamicity=0.100921, v1.0.1 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Resent-Date: Thu, 16 Oct 2008 13:25:15 -0400 Glenn Morris writes: >> add-hook should allow symbols since it's reasonable to refer to >> functions that haven't been defined yet. > > Doesn't it therefore seem a bit pointless to check? There will always > be ways to shoot oneself in the foot. I imagine many functions don't > check the type of their arguments. Yeah, you're probably right; in retrospect I'm not sure why it's necessary. Feel free to close as a wontfix. -Phil From unknown Sat Aug 16 22:46:00 2025 X-Loop: don@donarmstrong.com Subject: bug#1102: Modification of patch Reply-To: Stefan Monnier , 1102@debbugs.gnu.org Resent-From: Stefan Monnier Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 17 Oct 2008 01:35:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1102 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: wontfix Received: via spool by 1102-submit@emacsbugs.donarmstrong.com id=B1102.122420690424624 (code B ref 1102); Fri, 17 Oct 2008 01:35:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.3 required=4.0 tests=AWL,BAYES_00,HAS_BUG_NUMBER, MURPHY_DRUGS_REL8,VALID_BTS_CONTROL autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 1102) by emacsbugs.donarmstrong.com; 17 Oct 2008 01:28:24 +0000 Received: from ironport2-out.teksavvy.com (ironport2-out.pppoe.ca [206.248.154.182]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m9H1SFKJ024618; Thu, 16 Oct 2008 18:28:16 -0700 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsEAJaG90hMCpQ6/2dsb2JhbACBcsF6g2yBCQ X-IronPort-AV: E=Sophos;i="4.33,427,1220241600"; d="scan'208";a="28497886" Received: from 76-10-148-58.dsl.teksavvy.com (HELO ceviche.home) ([76.10.148.58]) by ironport2-out.teksavvy.com with ESMTP; 16 Oct 2008 21:28:09 -0400 Received: by ceviche.home (Postfix, from userid 20848) id 01F4BB4111; Thu, 16 Oct 2008 21:28:08 -0400 (EDT) From: Stefan Monnier To: Phil Hagelberg Cc: 1102@debbugs.gnu.org, control@debbugs.gnu.org Message-ID: References: <873aj9mvjd.fsf@hagelb.org> <87hc7ciksj.fsf@hagelb.org> Date: Thu, 16 Oct 2008 21:28:08 -0400 In-Reply-To: <87hc7ciksj.fsf@hagelb.org> (Phil Hagelberg's message of "Thu, 16 Oct 2008 09:09:32 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii tag 1102 +wontfix thanks > Yeah, you're probably right; in retrospect I'm not sure why it's > necessary. Feel free to close as a wontfix. Thank you, Stefan From unknown Sat Aug 16 22:46:00 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.427 (Entity 5.427) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Phil Hagelberg Subject: bug#1102: closed (Re: bug#1102: add-hook should check that its function arg is a function) Message-ID: References: <8763o51wxe.fsf@evri.com> X-Gnu-PR-Message: they-closed 1102 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: wontfix Reply-To: 1102@debbugs.gnu.org Date: Sat, 09 Jul 2011 18:47:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1310237222-3410-1" This is a multi-part message in MIME format... ------------=_1310237222-3410-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #1102: 23.0.60; add-hook should check that its function arg is a function. which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 1102@debbugs.gnu.org. --=20 1102: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D1102 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1310237222-3410-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 1102-done) by debbugs.gnu.org; 9 Jul 2011 18:46:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QfcY7-0000sW-Eh for submit@debbugs.gnu.org; Sat, 09 Jul 2011 14:46:43 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QfcY4-0000sI-1E for 1102-done@debbugs.gnu.org; Sat, 09 Jul 2011 14:46:40 -0400 Received: from localhost ([127.0.0.1]:36639) by fencepost.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfcXy-0006Ul-Ie; Sat, 09 Jul 2011 14:46:34 -0400 From: Glenn Morris To: 1102-done@debbugs.gnu.org Subject: Re: bug#1102: add-hook should check that its function arg is a function References: <873aj9mvjd.fsf@hagelb.org> <87hc7ciksj.fsf@hagelb.org> X-Spook: Glock Afghanistan spies CDMA Watergate Sundevil Commecen X-Ran: H'fMFDQ8o+vfAdu^DF<]?6jgL^H$~V(5yVNw7^\^:MbK9W7lGGXcNqi4me243kXZ{uAD|y X-Hue: blue X-Attribution: GM Date: Sat, 09 Jul 2011 14:46:34 -0400 In-Reply-To: <87hc7ciksj.fsf@hagelb.org> (Phil Hagelberg's message of "Thu, 16 Oct 2008 09:09:32 -0700") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: 1102-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) I don't see a need to keep open this particular report, which was marked "wontfix" some time ago. Phil Hagelberg wrote: > Yeah, you're probably right; in retrospect I'm not sure why it's > necessary. Feel free to close as a wontfix. ------------=_1310237222-3410-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit >From phil@evri.com Mon Oct 6 10:37:21 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-6.9 required=4.0 tests=BAYES_00,FOURLA, IMPRONONCABLE_2,MURPHY_DRUGS_REL8,RCVD_IN_DNSWL_MED autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 6 Oct 2008 17:37:21 +0000 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m96HbGN4029572 for ; Mon, 6 Oct 2008 10:37:17 -0700 Received: from mx10.gnu.org ([199.232.76.166]:59400) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1Kmtyx-00035W-7B for emacs-pretest-bug@gnu.org; Mon, 06 Oct 2008 13:34:55 -0400 Received: from dsl017-040-091.sea1.dsl.speakeasy.net ([69.17.40.91]:33971 helo=zimbra.evri.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Kmu0y-0004NJ-Pz for emacs-pretest-bug@gnu.org; Mon, 06 Oct 2008 13:37:06 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.evri.com (Postfix) with ESMTP id C707D1A2C008 for ; Mon, 6 Oct 2008 09:59:59 -0700 (PDT) X-Virus-Scanned: amavisd-new at Received: from zimbra.evri.com ([127.0.0.1]) by localhost (zimbra.evri.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dqhnRPFN4K69 for ; Mon, 6 Oct 2008 09:59:58 -0700 (PDT) Received: from pdp10 (unknown [10.75.0.2]) by zimbra.evri.com (Postfix) with ESMTP id 190551A2C007 for ; Mon, 6 Oct 2008 09:59:58 -0700 (PDT) Date: Mon, 06 Oct 2008 09:59:57 -0700 Message-Id: <8763o51wxe.fsf@evri.com> From: Phil Hagelberg To: emacs-pretest-bug@gnu.org Subject: 23.0.60; add-hook should check that its function arg is a function. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Greylist: delayed 2198 seconds by postgrey-1.27 at monty-python; Mon, 06 Oct 2008 13:36:38 EDT add-hook may be called with a function argument that is not a function: (add-hook 'emacs-lisp-mode-hook 22) This is functionally a no-op since run-mode-hooks will ignore such values, but it would probably be better to get an error when add-hook is called. Here's a patch. I'm not sure what the convention is for how these types of error messages should read, so that could be changed. diff --git a/lisp/subr.el b/lisp/subr.el index d62b38b..49e9470 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1132,6 +1132,7 @@ HOOK is void, it is first set to nil. If HOOK's value is a single function, it is changed to a list of functions." (or (boundp hook) (set hook nil)) (or (default-boundp hook) (set-default hook nil)) + (unless (functionp function) (error "`function' argument was not a function")) (if local (unless (local-variable-if-set-p hook) (set (make-local-variable hook) (list t))) ;; Detect the case where make-local-variable was used on a hook In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9) of 2008-09-29 on pdp10 Windowing system distributor `The X.Org Foundation', version 11.0.10400090 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_US.UTF-8 value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Group Minor modes in effect: shell-dirtrack-mode: t jabber-activity-mode: t gnus-topic-mode: t gnus-undo-mode: t show-paren-mode: t recentf-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: o k SPC ' g n u s - a r t i c l e - m o d e - h o o k C-S-h v q SPC ' l o n g l i n e - s - m o d e ) C-S-x C-S-s C-S-x C-S-e C-S-x k C-S-x C-S-o SPC SPC SPC SPC M-x l o n g l i n e s - - m o d e M-x M-p M-< C-S-x o C-S-p C-S-x o C-S-p C-S-n C-S-x o C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-v C-S-v C-S-v SPC SPC SPC SPC SPC C-S-x C-S-o C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n q g p q C-S-n k k k k k k q p n d q g p q p p M-> C-S-p C-S-p C-S-p C-S-n SPC C-S-x o C-S-x o M-u C-S-p q g g p p p p M-> p C-S-x o M-> M-< C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n C-S-n t t C-S-p C-S-p C-S-p C-S-x o C-S-x o ! C-S-p C-S-p M-u q g M-x r e p o r t - e m a c s - b u g Recent messages: Generating summary...done Mark set [3 times] No more articles [2 times] Reading active file via nnnil...done Reading active file via nnml... nnml: Reading incoming mail from file... nnml: Reading incoming mail (no new mail)...done Reading active file via nnml...done Reading active file from archive via nnfolder...done Checking new news...done ------------=_1310237222-3410-1--