summaryrefslogtreecommitdiff
path: root/scheme/racket/geiser/user.rkt
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-05-24 00:03:30 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-05-24 00:03:30 +0200
commit2d30daecad657d692a7f3cb66deb496630362600 (patch)
tree6b4f7e2cc66633465715696ec89f018dcb2b2f20 /scheme/racket/geiser/user.rkt
parent0b491101472741c3728b6ccf80c121d66e90f94e (diff)
downloadgeiser-guile-2d30daecad657d692a7f3cb66deb496630362600.tar.gz
geiser-guile-2d30daecad657d692a7f3cb66deb496630362600.tar.bz2
Racket: PLT implementation renamed to Racket.
Diffstat (limited to 'scheme/racket/geiser/user.rkt')
-rw-r--r--scheme/racket/geiser/user.rkt56
1 files changed, 56 insertions, 0 deletions
diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt
new file mode 100644
index 0000000..3c1d93e
--- /dev/null
+++ b/scheme/racket/geiser/user.rkt
@@ -0,0 +1,56 @@
+;;; user.rkt -- 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 racket/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.rkt ends here