summaryrefslogtreecommitdiff
path: root/scheme/plt/geiser/modules.ss
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-03-31 11:54:06 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-03-31 11:54:06 +0200
commitdcbe97e5329a06a366cbbd428e8076f7cca277ee (patch)
tree857ee0a591b2819cd3517e7e395f5192a3b48db0 /scheme/plt/geiser/modules.ss
parent7c6294e8a8775d59e347e29cbbbef96c8d095c11 (diff)
downloadgeiser-chez-dcbe97e5329a06a366cbbd428e8076f7cca277ee.tar.gz
geiser-chez-dcbe97e5329a06a366cbbd428e8076f7cca277ee.tar.bz2
PLT: preloading available module list.
Diffstat (limited to 'scheme/plt/geiser/modules.ss')
-rw-r--r--scheme/plt/geiser/modules.ss22
1 files changed, 16 insertions, 6 deletions
diff --git a/scheme/plt/geiser/modules.ss b/scheme/plt/geiser/modules.ss
index ef6530a..9842174 100644
--- a/scheme/plt/geiser/modules.ss
+++ b/scheme/plt/geiser/modules.ss
@@ -108,13 +108,15 @@
(fold-files visit-module-path acc))
acc))
+(define (known-modules)
+ (sort (foldl find-modules '() (current-library-collection-paths)) string<?))
+
(define module-cache #f)
+(define (update-module-cache)
+ (when (not module-cache) (set! module-cache (known-modules))))
(define (module-list)
- (when (not module-cache)
- (set! module-cache
- (sort (foldl find-modules '() (current-library-collection-paths))
- string<?)))
+ (update-module-cache)
module-cache)
(define (module-exports mod)
@@ -124,8 +126,10 @@
ls))
(define (classify-ids ids ns)
(let loop ((ids ids) (procs '()) (vars '()))
- (cond ((null? ids) `((procs ,@(reverse procs)) (vars ,@(reverse vars))))
- ((procedure? (namespace-variable-value (car ids) #t (const #f) ns))
+ (cond ((null? ids)
+ `((procs ,@(reverse procs)) (vars ,@(reverse vars))))
+ ((procedure?
+ (namespace-variable-value (car ids) #t (const #f) ns))
(loop (cdr ids) (cons (car ids) procs) vars))
(else (loop (cdr ids) procs (cons (car ids) vars))))))
(let-values (((reg syn)
@@ -135,4 +139,10 @@
(reg (extract-ids reg)))
`((syntax ,@syn) ,@(classify-ids reg (module-spec->namespace mod))))))
+(define (startup)
+ (thread update-module-cache)
+ (void))
+
+(startup)
+
;;; modules.ss ends here