Next: Tracing, Previous: Reading in Edebug, Up: Edebug [Contents][Index]
If the result of an expression in your program contains a circular
reference, you may get an error when Edebug attempts to print it. You
can set print-length
to a non-zero value to limit the print
length of lists (the number of cdrs), and in Emacs 19, set
print-level
to a non-zero value to limit the print depth of
lists. But you can print such circular structures and structures that
share elements more informatively by using the cust-print
package.
To load cust-print and activate custom printing only for Edebug, simply use the command M-x edebug-install-custom-print. To restore the standard print functions, use M-x edebug-uninstall-custom-print. You can also activate custom printing for printing in any Lisp code; see the package for details.
Here is an example of code that creates a circular structure:
(progn (edebug-install-custom-print) (setq a '(x y)) (setcar a a))
Edebug will print the result of the setcar
as ‘Result:
#1=(#1# y)’. The ‘#1=’ notation names the structure that follows
it, and the ‘#1#’ notation references the previously named
structure. This notation is used for any shared elements of lists or
vectors.
Independent of whether cust-print is active, while printing
results Edebug binds print-length
, print-level
, and
print-circle
to edebug-print-length
(50
),
edebug-print-level
(50
), and edebug-print-circle
(t
) respectively, if these values are non-nil
. Also,
print-readably
is bound to nil
since some objects simply
cannot be printed readably.