~ chicken-core (chicken-5) 938b33f44d0bc06131e215fd6a70712501b1af53


commit 938b33f44d0bc06131e215fd6a70712501b1af53
Author:     Peter Bex <peter@more-magic.net>
AuthorDate: Thu Nov 19 16:51:25 2015 +0100
Commit:     Evan Hanson <evhan@foldling.org>
CommitDate: Thu Nov 19 16:51:25 2015 +0100

    Make ##sys#with-print-limit a bit more consistent
    
    This fixes #951, for the most part.
    
    Signed-off-by: Evan Hanson <evhan@foldling.org>

diff --git a/library.scm b/library.scm
index 4ef566c0..2148c1d2 100644
--- a/library.scm
+++ b/library.scm
@@ -3142,8 +3142,7 @@ EOF
 (define ##sys#print-exit (make-parameter #f))
 
 (define ##sys#print
-  (let ((string-append string-append)
-	(case-sensitive case-sensitive)
+  (let ((case-sensitive case-sensitive)
 	(keyword-style keyword-style))
     (lambda (x readable port)
       (##sys#check-output-port port #t #f)
@@ -3157,12 +3156,11 @@ EOF
 	      (let* ((len (##sys#size str))
 		     (cpp0 (current-print-length))
 		     (cpl (fx+ cpp0 len)) )
-		(if (fx>= cpl length-limit)
-		    (cond ((fx> len 3)
-			   (let ((n (fx- length-limit cpp0)))
-			     (when (fx> n 0) (outstr0 port (##sys#substring str 0 n)))
-			     (outstr0 port "...") ) )
-			  (else (outstr0 port str)) )
+		(if (fx> cpl length-limit)
+		    (let ((n (fx- length-limit cpp0)))
+		      (when (fx> n 0) (outstr0 port (##sys#substring str 0 n)))
+		      (outstr0 port "...")
+		      ((##sys#print-exit) (##sys#void)))
 		    (outstr0 port str) )
 		(current-print-length cpl) )
 	      (outstr0 port str) ) )
@@ -3176,7 +3174,7 @@ EOF
 	      (current-print-length (fx+ cpp0 1))
 	      (when (fx>= cpp0 length-limit)
 		(outstr0 port "...")
-		((##sys#print-exit) #t) )))
+		((##sys#print-exit) (##sys#void)))))
 	  ((##sys#slot (##sys#slot port 2) 2) port chr))
 
 	(define (specialchar? chr)
Trap