summaryrefslogtreecommitdiff
path: root/scheme/plt/geiser/locations.ss
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-06 03:11:27 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-06 03:11:27 +0200
commit4d9ac1be1f1c5357c2f590e24ec8ef97ebb01e27 (patch)
tree72e45ba7a9bd40f37c343612d50ead2c2dcbb323 /scheme/plt/geiser/locations.ss
parenta7cde6cd6c4677c4618ece3602890d6f6782cd48 (diff)
downloadgeiser-guile-4d9ac1be1f1c5357c2f590e24ec8ef97ebb01e27.tar.gz
geiser-guile-4d9ac1be1f1c5357c2f590e24ec8ef97ebb01e27.tar.bz2
PLT: M-. is also able to locate modules. Refactorings.
Diffstat (limited to 'scheme/plt/geiser/locations.ss')
-rw-r--r--scheme/plt/geiser/locations.ss17
1 files changed, 14 insertions, 3 deletions
diff --git a/scheme/plt/geiser/locations.ss b/scheme/plt/geiser/locations.ss
index d1c5cb7..87a643d 100644
--- a/scheme/plt/geiser/locations.ss
+++ b/scheme/plt/geiser/locations.ss
@@ -28,10 +28,11 @@
(provide symbol-location
symbol-location*
+ module-location
symbol-module-name
symbol-module-path-name)
-(require geiser/utils)
+(require geiser/utils geiser/modules)
(define (symbol-location* sym)
(let* ((id (namespace-symbol->identifier sym))
@@ -43,16 +44,26 @@
(module-path-index-resolve (car binding))))
(cons sym #f))))
+(define (make-location name path line)
+ (list (cons 'name name)
+ (cons 'file (if (path? path) (path->string path) '()))
+ (cons 'line (or line '()))))
+
(define (symbol-location sym)
(let* ((loc (symbol-location* sym))
(name (car loc))
(path (cdr loc)))
- (list (cons 'name name)
- (cons 'file (if (path? path) (path->string path) '())))))
+ (if path
+ (make-location name path #f)
+ (module-location sym))))
(define symbol-module-path-name (compose cdr symbol-location*))
(define symbol-module-name
(compose module-path-name->name symbol-module-path-name))
+(define (module-location sym)
+ (make-location sym (module-spec->path-name sym) 1))
+
+
;;; locations.ss ends here