From fa37ab8800978c9dd39b587cb3cdeef6c9e9ded9 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Mon, 11 Oct 2010 14:29:13 +0000 Subject: [PATCH] 1.0.43.41: TYPE-ERROR printing tweak for *PRINT-ESCAPE* = T Print as # when possible. Virtually every time I see a TYPE-ERROR printed with *PRINT-ESCAPE* = T I need to go look for the place where it is printed in order to see what the actual problem is -- and I don't think I'm the only one. This is hopefully one annoyance less. --- src/code/condition.lisp | 13 +++++++++++++ version.lisp-expr | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/code/condition.lisp b/src/code/condition.lisp index 35603bc..541ab58 100644 --- a/src/code/condition.lisp +++ b/src/code/condition.lisp @@ -620,6 +620,19 @@ (type-error-datum condition) (type-error-expected-type condition))))) +(def!method print-object ((condition type-error) stream) + (if *print-escape* + (flet ((maybe-string (thing) + (ignore-errors + (write-to-string thing :lines 1 :readably nil :array nil :pretty t)))) + (let ((type (maybe-string (type-error-expected-type condition))) + (datum (maybe-string (type-error-datum condition)))) + (if (and type datum) + (print-unreadable-object (condition stream :type t) + (format stream "~@" type datum)) + (call-next-method)))) + (call-next-method))) + ;;; not specified by ANSI, but too useful not to have around. (define-condition simple-style-warning (simple-condition style-warning) ()) (define-condition simple-type-error (simple-condition type-error) ()) diff --git a/version.lisp-expr b/version.lisp-expr index bb57b58..eb5fa2a 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.43.40" +"1.0.43.41" -- 1.7.10.4