From: Stefan Monnier Date: Sat, 5 Apr 2008 20:22:22 +0000 (+0000) Subject: (functionp): Return nil for special forms. X-Git-Tag: emacs-pretest-23.0.90~6522 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fc944cd4c504178b0e79f0e443650b07ba38fd6d;p=emacs.git (functionp): Return nil for special forms. --- diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi index 40a3d3ec38b..3a891db871e 100644 --- a/doc/lispref/functions.texi +++ b/doc/lispref/functions.texi @@ -116,9 +116,7 @@ byte compiler. @xref{Byte-Code Type}. @defun functionp object This function returns @code{t} if @var{object} is any kind of -function, or a special form, or, recursively, a symbol whose function -definition is a function or special form. (This does not include -macros.) +function, i.e. can be passed to @code{funcall}. @end defun Unlike @code{functionp}, the next three functions do @emph{not} diff --git a/etc/NEWS b/etc/NEWS index 37786df831c..0e88ea6cffb 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -654,6 +654,9 @@ for the list of extra keys that are available. * Incompatible Lisp Changes in Emacs 23.1 +** `functionp' returns nil for special forms. +I.e. it only returns t for objects that can be passed `funcall'. + +++ ** The multibyteness of process filters is determined by the coding-system used for decoding. The functions `process-filter-multibyte-p' and diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7f858a3f98f..15af42d6fc7 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2008-04-05 Stefan Monnier + + * subr.el (functionp): Return nil for special forms. + 2008-04-05 Glenn Morris * emacs-lisp/autoload.el (autoload-ensure-default-file): diff --git a/lisp/subr.el b/lisp/subr.el index a8fcfb67bb4..94ee316f9f4 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -231,17 +231,17 @@ configuration." (eq (car object) 'frame-configuration))) (defun functionp (object) - "Non-nil if OBJECT is any kind of function or a special form. -Also non-nil if OBJECT is a symbol and its function definition is -\(recursively) a function or special form. This does not include -macros." + "Non-nil if OBJECT is a function." (or (and (symbolp object) (fboundp object) (condition-case nil (setq object (indirect-function object)) (error nil)) (eq (car-safe object) 'autoload) (not (car-safe (cdr-safe (cdr-safe (cdr-safe (cdr-safe object))))))) - (subrp object) (byte-code-function-p object) + (and (subrp object) + ;; Filter out special forms. + (not (eq 'unevalled (cdr (subr-arity object))))) + (byte-code-function-p object) (eq (car-safe object) 'lambda))) ;;;; List functions.