summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2012-09-15 18:26:30 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2012-09-15 18:26:30 +0200
commitbe72bafd337df18ecfbc64fa01f5a1704186c985 (patch)
tree311ec3e7d2cd8939725ef0545b68d7b5c4c3a30d
parentd23e836753472c33a5339446160dc3891ac0c2bd (diff)
downloadgeiser-guile-be72bafd337df18ecfbc64fa01f5a1704186c985.tar.gz
geiser-guile-be72bafd337df18ecfbc64fa01f5a1704186c985.tar.bz2
racket: correctly jump to symbols defined in .ss modules0.2.1
Racket is returning by default their canonical "rkt" name, which sometimes is not what's in the filesystem.
-rw-r--r--NEWS2
-rw-r--r--scheme/racket/geiser/locations.rkt15
2 files changed, 13 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 68ac481..9788b2b 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,8 @@ Bug fixes:
- Racket: correctly reloading modules that contain submodules (this
one was breaking for instance code based on plai-typed).
+ - Racket: correctly jumping to symbols defined in files with .ss
+ extension.
New features:
diff --git a/scheme/racket/geiser/locations.rkt b/scheme/racket/geiser/locations.rkt
index 1ed4534..517e6df 100644
--- a/scheme/racket/geiser/locations.rkt
+++ b/scheme/racket/geiser/locations.rkt
@@ -1,6 +1,6 @@
;;; locations.rkt -- locating symbols
-;; Copyright (C) 2009, 2010 Jose Antonio Ortega Ruiz
+;; Copyright (C) 2009, 2010, 2012 Jose Antonio Ortega Ruiz
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the Modified BSD License. You should
@@ -29,10 +29,17 @@
(module-path-index-resolve (car binding))))
(cons sym #f))))
+(define (switch-extension path)
+ (if (regexp-match? "\\.rkt$" path)
+ (regexp-replace "\\.rkt$" path ".ss")
+ (regexp-replace "\\.ss$" path ".rkt")))
+
(define (make-location name path line)
- (list (cons "name" name)
- (cons "file" (if (path? path) (path->string path) '()))
- (cons "line" (or line '()))))
+ (let* ([path (if (path? path) (path->string path) #f)]
+ [path (and path (if (file-exists? path) path (switch-extension path)))])
+ (list (cons "name" name)
+ (cons "file" (or path '()))
+ (cons "line" (or line '())))))
(define (symbol-location sym)
(let* ([loc (symbol-location* sym)]