[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-racket 3079c3a 163/191: Racket: displaying graphics
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-racket 3079c3a 163/191: Racket: displaying graphics in structured objects |
Date: |
Sun, 1 Aug 2021 18:32:21 -0400 (EDT) |
branch: elpa/geiser-racket
commit 3079c3a163ae68378f93f163c92d284c2e4d365b
Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
Racket: displaying graphics in structured objects
By hooking the pretty-printer, as discovered by Greg in issue #49. To
attain nirvana, we would still need (display (list graph)) to work...
---
geiser/images.rkt | 15 ++++++++++++++-
geiser/user.rkt | 8 ++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/geiser/images.rkt b/geiser/images.rkt
index 2cdcadb..b97546f 100644
--- a/geiser/images.rkt
+++ b/geiser/images.rkt
@@ -17,7 +17,9 @@
(provide image-cache
maybe-print-image
maybe-write-image
- make-port-print-handler)
+ make-port-print-handler
+ make-pretty-print-size-hook
+ make-pretty-print-print-hook)
(define image-cache
(let ([ensure-dir (lambda (dir)
@@ -51,3 +53,14 @@
(define (make-port-print-handler ph)
(lambda (value port . rest)
(apply ph (or (maybe-save-image value) value) port rest)))
+
+(define (make-pretty-print-size-hook [orig (pretty-print-size-hook)])
+ (lambda (value display? port)
+ (if (convertible? value)
+ (pretty-print-columns)
+ (orig value display? port))))
+
+(define (make-pretty-print-print-hook [orig (pretty-print-print-hook)])
+ (lambda (value display? port)
+ (let [(img (maybe-save-image value))]
+ (if img (print img port) (orig value display? port)))))
diff --git a/geiser/user.rkt b/geiser/user.rkt
index c566309..b936219 100644
--- a/geiser/user.rkt
+++ b/geiser/user.rkt
@@ -126,7 +126,9 @@
(define (install-print-handlers)
(for-each install-print-handler (list port-print-handler
port-write-handler
- port-display-handler)))
+ port-display-handler))
+ (pretty-print-print-hook (make-pretty-print-print-hook))
+ (pretty-print-size-hook (make-pretty-print-size-hook)))
(define (init-geiser-repl)
(compile-enforce-module-constants #f)
@@ -143,7 +145,9 @@
(current-error-port out)
(current-load/use-compiled (geiser-loader))
(current-prompt-read (geiser-prompt-read geiser-prompt))
- (current-print maybe-print-image)]
+ (current-print maybe-print-image)
+ (pretty-print-print-hook (make-pretty-print-print-hook))
+ (pretty-print-size-hook (make-pretty-print-size-hook))]
(install-print-handlers)
(preload-help)
(read-eval-print-loop)))
- [nongnu] elpa/geiser-racket 309ca6d 069/191: Racket: more information in symbol documentation, (continued)
- [nongnu] elpa/geiser-racket 309ca6d 069/191: Racket: more information in symbol documentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket a787a26 071/191: Bug fix: don't intern symbols read by scheme reader, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket c4b8c1a 080/191: Racket: geiser-add-to-load-path implemented, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket a9405d0 095/191: Racket: reading into elisp-land the cache dir as needed, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 20cc118 083/191: Leftover code from the previous patch removed, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket ce1f555 085/191: Racket: capturing and displaying standard error during evaluation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket c9008a6 091/191: [WIP] Draw images inline in the Racket REPL., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 62e2006 114/191: Indentation for Racket's struct, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 0be1797 122/191: A better solution to the funky filename problem, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket e17099e 166/191: Skip expression quote when getting a racket symbol, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 3079c3a 163/191: Racket: displaying graphics in structured objects,
Philip Kaludercic <=
- [nongnu] elpa/geiser-racket c0a617f 173/191: Begin the summary lines of all elisp libraries with three semicolons, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 99acb21 175/191: Fix indentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 6bc2bc2 176/191: Fix indentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 74a223e 008/191: Racket: autodoc for struct constructors, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 4c3903a 063/191: Better module help, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 1f64738 066/191: Racket: showing submodules in module help, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 1f2bc48 070/191: Racket: more information in symbol documentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket cd7378b 089/191: Racket: indentation for all 'for' forms, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket 41f65a1 076/191: Fixes for locals scanning, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-racket d0d80d8 079/191: Racket: no errors , entering an R5RS module, Philip Kaludercic, 2021/08/01