diff options
| author | Stefan Monnier | 2008-04-05 20:22:22 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-04-05 20:22:22 +0000 |
| commit | fc944cd4c504178b0e79f0e443650b07ba38fd6d (patch) | |
| tree | 7fbd8d918b1ed5168bdbc8bd9cd1c74cdf8a9c5f | |
| parent | 0e96e25f477dd68d9cc1e734b85e0123984f30e9 (diff) | |
| download | emacs-fc944cd4c504178b0e79f0e443650b07ba38fd6d.tar.gz emacs-fc944cd4c504178b0e79f0e443650b07ba38fd6d.zip | |
(functionp): Return nil for special forms.
| -rw-r--r-- | doc/lispref/functions.texi | 4 | ||||
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/subr.el | 10 |
4 files changed, 13 insertions, 8 deletions
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}. | |||
| 116 | 116 | ||
| 117 | @defun functionp object | 117 | @defun functionp object |
| 118 | This function returns @code{t} if @var{object} is any kind of | 118 | This function returns @code{t} if @var{object} is any kind of |
| 119 | function, or a special form, or, recursively, a symbol whose function | 119 | function, i.e. can be passed to @code{funcall}. |
| 120 | definition is a function or special form. (This does not include | ||
| 121 | macros.) | ||
| 122 | @end defun | 120 | @end defun |
| 123 | 121 | ||
| 124 | Unlike @code{functionp}, the next three functions do @emph{not} | 122 | Unlike @code{functionp}, the next three functions do @emph{not} |
| @@ -654,6 +654,9 @@ for the list of extra keys that are available. | |||
| 654 | 654 | ||
| 655 | * Incompatible Lisp Changes in Emacs 23.1 | 655 | * Incompatible Lisp Changes in Emacs 23.1 |
| 656 | 656 | ||
| 657 | ** `functionp' returns nil for special forms. | ||
| 658 | I.e. it only returns t for objects that can be passed `funcall'. | ||
| 659 | |||
| 657 | +++ | 660 | +++ |
| 658 | ** The multibyteness of process filters is determined by the coding-system | 661 | ** The multibyteness of process filters is determined by the coding-system |
| 659 | used for decoding. The functions `process-filter-multibyte-p' and | 662 | 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 @@ | |||
| 1 | 2008-04-05 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * subr.el (functionp): Return nil for special forms. | ||
| 4 | |||
| 1 | 2008-04-05 Glenn Morris <rgm@gnu.org> | 5 | 2008-04-05 Glenn Morris <rgm@gnu.org> |
| 2 | 6 | ||
| 3 | * emacs-lisp/autoload.el (autoload-ensure-default-file): | 7 | * 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." | |||
| 231 | (eq (car object) 'frame-configuration))) | 231 | (eq (car object) 'frame-configuration))) |
| 232 | 232 | ||
| 233 | (defun functionp (object) | 233 | (defun functionp (object) |
| 234 | "Non-nil if OBJECT is any kind of function or a special form. | 234 | "Non-nil if OBJECT is a function." |
| 235 | Also non-nil if OBJECT is a symbol and its function definition is | ||
| 236 | \(recursively) a function or special form. This does not include | ||
| 237 | macros." | ||
| 238 | (or (and (symbolp object) (fboundp object) | 235 | (or (and (symbolp object) (fboundp object) |
| 239 | (condition-case nil | 236 | (condition-case nil |
| 240 | (setq object (indirect-function object)) | 237 | (setq object (indirect-function object)) |
| 241 | (error nil)) | 238 | (error nil)) |
| 242 | (eq (car-safe object) 'autoload) | 239 | (eq (car-safe object) 'autoload) |
| 243 | (not (car-safe (cdr-safe (cdr-safe (cdr-safe (cdr-safe object))))))) | 240 | (not (car-safe (cdr-safe (cdr-safe (cdr-safe (cdr-safe object))))))) |
| 244 | (subrp object) (byte-code-function-p object) | 241 | (and (subrp object) |
| 242 | ;; Filter out special forms. | ||
| 243 | (not (eq 'unevalled (cdr (subr-arity object))))) | ||
| 244 | (byte-code-function-p object) | ||
| 245 | (eq (car-safe object) 'lambda))) | 245 | (eq (car-safe object) 'lambda))) |
| 246 | 246 | ||
| 247 | ;;;; List functions. | 247 | ;;;; List functions. |