summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2011-03-06 03:18:43 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2011-03-06 03:18:43 +0100
commit98374c61cc6de60f2fa2912ee9b5e3d199477ab7 (patch)
treebc7f703e0b3b976aa78ab5767116a73128adb4bb
parent0e8be474273d6a515622334a16f2b0d34024e934 (diff)
downloadgeiser-guile-98374c61cc6de60f2fa2912ee9b5e3d199477ab7.tar.gz
geiser-guile-98374c61cc6de60f2fa2912ee9b5e3d199477ab7.tar.bz2
Racket: geiser-add-to-load-path implemented
And we take the chance to lightly document the existence of this new command in the user manual.
-rw-r--r--doc/cheat.texi6
-rw-r--r--scheme/racket/geiser/eval.rkt12
-rw-r--r--scheme/racket/geiser/main.rkt6
-rw-r--r--scheme/racket/geiser/user.rkt1
4 files changed, 20 insertions, 5 deletions
diff --git a/doc/cheat.texi b/doc/cheat.texi
index d222a13..bdcd2aa 100644
--- a/doc/cheat.texi
+++ b/doc/cheat.texi
@@ -36,6 +36,9 @@ third key not modified by @key{Control}; e.g.,
@item C-c C-e C-m
@tab @code{geiser-edit-module}
@tab Ask for a module and open its file
+@item C-c C-e C-l
+@tab @code{geiser-add-to-load-path}
+@tab Ask for a directory and add to Scheme load path
@item C-c C-e C-[
@tab @code{geiser-squarify}
@tab Toggle between () and [] for current form
@@ -133,6 +136,9 @@ third key not modified by @key{Control}; e.g.,
@item M-`, C-.
@tab @code{geiser-completion--complete-module}
@tab Complete module name at point
+@item C-c C-r
+@tab @code{geiser-add-to-load-path}
+@tab Ask for a directory and add to Scheme load path
@item M-p, M-n
@tab (comint commands)
@tab Prompt history, matching current prefix
diff --git a/scheme/racket/geiser/eval.rkt b/scheme/racket/geiser/eval.rkt
index f1f3f51..a59e275 100644
--- a/scheme/racket/geiser/eval.rkt
+++ b/scheme/racket/geiser/eval.rkt
@@ -1,6 +1,6 @@
;;; eval.rkt -- evaluation
-;; 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
@@ -14,6 +14,7 @@
(provide eval-in
load-file
macroexpand
+ add-to-load-path
make-repl-reader)
@@ -65,6 +66,15 @@
(lambda ()
(pretty-print (syntax->datum ((if all expand expand-once) form)))))))
+(define (add-to-load-path p)
+ (when (string? p)
+ (let ([p (string->path p)]
+ [cps (current-library-collection-paths)])
+ (unless (member p cps)
+ (current-library-collection-paths
+ (cons p cps)))))
+ #t)
+
(define (make-repl-reader reader)
(lambda ()
(last-namespace (current-namespace))
diff --git a/scheme/racket/geiser/main.rkt b/scheme/racket/geiser/main.rkt
index c759089..b1db6fb 100644
--- a/scheme/racket/geiser/main.rkt
+++ b/scheme/racket/geiser/main.rkt
@@ -1,6 +1,6 @@
;;; main.rkt -- exported interface for emacs
-;; 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
@@ -44,7 +44,7 @@
(load-file file))
(define geiser:compile-file geiser:load-file)
-
+(define geiser:add-to-load-path add-to-load-path)
(define geiser:autodoc autodoc)
(define geiser:help get-help)
(define geiser:completions symbol-completions)
@@ -55,5 +55,3 @@
(define geiser:macroexpand macroexpand)
(define geiser:symbol-documentation symbol-documentation)
(define (geiser:no-values) (values))
-
-;;; main.rkt ends here
diff --git a/scheme/racket/geiser/user.rkt b/scheme/racket/geiser/user.rkt
index 69a5df7..3ef978b 100644
--- a/scheme/racket/geiser/user.rkt
+++ b/scheme/racket/geiser/user.rkt
@@ -73,6 +73,7 @@
[(enter) (enter! (read) #'cmd)]
[(geiser-eval) (geiser-eval)]
[(geiser-no-values) (datum->syntax #f (void))]
+ [(add-to-load-path) (add-to-load-path (read))]
[else form])]
[_ form])))