summaryrefslogtreecommitdiff
path: root/scheme/racket
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-08-20 06:15:04 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-08-20 06:15:04 +0200
commit9b31ffba524337003c00a62997a27a62a270100e (patch)
tree592513ebd9900ba995cec3a5ee44d18db9fa7584 /scheme/racket
parent040f2c628c09efd64a100e47fe134d6f7a65caf2 (diff)
downloadgeiser-guile-9b31ffba524337003c00a62997a27a62a270100e.tar.gz
geiser-guile-9b31ffba524337003c00a62997a27a62a270100e.tar.bz2
Racket: configurable image cache directory
Brought to you by a comma-command in the REPL and the REPL startup function.
Diffstat (limited to 'scheme/racket')
-rw-r--r--scheme/racket/geiser/user.rkt11
1 files changed, 10 insertions, 1 deletions
diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt
index 38eefd8..5d3ab32 100644
--- a/scheme/racket/geiser/user.rkt
+++ b/scheme/racket/geiser/user.rkt
@@ -79,6 +79,9 @@
[(geiser-eval) (geiser-eval)]
[(geiser-no-values) (datum->syntax #f (void))]
[(add-to-load-path) (add-to-load-path (read))]
+ [(set-image-cache) (image-cache (read))]
+ [(image-cache) (image-cache)]
+ [(gcd) (current-directory)]
[(cd) (current-directory (read))]
[else form])]
[_ form])))
@@ -88,12 +91,18 @@
(printf "racket@~a> "
(namespace->module-name (current-namespace) (last-entered)))))
+(define image-cache
+ (let ([ensure-dir (lambda (dir)
+ (and (path-string? dir)
+ (begin (make-directory* dir) dir)))])
+ (make-parameter #f ensure-dir)))
+
(define (geiser-prompt-read prompt)
(make-repl-reader (geiser-read prompt)))
(define (geiser-save-tmpimage imgbytes)
;; Save imgbytes to a new temporary file and return the filename
- (define filename (make-temporary-file "geiser-img-~a.png"))
+ (define filename (make-temporary-file "geiser-img-~a.png" #f (image-cache)))
(with-output-to-file filename #:exists 'truncate
(lambda () (display imgbytes)))
filename)