diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-06-08 16:01:01 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2013-06-08 16:01:01 +0200 |
commit | 1551885d929463723748b81e9bfab07bde0d1f47 (patch) | |
tree | 41dadc76630261ee1c904ca064c875a209f43e34 /scheme/racket/geiser/user.rkt | |
parent | bb38fa9c5cae5095a629c6cbb4ea570d47adeb62 (diff) | |
download | geiser-guile-1551885d929463723748b81e9bfab07bde0d1f47.tar.gz geiser-guile-1551885d929463723748b81e9bfab07bde0d1f47.tar.bz2 |
racket: ,enter submodules
It is now possible to ,enter racket submodules. This is only the
first part of the story, because evalations should take place in the
submodule, not in its top level module, as it happens now.
Diffstat (limited to 'scheme/racket/geiser/user.rkt')
-rw-r--r-- | scheme/racket/geiser/user.rkt | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt index b3112f2..753f353 100644 --- a/scheme/racket/geiser/user.rkt +++ b/scheme/racket/geiser/user.rkt @@ -32,21 +32,27 @@ (current-namespace (module->namespace mod)) (last-entered name)) +(define (submod-path mod) + (and (list? mod) + (eq? 'submod (car mod)) + (> (length mod) 1) + (let ([parent (cadr mod)]) + (cond [(path-string? parent) `(submod (file ,parent) ,@(cddr mod))] + [(symbol? parent) mod] + [else #f])))) + (define (enter! mod stx) (cond [(not mod) (current-namespace top-namespace) (last-entered "")] [(symbol? mod) (do-enter mod (symbol->string mod))] + [(path-string? mod) (do-enter `(file ,mod) mod)] [(and (list? mod) (= 2 (length mod)) (eq? 'file (car mod)) (path-string? (cadr mod))) (do-enter mod (cadr mod))] - [(path-string? mod) (do-enter `(file ,mod) mod)] - [else (raise-syntax-error - #f - "not a valid module path, and not #f" - stx - mod)])) + [(submod-path mod) => (lambda (m) (do-enter m m))] + [else (raise-syntax-error #f "Invalid module path" stx mod)])) (define orig-loader (current-load/use-compiled)) (define geiser-loader (module-loader orig-loader)) |