Skip to content

Commit 826c841

Browse files
committed
Move %print-unreadable-object
1 parent 7c82ea0 commit 826c841

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/lisp/kernel/lsp/format-pprint.lisp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@
2020

2121
(in-package "SYS")
2222

23+
;;; The guts of print-unreadable-object, inspired by SBCL. This is
24+
;;; a redefinition of the function in iolib.lisp which add support
25+
;;; for pprint-logical-block.
26+
(defun %print-unreadable-object (object stream type identity body)
27+
(cond (*print-readably*
28+
(error 'print-not-readable :object object))
29+
((and *print-pretty* (pretty-stream-p stream))
30+
(pprint-logical-block (stream nil :prefix "#<" :suffix ">")
31+
(print-unreadable-object-contents object stream type identity body)))
32+
(t
33+
(write-string "#<" stream)
34+
(print-unreadable-object-contents object stream type identity body)
35+
(write-char #\> stream)))
36+
nil)
37+
2338
;;;; Format directive definition macros and runtime support.
2439

2540
(defmacro expander-pprint-next-arg (string offset)

0 commit comments

Comments
 (0)