diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-04-01 02:19:32 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-04-01 02:19:32 +0200 |
commit | d96fe6fc9dbad5d65abe271ceb692f732d53e2fe (patch) | |
tree | 3a4ffdb048ad7692c7c79fda5dbd320f05bf5fd8 /scheme/plt/geiser/user.ss | |
parent | 8c47f6099fd05e2feb7cb51e15d39911ef48411d (diff) | |
download | geiser-guile-d96fe6fc9dbad5d65abe271ceb692f732d53e2fe.tar.gz geiser-guile-d96fe6fc9dbad5d65abe271ceb692f732d53e2fe.tar.bz2 |
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.
Diffstat (limited to 'scheme/plt/geiser/user.ss')
-rw-r--r-- | scheme/plt/geiser/user.ss | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/scheme/plt/geiser/user.ss b/scheme/plt/geiser/user.ss new file mode 100644 index 0000000..48b7dd5 --- /dev/null +++ b/scheme/plt/geiser/user.ss @@ -0,0 +1,57 @@ +;;; user.ss -- global bindings visible to geiser users + +;; Copyright (C) 2010 Jose Antonio Ortega Ruiz + +;; This program is free software; you can redistribute it and/or +;; modify it under the terms of the Modified BSD License. You should +;; have received a copy of the license along with this program. If +;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>. + +;; Start date: Wed Mar 31, 2010 22:24 + +#lang scheme/base + +(provide enter!) + +(require geiser/enter geiser/eval (for-syntax scheme/base)) + +(define-syntax (enter! stx) + (syntax-case stx () + [(enter! mod) + (if (or (not (syntax-e #'mod)) + (module-path? (syntax->datum #'mod))) + #'(do-enter! 'mod) + (raise-syntax-error + #f + "not a valid module path, and not #f" + stx + #'mod))] + [_ (raise-syntax-error + #f + "bad syntax; should be `(enter! <module-path-or-#f>)'" + stx)])) + +(define orig-namespace (current-namespace)) + +(define (do-enter! mod) + (if mod + (begin + (enter-module mod) + (let ([ns (module->namespace mod)]) + (current-namespace ns) + (namespace-require 'geiser/user))) + (current-namespace orig-namespace))) + + +(define orig-loader (current-load/use-compiled)) + +(define (init) + (compile-enforce-module-constants #f) + (current-load/use-compiled (module-loader orig-loader)) + (current-prompt-read (compose (make-repl-reader (current-prompt-read)) + current-namespace))) + +(init) + +;;; user.ss ends here + |