Previous: , Up: Read and Print   [Contents][Index]


23.6 Variables Affecting Output

Variable: standard-output

The value of this variable is the default output stream—the stream that print functions use when the stream argument is nil.

Variable: print-escape-newlines

If this variable is non-nil, then newline characters in strings are printed as ‘\n’ and formfeeds are printed as ‘\f’. Normally these characters are printed as actual newlines and formfeeds.

This variable affects the print functions prin1 and print, as well as everything that uses them. It does not affect princ. Here is an example using prin1:

(prin1 "a\nb")
     -| "a
     -| b"
     ⇒ "a
b"
(let ((print-escape-newlines t))
  (prin1 "a\nb"))
     -| "a\nb"
     ⇒ "a
b"

In the second expression, the local binding of print-escape-newlines is in effect during the call to prin1, but not during the printing of the result.

Variable: print-readably

If non-nil, then all objects will be printed in a readable form. If an object has no readable representation, then an error is signalled. When print-readably is true, compiled-function objects will be written in ‘#[...]’ form instead of in ‘#<compiled-function [...]>’ form, and two-element lists of the form ‘(quote object)’ will be written as the equivalent ‘'object’. Do not set this variable; bind it instead.

Variable: print-length

The value of this variable is the maximum number of elements of a list that will be printed. If a list being printed has more than this many elements, it is abbreviated with an ellipsis.

If the value is nil (the default), then there is no limit.

(setq print-length 2)
     ⇒ 2
(print '(1 2 3 4 5))
     -| (1 2 ...)
     ⇒ (1 2 ...)
Variable: print-level

The value of this variable is the maximum depth of nesting of parentheses and brackets when printed. Any list or vector at a depth exceeding this limit is abbreviated with an ellipsis. A value of nil (which is the default) means no limit.

This variable exists in version 19 and later versions.

Variable: print-string-length

The value of this variable is the maximum number of characters of a string that will be printed. If a string being printed has more than this many characters, it is abbreviated with an ellipsis.

Variable: print-gensym

If non-nil, then uninterned symbols will be printed specially. Uninterned symbols are those which are not present in obarray, that is, those which were made with make-symbol or by calling intern with a second argument.

When print-gensym is true, such symbols will be preceded by ‘#:’, which causes the reader to create a new symbol instead of interning and returning an existing one. Beware: The ‘#:’ syntax creates a new symbol each time it is seen, so if you print an object which contains two pointers to the same uninterned symbol, read will not duplicate that structure.

Also, since SXEmacs has no real notion of packages, there is no way for the printer to distinguish between symbols interned in no obarray, and symbols interned in an alternate obarray.

Variable: float-output-format

This variable holds the format descriptor string that Lisp uses to print floats. This is a ‘%’-spec like those accepted by printf in C, but with some restrictions. It must start with the two characters ‘%.’. After that comes an integer precision specification, and then a letter which controls the format. The letters allowed are ‘e’, ‘f’ and ‘g’.

The precision in any of these cases is the number of digits following the decimal point. With ‘f’, a precision of 0 means to omit the decimal point. 0 is not allowed with ‘f’ or ‘g’.

A value of nil means to use ‘%.16g’.

Regardless of the value of float-output-format, a floating point number will never be printed in such a way that it is ambiguous with an integer; that is, a floating-point number will always be printed with a decimal point and/or an exponent, even if the digits following the decimal point are all zero. This is to preserve read-equivalence.


Previous: , Up: Read and Print   [Contents][Index]