diff options
author | jao <jao@gnu.org> | 2022-10-16 22:00:24 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-10-16 22:00:24 +0100 |
commit | 0d4afa857bd2097fcf1c48461f14260e5dbe0e1d (patch) | |
tree | 5f338220da28e67316445b7c4ae3de1358d5ef4f | |
parent | 8637d72db828328ea645466036878820ec92d183 (diff) | |
download | geiser-0d4afa857bd2097fcf1c48461f14260e5dbe0e1d.tar.gz geiser-0d4afa857bd2097fcf1c48461f14260e5dbe0e1d.tar.bz2 |
fun with regular expressions for definitions fallback
-rw-r--r-- | elisp/geiser-edit.el | 11 |
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)))) |