GNU bug report logs - #1102
23.0.60; add-hook should check that its function arg is a function.

Previous Next

Package: emacs;

Reported by: Phil Hagelberg <phil <at> hagelb.org>

Date: Mon, 6 Oct 2008 17:45:03 UTC

Severity: wishlist

Tags: wontfix

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Phil Hagelberg <phil <at> hagelb.org>
To: 1102 <at> debbugs.gnu.org
Subject: bug#1102: Modification of patch
Date: Mon, 06 Oct 2008 11:24:22 -0700
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




This bug report was last modified 14 years and 13 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.