emacs-diffs
[Top][All Lists]
Advanced

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

master 4d5fd01749: Allow 'C-u C-h .' to describe button/widgets


From: Lars Ingebrigtsen
Subject: master 4d5fd01749: Allow 'C-u C-h .' to describe button/widgets
Date: Sun, 24 Apr 2022 07:53:39 -0400 (EDT)

branch: master
commit 4d5fd0174905863bea4110865a0c124f8999e273
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Allow 'C-u C-h .' to describe button/widgets
    
    * doc/emacs/help.texi (Help Summary): Document it.
    * lisp/help-at-pt.el (display-local-help): Display button/widget
    help (bug#54963).
---
 doc/emacs/help.texi |  4 +++-
 etc/NEWS            |  6 ++++++
 lisp/help-at-pt.el  | 33 +++++++++++++++++++++------------
 3 files changed, 30 insertions(+), 13 deletions(-)

diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 1f743ccd88..ee3d898019 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -182,7 +182,9 @@ programming language you are editing 
(@code{info-lookup-symbol}).
 @item C-h .
 Display the help message for a special text area, if point is in one
 (@code{display-local-help}).  (These include, for example, links in
-@file{*Help*} buffers.)  @xref{Help Echo}.
+@file{*Help*} buffers.)  @xref{Help Echo}.  If you use a prefix for
+this command, and point as on a button or a widget, this command will
+pop to a new buffer that describes the button/widget.
 @end table
 
 @node Key Help
diff --git a/etc/NEWS b/etc/NEWS
index 4dd56e005e..48ff8c3708 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -416,6 +416,12 @@ command also works for non-Emoji characters.)
 
 ** Help
 
++++
+*** The 'C-h .' command now takes a prefix to display button/widget help.
+'C-u C-h .' would previously inhibit displaying a warning message if
+there's no local help at point.  This has been changed to trigger a
+call 'button-describe'/'widget-describe' instead.
+
 ---
 *** New user option 'help-enable-variable-value-editing'.
 If enabled, 'e' on a value in *Help* will pop you to a new buffer
diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el
index c5a9a93482..5bdaa35c0b 100644
--- a/lisp/help-at-pt.el
+++ b/lisp/help-at-pt.el
@@ -82,24 +82,33 @@ If this produces no string either, return nil."
     (if (and kbd (not (eq kbd t))) kbd echo)))
 
 ;;;###autoload
-(defun display-local-help (&optional arg)
+(defun display-local-help (&optional inhibit-warning describe-button)
   "Display local help in the echo area.
-This displays a short help message, namely the string produced by
-the `kbd-help' property at point.  If `kbd-help' does not produce
-a string, but the `help-echo' property does, then that string is
-printed instead.
+This command, by default, displays a short help message, namely
+the string produced by the `kbd-help' property at point.  If
+`kbd-help' does not produce a string, but the `help-echo'
+property does, then that string is printed instead.
 
 The string is passed through `substitute-command-keys' before it
 is displayed.
 
-A numeric argument ARG prevents display of a message in case
-there is no help.  While ARG can be used interactively, it is
-mainly meant for use from Lisp."
-  (interactive "P")
+If INHIBIT-WARNING is non-nil, this prevents display of a message
+in case there is no help.
+
+If DESCRIBE-BUTTON in non-nil (interactively, the prefix), and
+there's a button/widget at point, pop to a buffer describing that
+button/widget instead."
+  (interactive (list nil current-prefix-arg))
   (let ((help (help-at-pt-kbd-string)))
-    (if help
-       (message "%s" (substitute-command-keys help))
-      (if (not arg) (message "No local help at point")))))
+    (cond
+     ((and describe-button (button-at (point)))
+      (button-describe))
+     ((and describe-button (widget-at (point)))
+      (widget-describe))
+     (help
+      (message "%s" (substitute-command-keys help)))
+     ((not inhibit-warning)
+      (message "No local help at point")))))
 
 (defvar help-at-pt-timer nil
   "Non-nil means that a timer is set that checks for local help.



reply via email to

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