summaryrefslogtreecommitdiff
path: root/geiser/modules.scm
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-07 01:25:14 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-06-07 01:25:14 +0200
commit6212ff6e6928d2844ff3b8ff5a40f4e714685262 (patch)
tree12ab92296db48b623f72a43b16b9ae9ae51b8bbd /geiser/modules.scm
parent90835ae8e3ad9763e1a8d1135e337c0855ec3daf (diff)
downloadgeiser-guile-6212ff6e6928d2844ff3b8ff5a40f4e714685262.tar.gz
geiser-guile-6212ff6e6928d2844ff3b8ff5a40f4e714685262.tar.bz2
Guile: real fix for symbol locations (needs Guile's git head).
Diffstat (limited to 'geiser/modules.scm')
-rw-r--r--geiser/modules.scm23
1 files changed, 20 insertions, 3 deletions
diff --git a/geiser/modules.scm b/geiser/modules.scm
index 2934603..39b01b8 100644
--- a/geiser/modules.scm
+++ b/geiser/modules.scm
@@ -11,7 +11,9 @@
(define-module (geiser modules)
#:export (symbol-module
- module-filename
+ module-name?
+ module-path
+ find-module
all-modules
module-exports
module-location)
@@ -21,6 +23,11 @@
#:use-module (ice-9 session)
#:use-module (srfi srfi-1))
+(define (module-name? module-name)
+ (and (list? module-name)
+ (> (length module-name) 0)
+ (every symbol? module-name)))
+
(define (symbol-module sym . all)
(and sym
(catch 'module-name
@@ -38,9 +45,19 @@
(and (eq? key 'module-name) (car args))))))
(define (module-location name)
- (make-location (module-filename name) #f))
+ (make-location (module-path name) #f))
+
+(define (find-module module-name)
+ (and (module-name? module-name)
+ (or (nested-ref (resolve-module '() #f) module-name)
+ (let ((m (resolve-module module-name)))
+ (beautify-user-module! m)
+ m))))
-(define module-filename (@@ (ice-9 session) module-filename))
+(define (module-path module-name)
+ (and (module-name? module-name)
+ (or ((@@ (ice-9 session) module-filename) module-name)
+ (module-filename (resolve-module module-name)))))
(define (all-modules)
(let ((roots ((@@ (ice-9 session) root-modules))))