The previous section (see Variables Affecting Output) lists the numerous
variables that control how the Emacs Lisp printer formats data for
outputs. These are generally available for users to change, but
sometimes you want to output data in the default format, or override
the user settings in some other way. For instance, if you’re storing
Emacs Lisp data in a file, you don’t want that data to be shortened by
a print-length setting.
The prin1 and prin1-to-string functions therefore have
an optional overrides argument. This argument can either be
t (which means that all printing variables should be reset to
the default values), or a list of settings for some of the variables.
Each element in the list can be either t (which means “reset
to defaults”, and will usually be the first element of the list), or
a pair whose car is a symbol that stands for an output variable
and whose cdr is the value for that variable.
For instance, this prints using nothing but defaults:
(prin1 object nil t)
This prints object using the current printing settings, but
overrides the value of print-length to be 5:
(prin1 object nil '((length . 5)))
And finally, this prints object using only default settings, but
with print-length bound to 5:
(prin1 object nil '(t (length . 5)))
Below is a list of symbols that can be used, and which variables they map to:
lengthThis overrides print-length.
levelThis overrides print-level.
circleThis overrides print-circle.
quotedThis overrides print-quoted.
escape-newlinesThis overrides print-escape-newlines.
escape-control-charactersThis overrides print-escape-control-characters.
escape-nonasciiThis overrides print-escape-nonascii.
escape-multibyteThis overrides print-escape-multibyte.
charset-text-propertyThis overrides print-charset-text-property.
unreadeable-functionThis overrides print-unreadable-function.
gensymThis overrides print-gensym.
continuous-numberingThis overrides print-continuous-numbering.
number-tableThis overrides print-number-table.
float-formatThis overrides float-output-format.
integers-as-charactersThis overrides print-integers-as-characters.
In the future, more overrides may be offered that do not map directly to a variable, but can only be used via this parameter.