summaryrefslogtreecommitdiff
path: root/scheme/plt/geiser
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-03 13:44:22 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2009-05-03 13:44:22 +0200
commit10fc0f3411cf838ee67e01df75fe8d84de367319 (patch)
treeb4f212fc3e843545455b4fd498f91c6587e42f7f /scheme/plt/geiser
parent78152318f5e6fb8ad315bd72a8b9257ec4b91b4b (diff)
downloadgeiser-chez-10fc0f3411cf838ee67e01df75fe8d84de367319.tar.gz
geiser-chez-10fc0f3411cf838ee67e01df75fe8d84de367319.tar.bz2
Better edit location heuristics.
Diffstat (limited to 'scheme/plt/geiser')
-rw-r--r--scheme/plt/geiser/locations.ss27
1 files changed, 18 insertions, 9 deletions
diff --git a/scheme/plt/geiser/locations.ss b/scheme/plt/geiser/locations.ss
index 1b13e8f..b738a48 100644
--- a/scheme/plt/geiser/locations.ss
+++ b/scheme/plt/geiser/locations.ss
@@ -27,22 +27,31 @@
#lang scheme
(provide symbol-location
- symbol-module-path-name
- symbol->module-name)
+ symbol-module-name
+ symbol-module-path-name)
(require geiser/utils)
-(define (symbol-module-path-name sym)
- (let ([binding (identifier-binding sym)])
- (and (list? binding)
+(define (%symbol-location sym)
+ (let* ((id (namespace-symbol->identifier sym))
+ (binding (and id (identifier-binding id))))
+ (if (list? binding)
+ (cons
+ (cadr binding)
(resolved-module-path-name
- (module-path-index-resolve (car binding))))))
+ (module-path-index-resolve (car binding))))
+ (cons sym #f))))
(define (symbol-location sym)
- (let ((file (symbol-module-path-name (namespace-symbol->identifier sym))))
- (list (cons 'file (if (path? file) (path->string file) '())))))
+ (let* ((loc (%symbol-location sym))
+ (name (car loc))
+ (path (cdr loc)))
+ (list (cons 'name name)
+ (cons 'file (if (path? path) (path->string path) '())))))
-(define symbol->module-name
+(define symbol-module-path-name (compose cdr %symbol-location))
+
+(define symbol-module-name
(compose module-path-name->name symbol-module-path-name))
;;; locations.ss ends here