diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-07 01:25:14 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-07 01:25:14 +0200 |
commit | 17b23aa1bfe807c68ddc5ff01eaccc99fd02a058 (patch) | |
tree | ee82f44eee65f6a864ad76840d117bb2ba7fa06f /scheme/guile/geiser/modules.scm | |
parent | 95f39e30fd4ae59cf962648dc8c0120c654c05bd (diff) | |
download | geiser-guile-17b23aa1bfe807c68ddc5ff01eaccc99fd02a058.tar.gz geiser-guile-17b23aa1bfe807c68ddc5ff01eaccc99fd02a058.tar.bz2 |
Guile: real fix for symbol locations (needs Guile's git head).
Diffstat (limited to 'scheme/guile/geiser/modules.scm')
-rw-r--r-- | scheme/guile/geiser/modules.scm | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/scheme/guile/geiser/modules.scm b/scheme/guile/geiser/modules.scm index 2934603..39b01b8 100644 --- a/scheme/guile/geiser/modules.scm +++ b/scheme/guile/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)))) |