summaryrefslogtreecommitdiff
path: root/elisp
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 /elisp
parent78152318f5e6fb8ad315bd72a8b9257ec4b91b4b (diff)
downloadgeiser-chez-10fc0f3411cf838ee67e01df75fe8d84de367319.tar.gz
geiser-chez-10fc0f3411cf838ee67e01df75fe8d84de367319.tar.bz2
Better edit location heuristics.
Diffstat (limited to 'elisp')
-rw-r--r--elisp/geiser-edit.el20
1 files changed, 17 insertions, 3 deletions
diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el
index 9471981..c02e7bb 100644
--- a/elisp/geiser-edit.el
+++ b/elisp/geiser-edit.el
@@ -54,6 +54,9 @@
((eq method 'frame) (find-file-other-frame file))
(t (find-file file))))
+(defsubst geiser-edit--location-name (loc)
+ (cdr (assoc 'name loc)))
+
(defsubst geiser-edit--location-file (loc)
(cdr (assoc 'file loc)))
@@ -65,7 +68,6 @@
"defmacro"
"define-macro"
"define-syntax"
- "define-syntaxes"
"-define-syntax"
"-define"
"define*"
@@ -73,8 +75,18 @@
"define-class"
"define-struct")))
+(defconst geiser-edit--def-re*
+ (regexp-opt '("define-syntaxes" "define-values")))
+
(defsubst geiser-edit--def-re (thing)
- (format "(%s +(?%s\\_>" geiser-edit--def-re (regexp-quote (format "%s" thing))))
+ (format "(%s +(?%s\\_>"
+ geiser-edit--def-re
+ (regexp-quote (format "%s" thing))))
+
+(defsubst geiser-edit--def-re* (thing)
+ (format "(%s +([^)]*?\\_<%s\\_>"
+ geiser-edit--def-re*
+ (regexp-quote (format "%s" thing))))
(defsubst geiser-edit--symbol-re (thing)
(format "\\_<%s\\_>" (regexp-quote (format "%s" thing))))
@@ -84,11 +96,13 @@
(goto-line line)
(goto-char (point-min))
(when (or (re-search-forward (geiser-edit--def-re symbol) nil t)
+ (re-search-forward (geiser-edit--def-re* symbol) nil t)
(re-search-forward (geiser-edit--symbol-re symbol) nil t))
(goto-char (match-beginning 0)))))
(defun geiser-edit--try-edit-location (symbol loc &optional method)
- (let ((file (geiser-edit--location-file loc))
+ (let ((symbol (or (geiser-edit--location-name loc) symbol))
+ (file (geiser-edit--location-file loc))
(line (geiser-edit--location-line loc)))
(unless file (error "Couldn't find edit location for '%s'" symbol))
(unless (file-readable-p file) (error "Couldn't open '%s' for read" file))