The assumption here seems to be that, is if the output port can write "specials", then we're running under Dr Racket:
|
;; exact fractions - slight hack as we know for what numbers DrRacket generates special snips |
|
(define (use-number-markup? x) |
|
(and (number? x) |
|
(exact? x) |
|
(real? x) |
|
(not (integer? x)))) |
|
|
|
(define fraction-view |
|
(case (sl-runtime-settings-fraction-style settings) |
|
[(mixed-fraction mixed-fraction-e) 'mixed] |
|
[(repeating-decimal repeating-decimal-e) 'decimal])) |
|
|
|
(pretty-print-show-inexactness #t) |
|
(pretty-print-exact-as-decimal (eq? fraction-view 'decimal)) |
|
|
|
(pretty-print-print-hook |
|
(let ([oh (pretty-print-print-hook)]) |
|
(λ (val display? port) |
|
(cond |
|
[(and (not (port-writes-special? port)) |
|
(is-image? val)) |
|
(display img-str port)] |
|
[(and (use-number-markup? val) |
|
(port-writes-special? port)) |
|
(write-special (number val #:exact-prefix 'never #:inexact-prefix 'always #:fraction-view fraction-view) port)] |
However that's not necessarily true. Racket Mode presents an output port that accepts write-special. Therefore it ends up getting these number-markup structs. It had been surprised by these, ergo greghendershott/racket-mode#732.
I merged an accommodation for that, today. But generally, it seems like port-writes-special? isn't a sufficient test for "port that knows how to handle number-markup structs, and will end up in a snip in the DrRacket GUI"? I don't know enough to propose a better test, but I wanted to ask.
The assumption here seems to be that, is if the output port can write "specials", then we're running under Dr Racket:
htdp/htdp-lib/htdp/bsl/runtime.rkt
Lines 112 to 136 in aef9ae1
However that's not necessarily true. Racket Mode presents an output port that accepts
write-special. Therefore it ends up getting thesenumber-markupstructs. It had been surprised by these, ergo greghendershott/racket-mode#732.I merged an accommodation for that, today. But generally, it seems like
port-writes-special?isn't a sufficient test for "port that knows how to handlenumber-markupstructs, and will end up in a snip in the DrRacket GUI"? I don't know enough to propose a better test, but I wanted to ask.