summaryrefslogtreecommitdiff
path: root/elisp/geiser-edit.el
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-10-16 22:00:24 +0100
committerjao <jao@gnu.org>2022-10-16 22:00:24 +0100
commit0d4afa857bd2097fcf1c48461f14260e5dbe0e1d (patch)
tree5f338220da28e67316445b7c4ae3de1358d5ef4f /elisp/geiser-edit.el
parent8637d72db828328ea645466036878820ec92d183 (diff)
downloadgeiser-0d4afa857bd2097fcf1c48461f14260e5dbe0e1d.tar.gz
geiser-0d4afa857bd2097fcf1c48461f14260e5dbe0e1d.tar.bz2
fun with regular expressions for definitions fallback
Diffstat (limited to 'elisp/geiser-edit.el')
-rw-r--r--elisp/geiser-edit.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el
index 4c2560c..337ecff 100644
--- a/elisp/geiser-edit.el
+++ b/elisp/geiser-edit.el
@@ -88,9 +88,9 @@ or following links in error buffers.")
(regexp-opt '("define-syntaxes" "define-values")))
(defsubst geiser-edit--def-re (thing)
- (format "(%s *\\([( ]%s\\_>[^)]*[ )\n]\\)"
- geiser-edit--def-re
- (regexp-quote (format "%s" thing))))
+ (let ((sx (regexp-quote (format "%s" thing))))
+ (format "(%s[[:space:]]+\\((%s\\_>[^)]*)\\|\\(\\_<%s\\_>\\) *\\([^\n]*\\))\\)"
+ geiser-edit--def-re sx sx)))
(defsubst geiser-edit--def-re* (thing)
(format "(%s +([^)]*?\\_<%s\\_>"
@@ -102,7 +102,10 @@ or following links in error buffers.")
(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))
- (cons (match-beginning 0) (match-string 1)))))
+ (cons (match-beginning 0)
+ (if (match-string 2)
+ (concat (match-string 2) " => " (match-string 3))
+ (match-string 1))))))
(defsubst geiser-edit--symbol-re (thing)
(format "\\_<%s\\_>" (regexp-quote (format "%s" thing))))