From d96fe6fc9dbad5d65abe271ceb692f732d53e2fe Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Thu, 1 Apr 2010 02:19:32 +0200 Subject: PLT: Major module loading surgery. This is a dangerous commit. If you use PLT and don't like to live on the edge, just stick with tag 0.0.9 until 0.0.10 is out. --- scheme/plt/geiser/modules.ss | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'scheme/plt/geiser/modules.ss') diff --git a/scheme/plt/geiser/modules.ss b/scheme/plt/geiser/modules.ss index 9842174..829cf77 100644 --- a/scheme/plt/geiser/modules.ss +++ b/scheme/plt/geiser/modules.ss @@ -20,7 +20,7 @@ module-list module-exports) -(require srfi/13 scheme/enter syntax/modresolve syntax/modcode) +(require srfi/13 syntax/modresolve syntax/modcode geiser/enter) (define (ensure-module-spec spec) (cond ((symbol? spec) spec) @@ -28,22 +28,22 @@ (else `(file ,spec)))) (define (module-spec->namespace spec (lang #f)) - (let ((spec (ensure-module-spec spec))) - (if spec - (with-handlers ((exn? - (lambda (_) - (with-handlers - ((exn? (const (current-namespace)))) + (let ((spec (ensure-module-spec spec)) + (try-lang (lambda (_) + (with-handlers ((exn? (const (current-namespace)))) + (and lang + (begin (load-module lang #f (current-namespace)) - (module->namespace lang))))) - (module->namespace spec)) + (module->namespace lang))))))) + (or (and spec + (with-handlers ((exn? try-lang)) (get-namespace spec))) (current-namespace)))) (define nowhere (open-output-nowhere)) (define (load-module spec (port #f) (ns #f)) (parameterize ((current-error-port (or port nowhere))) - (eval #`(enter! #,(ensure-module-spec spec))) + (enter-module (ensure-module-spec spec)) (when (namespace? ns) (current-namespace ns)))) @@ -79,7 +79,6 @@ ((symbol? path) (symbol->string path)) (else ""))) - (define (skippable-dir? path) (call-with-values (lambda () (split-path path)) (lambda (_ basename __) -- cgit v1.2.3