Fix documentation of 'unprintable' stuff

* src/print.c (syms_of_print) <print-unreadable-function>:
* doc/lispref/streams.texi (Input Functions, Output Variables):
Improve the documentation of 'print-unreadable-function' and
'readablep'.  Add indexing and cross-references.
This commit is contained in:
Eli Zaretskii 2022-01-22 16:49:06 +02:00
parent 41846901e2
commit 71b433f035
2 changed files with 13 additions and 11 deletions

View file

@ -359,10 +359,12 @@ non-@code{nil} value and does nothing except flushing pending output.
@end defun
@defun readablep object
This predicate says whether @var{object} can be written out and then
read back by the Emacs Lisp reader. If it can't, this function
returns @code{nil}, and if it can, a printed representation (via
@code{prin1}) of @var{object} is returned.
@cindex readable syntax
This predicate says whether @var{object} has @dfn{readable syntax},
i.e., it can be written out and then read back by the Emacs Lisp
reader. If it can't, this function returns @code{nil}; if it can,
this function returns a printed representation (via @code{prin1},
@pxref{Output Functions}) of @var{object}.
@end defun
@node Output Streams
@ -889,8 +891,8 @@ instance:
@end example
If this variable is non-@code{nil}, it should be a function that will
be called to handle printing of these objects. The first argument is
the object, and the second argument is the @var{noescape} flag used by
be called to handle printing of these objects. The function will be
called with two arguments: the object and the @var{noescape} flag used by
the printing functions (@pxref{Output Functions}).
The function should return either @code{nil} (print nothing), or a

View file

@ -2498,15 +2498,15 @@ priorities. Values other than nil or t are also treated as
staticpro (&print_prune_charset_plist);
DEFVAR_LISP ("print-unreadable-function", Vprint_unreadable_function,
doc: /* Function called when printing unreadable objects.
doc: /* If non-nil, a function to call when printing unreadable objects.
By default, Emacs printing functions (like `prin1') print unreadable
objects like \"#<...>\", where \"...\" describes the object (for
objects as \"#<...>\", where \"...\" describes the object (for
instance, \"#<marker in no buffer>\"). If this variable is non-nil,
it should be a function which will be called to print the object instead.
It will be called with two arguments: The object to be printed, and
noescape (see `prin1-to-string'). If this function returns nil, the
object will be printed as normal. If it returns a string, that string
The function will be called with two arguments: the object to be printed, and
the NOESCAPE flag (see `prin1-to-string'). If this function returns nil, the
object will be printed as usual. If it returns a string, that string
will then be printed. If the function returns anything else, the
object will not be printed. */);
Vprint_unreadable_function = Qnil;