From: Lars Ingebrigtsen <larsi@gnus.org>
Date: Sat, 6 Nov 2021 21:31:06 +0000 (+0100)
Subject: Make the lambda/closure buttons in `C-h b' say what they do
X-Git-Tag: emacs-29.0.90~3671^2~168
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=de06e0539537a99e147cbb96ee9fceaecafc9190;p=emacs.git

Make the lambda/closure buttons in `C-h b' say what they do

* lisp/button.el (buttonize): Add a help-echo property.

* lisp/help.el (help--describe-command): Say what the
lambda/closure buttons do.
---

diff --git a/lisp/button.el b/lisp/button.el
index f166aa5eb6b..e3f91cb4a66 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -618,14 +618,17 @@ button at point is the button to describe."
 
 (define-obsolete-function-alias 'button-buttonize #'buttonize "29.1")
 
-(defun buttonize (string callback &optional data)
+(defun buttonize (string callback &optional data help-echo)
   "Make STRING into a button and return it.
 When clicked, CALLBACK will be called with the DATA as the
 function argument.  If DATA isn't present (or is nil), the button
-itself will be used instead as the function argument."
+itself will be used instead as the function argument.
+
+If HELP-ECHO, use that as the `help-echo' property."
   (propertize string
               'face 'button
               'mouse-face 'highlight
+              'help-echo help-echo
               'button t
               'follow-link t
               'category t
diff --git a/lisp/help.el b/lisp/help.el
index 2a72656bb0d..b2772f4389b 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1347,7 +1347,8 @@ Return nil if the key sequence is too long."
                           (symbol-name (car definition))
                           (lambda (_)
                             (pp-display-expression
-                             definition "*Help Source*" t))))))
+                             definition "*Help Source*" t))
+                          nil "View definition"))))
         (t
          (insert "??\n"))))