Update the documentation of void functions

* doc/lispref/functions.texi (Function Cells):
* src/data.c (Ffboundp, Ffmakunbound, Fsymbol_function): Update
documentation to the changes of how void functions are represented
since Emacs 24.5.  (Bug#73886)
This commit is contained in:
Eli Zaretskii 2024-10-27 13:16:36 +02:00
parent 299a1f2407
commit b0aaee93fd
2 changed files with 18 additions and 18 deletions

View file

@ -1511,9 +1511,9 @@ indirect-function}.
This returns the object in the function cell of @var{symbol}. It does This returns the object in the function cell of @var{symbol}. It does
not check that the returned object is a legitimate function. not check that the returned object is a legitimate function.
If the function cell is void, the return value is @code{nil}. To If the function cell is void, the return value is @code{nil}. It is
distinguish between a function cell that is void and one set to impossible to distinguish between a function cell that is void and one
@code{nil}, use @code{fboundp} (see below). set to @code{nil}.
@example @example
@group @group
@ -1538,24 +1538,24 @@ that that symbol's function cell is @dfn{void}. In other words, the
function cell does not have any Lisp object in it. If you try to call function cell does not have any Lisp object in it. If you try to call
the symbol as a function, Emacs signals a @code{void-function} error. the symbol as a function, Emacs signals a @code{void-function} error.
Note that void is not the same as @code{nil} or the symbol Unlike with void variables (@pxref{Void Variables}), a symbol's
@code{void}. The symbols @code{nil} and @code{void} are Lisp objects, function cell that contains @code{nil} is indistinguishable from the
and can be stored into a function cell just as any other object can be function's being void. Note that void is not the same as the symbol
(and @code{void} can be a valid function if you define it with @code{void}: @code{void} can be a valid function if you define it with
@code{defun}). A void function cell contains no object whatsoever. @code{defun}.
You can test the voidness of a symbol's function definition with You can test the voidness of a symbol's function definition with
@code{fboundp}. After you have given a symbol a function definition, you @code{fboundp}. After you have given a symbol a function definition, you
can make it void once more using @code{fmakunbound}. can make it void once more using @code{fmakunbound}.
@defun fboundp symbol @defun fboundp symbol
This function returns @code{t} if the symbol has an object in its This function returns @code{t} if the symbol has a non-@code{nil} object
function cell, @code{nil} otherwise. It does not check that the object in its function cell, @code{nil} otherwise. It does not check that the
is a legitimate function. object is a legitimate function.
@end defun @end defun
@defun fmakunbound symbol @defun fmakunbound symbol
This function makes @var{symbol}'s function cell void, so that a This function makes @var{symbol}'s function cell @code{nil}, so that a
subsequent attempt to access this cell will cause a subsequent attempt to access this cell will cause a
@code{void-function} error. It returns @var{symbol}. (See also @code{void-function} error. It returns @var{symbol}. (See also
@code{makunbound}, in @ref{Void Variables}.) @code{makunbound}, in @ref{Void Variables}.)

View file

@ -756,7 +756,7 @@ global value outside of any lexical scope. */)
breaking backward compatibility, as some users of fboundp may breaking backward compatibility, as some users of fboundp may
expect t in particular, rather than any true value. */ expect t in particular, rather than any true value. */
DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0, DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
doc: /* Return t if SYMBOL's function definition is not void. */) doc: /* Return t if SYMBOL's function definition is neither void nor nil. */)
(Lisp_Object symbol) (Lisp_Object symbol)
{ {
CHECK_SYMBOL (symbol); CHECK_SYMBOL (symbol);
@ -782,12 +782,12 @@ See also `fmakunbound'. */)
} }
DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0, DEFUN ("fmakunbound", Ffmakunbound, Sfmakunbound, 1, 1, 0,
doc: /* Make SYMBOL's function definition be void. doc: /* Make SYMBOL's function definition be nil.
Return SYMBOL. Return SYMBOL.
If a function definition is void, trying to call a function by that If a function definition is nil or void, trying to call a function by
name will cause a `void-function' error. For more details, see Info that name will cause a `void-function' error. For more details, see
node `(elisp) Function Cells'. Info node `(elisp) Function Cells'.
See also `makunbound'. */) See also `makunbound'. */)
(register Lisp_Object symbol) (register Lisp_Object symbol)
@ -800,7 +800,7 @@ See also `makunbound'. */)
} }
DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0, DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
doc: /* Return SYMBOL's function definition, or nil if that is void. */) doc: /* Return SYMBOL's function definition, or nil if that is void or nil. */)
(Lisp_Object symbol) (Lisp_Object symbol)
{ {
CHECK_SYMBOL (symbol); CHECK_SYMBOL (symbol);