diff options
author | Basil L. Contovounesios <contovob@tcd.ie> | 2020-10-16 09:32:48 +0200 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2020-10-16 09:32:48 +0200 |
commit | a950a6e6cf8dafc40acc1e32cc6fd62d515bb52d (patch) | |
tree | a42636218f46c62240e79bbb4fe07a47864a948b /lisp/button.el | |
parent | 1e89dfc6c8bcab8b64ded08e8d42e32929189799 (diff) | |
download | emacs-a950a6e6cf8dafc40acc1e32cc6fd62d515bb52d.tar.gz |
Substitute command keys in button help-echo values
* lisp/button.el (button--help-echo): Pass resulting string through
substitute-command-keys for consistency with show-help-function.
* test/lisp/button-tests.el (button-tests--map): New test keymap.
(button--help-echo-string, button--help-echo-form)
(button--help-echo-function): Use it to test command key
substitution in help-echo strings (bug#43070).
Diffstat (limited to 'lisp/button.el')
-rw-r--r-- | lisp/button.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/button.el b/lisp/button.el index 11317605cee..ba0682348df 100644 --- a/lisp/button.el +++ b/lisp/button.el @@ -493,12 +493,17 @@ butting, use the `button-describe' command." t)))) (defun button--help-echo (button) - "Evaluate BUTTON's `help-echo' property and return its value." - (let ((help (button-get button 'help-echo))) - (if (functionp help) - (let ((obj (if (overlayp button) button (current-buffer)))) - (funcall help (selected-window) obj (button-start button))) - (eval help lexical-binding)))) + "Evaluate BUTTON's `help-echo' property and return its value. +If the result is non-nil, pass it through `substitute-command-keys' +before returning it, as is done for `show-help-function'." + (let* ((help (button-get button 'help-echo)) + (help (if (functionp help) + (funcall help + (selected-window) + (if (overlayp button) button (current-buffer)) + (button-start button)) + (eval help lexical-binding)))) + (and help (substitute-command-keys help)))) (defun forward-button (n &optional wrap display-message no-error) "Move to the Nth next button, or Nth previous button if N is negative. |