From e1673221200c35bdacffebbcc26c2e562080a9fd Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sun, 9 Jan 2011 22:40:11 +0100 Subject: Racket: ',enter "foo"' as a synonym of ',enter (file "foo")' --- doc/repl.texi | 25 +++++++++++++++---------- elisp/geiser-racket.el | 4 ++-- scheme/racket/geiser/user.rkt | 3 ++- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/doc/repl.texi b/doc/repl.texi index 7976f0d..8a0f784 100644 --- a/doc/repl.texi +++ b/doc/repl.texi @@ -133,16 +133,21 @@ The remaining commands are meatier, and deserve sections of their own. @cindex current module, in REPL In tune with Geiser's @alt{@ref{current-module,,modus operandi},modus -operandi}, evaluations -in the REPL take place in the namespace of the current module. As -noted above, the REPL's prompt tells you the name of the current -module. To switch to a different one, you can use the command -@command{switch-to-geiser-module}, bound to @kbd{C-c C-m}. You'll notice -that Geiser simply uses a couple of meta-commands provided by the Scheme -REPL (the stock @command{,m} in Guile and @command{,enter} in -Racket), and that it doesn't even try to hide that fact. That means that -you can freely use said native ways directly at the REPL, and Geiser -will be happy to oblige. +operandi}, evaluations in the REPL take place in the namespace of the +current module. As noted above, the REPL's prompt tells you the name of +the current module. To switch to a different one, you can use the +command @command{switch-to-geiser-module}, bound to @kbd{C-c C-m}. +You'll notice that Geiser simply uses a couple of meta-commands provided +by the Scheme REPL (the stock @command{,m} in Guile and the +(geiser-defined) @command{,enter} in Racket), and that it doesn't even +try to hide that fact. That means that you can freely use said native +ways directly at the REPL, and Geiser will be happy to oblige. In +Racket, @command{,enter} works like Racket's standard @code{enter!} +form, but you can also provide a path string as its argument (e.g., +@command{,enter "/tmp/foo.rkt"} is equivalent to @command{,enter (file +"/tmp/foo.rkt")}). Like @code{enter!}, @command{,enter} accepts also +module names (as in, say, @command{,enter geiser/main}). As mentioned, +Guile's @command{,m} is used @i{as is}. @cindex current module, change Once you enter a new module, only those bindings visible in its diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el index 19301ce..df6128e 100644 --- a/elisp/geiser-racket.el +++ b/elisp/geiser-racket.el @@ -1,6 +1,6 @@ ;; geiser-racket.el -- geiser support for Racket scheme -;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz +;; Copyright (C) 2009, 2010, 2011 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 @@ -106,7 +106,7 @@ This function uses `geiser-racket-init-file' if it exists." (defun geiser-racket--enter-command (module) (when (stringp module) (cond ((zerop (length module)) ",enter #f") - ((file-name-absolute-p module) (format ",enter (file %S)" module)) + ((file-name-absolute-p module) (format ",enter %S" module)) (t (format ",enter %s" module))))) (defun geiser-racket--geiser-procedure (proc &rest args) diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt index 70defd4..72aa48a 100644 --- a/scheme/racket/geiser/user.rkt +++ b/scheme/racket/geiser/user.rkt @@ -1,6 +1,6 @@ ;;; user.rkt -- global bindings visible to geiser users -;; Copyright (C) 2010 Jose Antonio Ortega Ruiz +;; Copyright (C) 2010, 2011 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 @@ -28,6 +28,7 @@ [(module-path? mod) (enter-module mod) (current-namespace (module->namespace mod))] + [(path-string? mod) (enter! `(file ,mod) stx)] [else (raise-syntax-error #f "not a valid module path, and not #f" -- cgit v1.2.3