1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-24 07:20:37 +00:00

functionp doc improvement

* doc/lispref/eval.texi, doc/lispref/functions.texi, src/eval.c:
Document functionp a bit more carefully.  It can return t
on non-functions.
This commit is contained in:
Paul Eggert 2022-05-11 10:13:09 -07:00
parent 678e05e851
commit 4f27e4ff02
3 changed files with 12 additions and 5 deletions

View File

@ -435,7 +435,7 @@ expansion.
@cindex forms, special
@cindex evaluation of special forms
A @dfn{special form} is a primitive function specially marked so that
A @dfn{special form} is a primitive specially marked so that
its arguments are not all evaluated. Most special forms define control
structures or perform variable bindings---things which functions cannot
do.

View File

@ -146,7 +146,12 @@ function:
This function returns @code{t} if @var{object} is any kind of
function, i.e., can be passed to @code{funcall}. Note that
@code{functionp} returns @code{t} for symbols that are function names,
and returns @code{nil} for special forms.
and returns @code{nil} for symbols that are macros or special forms.
If @var{object} is not a function, this function ordinarily returns
@code{nil}. However, the representation of function objects is
complicated, and for efficiency reasons in rare cases this function
can return @code{t} even when @var{object} is not a function.
@end defun
It is also possible to find out how many arguments an arbitrary

View File

@ -2805,9 +2805,11 @@ apply1 (Lisp_Object fn, Lisp_Object arg)
DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
doc: /* Return t if OBJECT is a function.
An object is a function if it is callable via `funcall';
this includes primitive functions, byte-code functions, closures, and
symbols with function bindings. */)
An object is a function if it is callable via `funcall'; this includes
symbols with function bindings, but excludes macros and special forms.
Ordinarily return nil if OBJECT is not a function, although t might be
returned in rare cases. */)
(Lisp_Object object)
{
if (FUNCTIONP (object))