summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-30 04:54:59 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-30 04:54:59 +0200
commitd89131b0ff58fb6d8d12fa0404f2b0d26e964d72 (patch)
treecbd8cacd0adfb4ba779ce1c2e025bbeabd42305d
parent13f8a9c96e791d9f3ea1b0b73e77d2497b5e95a9 (diff)
downloadgeiser-chez-d89131b0ff58fb6d8d12fa0404f2b0d26e964d72.tar.gz
geiser-chez-d89131b0ff58fb6d8d12fa0404f2b0d26e964d72.tar.bz2
Racket: new meta-commands: ,eval ,apply ,no-values
-rw-r--r--scheme/racket/geiser/user.rkt24
1 files changed, 20 insertions, 4 deletions
diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt
index b476de4..272fcd9 100644
--- a/scheme/racket/geiser/user.rkt
+++ b/scheme/racket/geiser/user.rkt
@@ -13,7 +13,7 @@
(provide enter!)
-(require geiser/enter geiser/eval (for-syntax racket/base))
+(require geiser/main geiser/enter geiser/eval (for-syntax racket/base))
(define top-namespace (current-namespace))
@@ -32,12 +32,28 @@
(define orig-reader (current-prompt-read))
+(define (geiser-eval)
+ (define geiser-main (module->namespace 'geiser/main))
+ (let* ((mod (read))
+ (lang (read))
+ (form (read)))
+ (datum->syntax #f
+ (list 'quote
+ (cond ((equal? form '(unquote apply))
+ (let* ((proc (eval (read) geiser-main))
+ (args (read)))
+ ((geiser:eval lang) `(,proc ,@args) mod)))
+ (else ((geiser:eval lang) form mod)))))))
+
(define (geiser-read)
(let ((form (orig-reader)))
(syntax-case form ()
- ((uq cmd) (and (eq? 'unquote (syntax-e #'uq))
- (eq? 'enter (syntax-e #'cmd)))
- (enter! (read) #'cmd))
+ ((uq cmd) (eq? 'unquote (syntax-e #'uq))
+ (case (syntax-e #'cmd)
+ ((enter) (enter! (read) #'cmd))
+ ((eval) (geiser-eval))
+ ((no-values) (datum->syntax #f (void)))
+ (else form)))
(_ form))))
(define (init)