emacs-diffs
[Top][All Lists]
Advanced

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

master 22a5482: Improve the shortdoc link action in *Help* buffers


From: Lars Ingebrigtsen
Subject: master 22a5482: Improve the shortdoc link action in *Help* buffers
Date: Thu, 15 Jul 2021 12:29:35 -0400 (EDT)

branch: master
commit 22a5482ab699973e286d7dceb20fe469c94533dd
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Improve the shortdoc link action in *Help* buffers
    
    * lisp/emacs-lisp/shortdoc.el (shortdoc-display-group): Allow
    taking an optional parameter to place point on a specific function.
    (shortdoc--display-function): Go to the function in question in
    the shortdoc buffer.
---
 lisp/emacs-lisp/shortdoc.el | 13 ++++++++-----
 lisp/help-fns.el            |  2 +-
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/shortdoc.el b/lisp/emacs-lisp/shortdoc.el
index 1d2c524..dbf1696 100644
--- a/lisp/emacs-lisp/shortdoc.el
+++ b/lisp/emacs-lisp/shortdoc.el
@@ -1141,8 +1141,9 @@ There can be any number of :example/:result elements."
    :eval (sqrt -1)))
 
 ;;;###autoload
-(defun shortdoc-display-group (group)
-  "Pop to a buffer with short documentation summary for functions in GROUP."
+(defun shortdoc-display-group (group &optional function)
+  "Pop to a buffer with short documentation summary for functions in GROUP.
+If FUNCTION is non-nil, place point on the entry for FUNCTION (if any)."
   (interactive (list (completing-read "Show summary for functions in: "
                                       (mapcar #'car shortdoc--groups))))
   (when (stringp group)
@@ -1173,15 +1174,17 @@ There can be any number of :example/:result elements."
          (setq prev t)
          (shortdoc--display-function data))))
      (cdr (assq group shortdoc--groups))))
-  (goto-char (point-min)))
+  (goto-char (point-min))
+  (when function
+    (text-property-search-forward 'shortdoc-function function t)
+    (beginning-of-line)))
 
 (defun shortdoc--display-function (data)
   (let ((function (pop data))
         (start-section (point))
         arglist-start)
     ;; Function calling convention.
-    (insert (propertize "("
-                        'shortdoc-function t))
+    (insert (propertize "(" 'shortdoc-function function))
     (if (plist-get data :no-manual)
         (insert-text-button
          (symbol-name function)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index afdb0d1..d3fdb47 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -752,7 +752,7 @@ FILE is the file where FUNCTION was probably defined."
            (insert-text-button
             (symbol-name group)
             'action (lambda (_)
-                      (shortdoc-display-group group))
+                      (shortdoc-display-group group object))
             'follow-link t
             'help-echo (purecopy "mouse-1, RET: show documentation group")))
          groups)



reply via email to

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