Skip to content

Commit b0e5f05

Browse files
Rename some things; improve some comment prose
1 parent 7c1f793 commit b0e5f05

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

racket/print.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
racket/pretty
88
"image.rkt"
99
(only-in "repl-output.rkt"
10-
repl-output-print-value?))
10+
print-images-as-specials?))
1111

1212
(provide make-pretty-global-port-print-handler)
1313

1414
(define (make-pretty-global-port-print-handler columns pixels/char)
1515
(define (racket-mode-pretty-global-port-print-handler v out [depth 0])
1616
(unless (void? v)
17-
(if (repl-output-print-value?)
17+
(if (print-images-as-specials?)
1818
(parameterize ([print-syntax-width +inf.0]
1919
[pretty-print-columns columns]
2020
[pretty-print-size-hook (size-hook pixels/char)]

racket/repl-output.rkt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@
1515
repl-output-run
1616
repl-output-prompt
1717
repl-output-exit
18-
repl-output-value
19-
repl-output-value-special
2018
make-repl-output-manager
2119
make-repl-output-port
2220
make-repl-error-port
2321
repl-error-port?
24-
repl-output-print-value?)
22+
print-images-as-specials?)
2523

2624
;;; REPL output
2725

@@ -188,10 +186,12 @@
188186
(port-print-handler out (make-value-pipe-handler))
189187
out)
190188

191-
;; A flag for our global-port-print-handler (see print.rkt) that it's
192-
;; being used for a REPL output port and that it should convert
193-
;; images (which isn't appropriate to do for ports generally).
194-
(define repl-output-print-value? (make-parameter #f))
189+
;; A flag set by the port-print-handler for our repl-output-port.
190+
;; Intended for use by our global-port-print-handler (see print.rkt).
191+
;; When true, use racket/convert to write-special image values as
192+
;; (cons 'image image-file-path-name) -- which obviously isn't
193+
;; appropriate to do for ports generally.
194+
(define print-images-as-specials? (make-parameter #f))
195195

196196
;; We want to avoid many calls to repl-output-value with short
197197
;; strings. This can happen for example with pretty-print, which does
@@ -213,9 +213,9 @@
213213
;; print handler does pretty printing.
214214
(define outermost? (make-parameter #t))
215215
(define-values (pin pout) (make-value-pipe))
216-
(define (handler v _out [depth 0])
216+
(define (racket-repl-output-port-handler v _out [depth 0])
217217
(parameterize ([outermost? #f]
218-
[repl-output-print-value? #t])
218+
[print-images-as-specials? #t])
219219
(match (convert-image v #:remove-from-cache? #t)
220220
[(cons path-name _pixel-width)
221221
(write-special (cons 'image path-name) pout)]
@@ -224,7 +224,7 @@
224224
(when (outermost?)
225225
(drain-value-pipe pin pout)
226226
(set!-values (pin pout) (make-value-pipe))))
227-
handler)
227+
racket-repl-output-port-handler)
228228

229229
(define (make-value-pipe)
230230
(make-pipe-with-specials))

0 commit comments

Comments
 (0)