summaryrefslogtreecommitdiff
path: root/lisp/help-at-pt.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-04-24 13:53:17 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-04-24 13:53:17 +0200
commit4d5fd0174905863bea4110865a0c124f8999e273 (patch)
tree1758f0e266b7b8e3f4244480eae52b4e866ef9bc /lisp/help-at-pt.el
parente632c7bd80c728af76873e1358e6f2bfb4ff7c54 (diff)
downloademacs-4d5fd0174905863bea4110865a0c124f8999e273.tar.gz
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).
Diffstat (limited to 'lisp/help-at-pt.el')
-rw-r--r--lisp/help-at-pt.el33
1 files changed, 21 insertions, 12 deletions
diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el
index c5a9a93482c..5bdaa35c0bc 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.