changeset 40830:576a1771ec55

(functionp): Make work correctly for macros and unbound symbols.
author Miles Bader <miles@gnu.org>
date Thu, 08 Nov 2001 12:08:51 +0000
parents b6c0d7203b48
children 900b6d76feac
files lisp/subr.el
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/subr.el	Thu Nov 08 12:03:10 2001 +0000
+++ b/lisp/subr.el	Thu Nov 08 12:08:51 2001 +0000
@@ -1534,11 +1534,16 @@
 
 (defun functionp (object)
   "Non-nil iff OBJECT is a type of object that can be called as a function."
-  (or (and (symbolp object) (setq object (indirect-function object))
+  (or (and (symbolp object)
+	   (fboundp object)
+	   (setq object (indirect-function object))
 	   (eq (car-safe object) 'autoload)
-	   (not (car-safe (cdr-safe (cdr-safe (cdr-safe (cdr-safe object)))))))
+	   (not (eq (car-safe
+		     (cdr-safe (cdr-safe (cdr-safe (cdr-safe object)))))
+		    'keymap)))
       (subrp object) (byte-code-function-p object)
-      (eq (car-safe object) 'lambda)))
+      (eq (car-safe object) 'lambda)
+      (eq (car-safe object) 'macro)))
 
 (defun interactive-form (function)
   "Return the interactive form of FUNCTION.