summaryrefslogtreecommitdiff
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
commitecbddf9fa8b11ff7546b0bc7f8458c0028a4fb9c (patch)
treeeed13c69cbb90b158954302c8ff0fcf3d72297fd
parent14c168968420091aec612ab6fb2a21e00134529a (diff)
downloadgeiser-guile-ecbddf9fa8b11ff7546b0bc7f8458c0028a4fb9c.tar.gz
geiser-guile-ecbddf9fa8b11ff7546b0bc7f8458c0028a4fb9c.tar.bz2
Guile: fix for module name completion.
-rw-r--r--geiser/modules.scm36
1 files changed, 20 insertions, 16 deletions
diff --git a/geiser/modules.scm b/geiser/modules.scm
index f0e7bf8..f7ea927 100644
--- a/geiser/modules.scm
+++ b/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))))