X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fpcl%2Fprint-object.lisp;h=7711dab7fd336028ec925f4e856645b5fa6c4f09;hb=HEAD;hp=df187c37d32f3c659ee87b15e2c3b79e6ae2e1b2;hpb=90c2b0563695904419451b6172efcf9c7008ad8b;p=sbcl.git diff --git a/src/pcl/print-object.lisp b/src/pcl/print-object.lisp index df187c3..7711dab 100644 --- a/src/pcl/print-object.lisp +++ b/src/pcl/print-object.lisp @@ -46,7 +46,10 @@ (fmakunbound 'print-object) (defgeneric print-object (object stream)) (defmethod print-object ((x t) stream) - (print-unreadable-object (x stream :type t :identity t)))) + (if *print-pretty* + (pprint-logical-block (stream nil) + (print-unreadable-object (x stream :type t :identity t))) + (print-unreadable-object (x stream :type t :identity t))))) (/show0 "done replacing placeholder PRINT-OBJECT with DEFGENERIC") ;;;; a hook called by the printer to take care of dispatching to PRINT-OBJECT @@ -102,15 +105,11 @@ (defun named-object-print-function (instance stream &optional (extra nil extra-p)) - (print-unreadable-object (instance stream :type t) - (if extra-p - (format stream - "~S ~:S" - (slot-value-or-default instance 'name) - extra) - (format stream - "~S" - (slot-value-or-default instance 'name))))) + (let ((name (slot-value-or-default instance 'name))) + (print-unreadable-object (instance stream :type t :identity (not name)) + (if extra-p + (format stream "~S ~:S" name extra) + (format stream "~S" name))))) (defmethod print-object ((class class) stream) (named-object-print-function class stream)) @@ -147,3 +146,8 @@ (defmethod print-object ((dfun-info dfun-info) stream) (declare (type stream stream)) (print-unreadable-object (dfun-info stream :type t :identity t))) + +(defmethod print-object ((ctor ctor) stream) + (print-unreadable-object (ctor stream :type t) + (format stream "~S ~:S" (ctor-class-or-name ctor) (ctor-initargs ctor))) + ctor)