emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4f27e4ff02: functionp doc improvement


From: Paul Eggert
Subject: master 4f27e4ff02: functionp doc improvement
Date: Wed, 11 May 2022 13:18:20 -0400 (EDT)

branch: master
commit 4f27e4ff02d9d96b5cfbd196dd724e4a056cd8ef
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    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.
---
 doc/lispref/eval.texi      | 2 +-
 doc/lispref/functions.texi | 7 ++++++-
 src/eval.c                 | 8 +++++---
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index e94e222e6a..ed3cf56e09 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -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.
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 2f386eaa47..55bbf8fd5a 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -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
diff --git a/src/eval.c b/src/eval.c
index 950338bf79..29c122e2fb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]