summaryrefslogtreecommitdiff
path: root/scheme/plt
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-02 22:38:32 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-02 22:38:32 +0200
commitbfcb656cd2f17b6cfc90afa0c535c95294863558 (patch)
tree02e05df79a9e67b35f9ce79d83c349e72f2a7f5a /scheme/plt
parentbec42c549db978bdce5709c93c9e39e4f3a45885 (diff)
downloadgeiser-chez-bfcb656cd2f17b6cfc90afa0c535c95294863558.tar.gz
geiser-chez-bfcb656cd2f17b6cfc90afa0c535c95294863558.tar.bz2
PLT: better module name in REPL prompt.
Diffstat (limited to 'scheme/plt')
-rw-r--r--scheme/plt/geiser/eval.ss19
1 files changed, 15 insertions, 4 deletions
diff --git a/scheme/plt/geiser/eval.ss b/scheme/plt/geiser/eval.ss
index ad69836..0490c1e 100644
--- a/scheme/plt/geiser/eval.ss
+++ b/scheme/plt/geiser/eval.ss
@@ -32,7 +32,7 @@
compile-file
make-repl-reader)
-(require scheme/enter)
+(require scheme/enter srfi/13)
(define last-result (void))
(define nowhere (open-output-nowhere))
@@ -66,9 +66,20 @@
(resolved-module-path-name rmp))))
(define (namespace->module-name ns)
- (let ((path (or (namespace->module-path-name ns) "<top>")))
- (call-with-values (lambda () (split-path path))
- (lambda (_ basename __) basename))))
+ (let ((path (namespace->module-path-name ns)))
+ (if (not path)
+ "<top>"
+ (let* ((path (path->string path))
+ (cpaths (map path->string (current-library-collection-paths)))
+ (prefix-len (lambda (p)
+ (let ((pl (string-length p)))
+ (if (= pl (string-prefix-length p path)) pl 0))))
+ (lens (map prefix-len cpaths))
+ (real-path (substring path (apply max lens))))
+ (if (absolute-path? real-path)
+ (call-with-values (lambda () (split-path path))
+ (lambda (_ basename __) basename))
+ (regexp-replace "\\.[^./]*$" real-path ""))))))
(define last-namespace (make-parameter (current-namespace)))