From 4d9ac1be1f1c5357c2f590e24ec8ef97ebb01e27 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Wed, 6 May 2009 03:11:27 +0200 Subject: PLT: M-. is also able to locate modules. Refactorings. --- scheme/plt/geiser/locations.ss | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'scheme/plt/geiser/locations.ss') 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 -- cgit v1.2.3