summaryrefslogtreecommitdiff
path: root/scheme/guile/geiser
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-11 13:52:51 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-11 13:52:51 +0200
commit9ff0ba8e1fb1b990c6f5e17f7ccb69101d96d4a6 (patch)
treeafc57f84b1b6a5a15f2e7d912f74f3afbaa986d2 /scheme/guile/geiser
parent651f43777efde955f63f8e0818a626143fb75736 (diff)
downloadgeiser-chez-9ff0ba8e1fb1b990c6f5e17f7ccb69101d96d4a6.tar.gz
geiser-chez-9ff0ba8e1fb1b990c6f5e17f7ccb69101d96d4a6.tar.bz2
Guile: fix for module name completion.
Diffstat (limited to 'scheme/guile/geiser')
-rw-r--r--scheme/guile/geiser/modules.scm36
1 files changed, 20 insertions, 16 deletions
diff --git a/scheme/guile/geiser/modules.scm b/scheme/guile/geiser/modules.scm
index f0e7bf8..f7ea927 100644
--- a/scheme/guile/geiser/modules.scm
+++ b/scheme/guile/geiser/modules.scm
@@ -59,14 +59,27 @@
(or ((@@ (ice-9 session) module-filename) module-name)
(module-filename (resolve-module module-name)))))
+(define (submodules mod)
+ (hash-map->list (lambda (k v) v) (module-submodules mod)))
+
+(define (root-modules)
+ (submodules (resolve-module '() #f)))
+
(define (all-modules)
- (let ((roots ((@@ (ice-9 session) root-modules))))
- (map (lambda (m)
- (format "~A" (module-name m)))
- (fold (lambda (m all)
- (append (all-child-modules m) all))
- roots
- roots))))
+ (let ((guile (resolve-module '(guile))))
+ (cons "(guile)"
+ (apply append
+ (map (lambda (r)
+ (map (lambda (m)
+ (format "~A" (module-name m)))
+ (all-child-modules r '())))
+ (remove (lambda (m) (eq? m guile)) (root-modules)))))))
+
+(define (all-child-modules mod seen)
+ (let ((cs (filter (lambda (m) (not (member m seen))) (submodules mod))))
+ (fold (lambda (m all) (append (all-child-modules m all) all))
+ (list mod)
+ cs)))
(define (module-exports mod-name)
(let* ((elts (hash-fold classify-module-object
@@ -82,15 +95,6 @@
(lambda () (resolve-interface mod-name))
(lambda args (resolve-module mod-name))))
-(define (child-modules mod)
- (delq mod ((@@ (ice-9 session) submodules) mod)))
-
-(define (all-child-modules mod)
- (let ((children (child-modules mod)))
- (fold (lambda (m all)
- (append (all-child-modules m) all))
- children children)))
-
(define (classify-module-object name var elts)
(let ((obj (and (variable-bound? var)
(variable-ref var))))