emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/geiser 2174f90b64 2/2: more tweaks to regexp signature fin


From: ELPA Syncer
Subject: [nongnu] elpa/geiser 2174f90b64 2/2: more tweaks to regexp signature finding
Date: Thu, 20 Oct 2022 20:58:35 -0400 (EDT)

branch: elpa/geiser
commit 2174f90b64343c1af76c8e5469d5e4b69d709c08
Author: jao <jao@gnu.org>
Commit: jao <jao@gnu.org>

    more tweaks to regexp signature finding
    
    and its use in autodoc (for instance, skip it when in the REPL).
---
 elisp/geiser-autodoc.el |  3 ++-
 elisp/geiser-edit.el    | 19 ++++++++++++++-----
 readme.org              |  1 -
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index 924fadb8c4..f18a6edf03 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -185,7 +185,8 @@ you can set this variable to nil to avoid them."
               (s))
           (while (and p (not s))
             (setq s (or (cdr (assoc (car p) signs))
-                        (cdr (geiser-edit--find-def (car p)))))
+                        (and geiser-mode
+                             (cdr (geiser-edit--find-def (car p) t)))))
             (unless s (setq p (car path) path (cdr path))))
           (cond ((stringp s) s)
                 (s (geiser-autodoc--str p s)))))))
diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el
index f2ed57af13..06340fb560 100644
--- a/elisp/geiser-edit.el
+++ b/elisp/geiser-edit.el
@@ -89,7 +89,10 @@ or following links in error buffers.")
 
 (defsubst geiser-edit--def-re (thing)
   (let ((sx (regexp-quote (format "%s" thing))))
-    (format "(%s[[:space:]]+\\((%s\\_>[^)]*)\\|\\(\\_<%s\\_>\\) 
*\\([^\n]*\\))\\)"
+    (format (concat "(%s[[:space:]]+\\("
+                    "(%s\\_>[^)]*)\\|"
+                    "\\(\\_<%s\\_>\\) *\\([^\n]*?\\)[)\n]"
+                    "\\)")
             geiser-edit--def-re sx sx)))
 
 (defsubst geiser-edit--def-re* (thing)
@@ -97,15 +100,21 @@ or following links in error buffers.")
           geiser-edit--def-re*
           (regexp-quote (format "%s" thing))))
 
-(defun geiser-edit--find-def (symbol)
+(defun geiser-edit--find-def (symbol &optional args)
   (save-excursion
     (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)
-            (if (match-string 2)
-                (concat (match-string 2) " => " (match-string 3))
-              (match-string 1))))))
+            (and args
+                 (if (match-string 2)
+                     (let* ((v (or (match-string 3) ""))
+                            (v (and (not (string-blank-p v)) v)))
+                       (concat (match-string 2)
+                               (and v " => ")
+                               v
+                               (and v (string-prefix-p "(" v) " ...")))
+                   (match-string 1)))))))
 
 (defsubst geiser-edit--symbol-re (thing)
   (format "\\_<%s\\_>" (regexp-quote (format "%s" thing))))
diff --git a/readme.org b/readme.org
index 22632f199c..e836c36f31 100644
--- a/readme.org
+++ b/readme.org
@@ -45,7 +45,6 @@
       - Stklos 1.50, via 
[[https://gitlab.com/emacs-geiser/stklos][geiser-stklos]]
 
 * Installation
-
 *** Using ELPA
 
     Geiser is available in the ELPA repositories 
[[https://elpa.nongnu.org/nongnu/geiser.html][NonGNU ELPA]]



reply via email to

[Prev in Thread] Current Thread [Next in Thread]