X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fpp-backq.lisp;h=fd1fb13b386c4472a36c4331816740e361d67f26;hb=829ced3e78a23ba153ba4db64e6ea6984c2313b6;hp=c1268d0c5ddef90c54d3e226ea92ad87ce1cd64f;hpb=4898ef32c639b1c7f4ee13a5ba566ce6debd03e6;p=sbcl.git diff --git a/src/code/pp-backq.lisp b/src/code/pp-backq.lisp index c1268d0..fd1fb13 100644 --- a/src/code/pp-backq.lisp +++ b/src/code/pp-backq.lisp @@ -96,14 +96,24 @@ ;; stream, possibly with a space prepended. However, this doesn't ;; work for pretty streams which need to do margin calculations. Oh ;; well. It was good while it lasted. -- CSR, 2003-12-15 - (let ((output (with-output-to-string (s) - (write (cadr form) :stream s)))) - (unless (= (length output) 0) - (when (and (eql (car form) 'backq-comma) + ;; + ;; This is an evil hack. If we print to a string and then print again, + ;; the circularity detection logic behaves as though it's already + ;; printed that data... and it has, to a string stream that we send + ;; to the bitbucket in the sky. -- PK, 2013-03-30 + (when (eql (car form) 'backq-comma) + (let ((output (with-output-to-string (s) + ;; Patching evil with more evil. The next step is + ;; likely to stop the madness and unconditionally + ;; insert a space. + (let (*circularity-hash-table* + *circularity-counter*) + (write (cadr form) :stream s))))) + (when (and (plusp (length output)) (or (char= (char output 0) #\.) (char= (char output 0) #\@))) - (write-char #\Space stream)) - (write (cadr form) :stream stream)))) + (write-char #\Space stream)))) + (write (cadr form) :stream stream)) ;;; This is called by !PPRINT-COLD-INIT, fairly late, because ;;; SET-PPRINT-DISPATCH doesn't work until the compiler works.