diff options
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)) |