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

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

[nongnu] elpa/geiser c437b1eca9 3/5: fallback autodoc inferred via cheap


From: ELPA Syncer
Subject: [nongnu] elpa/geiser c437b1eca9 3/5: fallback autodoc inferred via cheap regexps
Date: Sat, 15 Oct 2022 22:58:31 -0400 (EDT)

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

    fallback autodoc inferred via cheap regexps
    
    same code that finds putative definitions, with all its caveats
---
 elisp/geiser-autodoc.el | 21 +++++++++++----------
 elisp/geiser-edit.el    |  4 ++--
 elisp/geiser-reload.el  |  2 +-
 3 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/elisp/geiser-autodoc.el b/elisp/geiser-autodoc.el
index f9db0081f1..51bad7917a 100644
--- a/elisp/geiser-autodoc.el
+++ b/elisp/geiser-autodoc.el
@@ -12,6 +12,7 @@
 
 ;;; Code:
 
+(require 'geiser-edit)
 (require 'geiser-eval)
 (require 'geiser-syntax)
 (require 'geiser-custom)
@@ -178,16 +179,16 @@ you can set this variable to nil to avoid them."
 
 (defun geiser-autodoc--autodoc (path callback &optional signs)
   (let ((signs (or signs
-                   (geiser-autodoc--get-signatures (mapcar 'car path) 
callback)))
-        (p (car path))
-        (s))
-    (if callback
-        t
-      (while (and p (not s))
-        (unless (setq s (cdr (assoc (car p) signs)))
-          (setq p (car path))
-          (setq path (cdr path))))
-      (when s (geiser-autodoc--str p s)))))
+                   (geiser-autodoc--get-signatures (mapcar 'car path) 
callback))))
+    (or (and callback t)
+        (let ((p (car path))
+              (s))
+          (while (and p (not s))
+            (setq s (or (cdr (assoc (car p) signs))
+                        (cdr (geiser-edit--find-def (car p)))))
+            (setq p (car path) path (cdr path)))
+          (cond ((stringp s) s)
+                (s (geiser-autodoc--str p s)))))))
 
 
 ;;; Autodoc functions:
diff --git a/elisp/geiser-edit.el b/elisp/geiser-edit.el
index 165e0fc1ed..ee85bdfe3f 100644
--- a/elisp/geiser-edit.el
+++ b/elisp/geiser-edit.el
@@ -88,7 +88,7 @@ or following links in error buffers.")
   (regexp-opt '("define-syntaxes" "define-values")))
 
 (defsubst geiser-edit--def-re (thing)
-  (format "(%s +(?%s\\_>"
+  (format "(%s *[( ]\\(%s\\_>[^)]*\\)[ )\n]"
           geiser-edit--def-re
           (regexp-quote (format "%s" thing))))
 
@@ -102,7 +102,7 @@ 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-no-properties 0)))))
+      (cons (match-beginning 0) (match-string 1)))))
 
 (defsubst geiser-edit--symbol-re (thing)
   (format "\\_<%s\\_>" (regexp-quote (format "%s" thing))))
diff --git a/elisp/geiser-reload.el b/elisp/geiser-reload.el
index bd4d1a313e..1e58e945e4 100644
--- a/elisp/geiser-reload.el
+++ b/elisp/geiser-reload.el
@@ -30,9 +30,9 @@
            geiser-xref
            geiser-compile
            geiser-debug
-           geiser-edit
            geiser-completion
            geiser-autodoc
+           geiser-edit
            geiser-eval
            geiser-connection
            geiser-syntax



reply via email to

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