diff options
| author | Basil L. Contovounesios | 2020-10-16 09:32:48 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-10-16 09:32:48 +0200 |
| commit | a950a6e6cf8dafc40acc1e32cc6fd62d515bb52d (patch) | |
| tree | a42636218f46c62240e79bbb4fe07a47864a948b /lisp/button.el | |
| parent | 1e89dfc6c8bcab8b64ded08e8d42e32929189799 (diff) | |
| download | emacs-a950a6e6cf8dafc40acc1e32cc6fd62d515bb52d.tar.gz emacs-a950a6e6cf8dafc40acc1e32cc6fd62d515bb52d.zip | |
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." | |||
| 493 | t)))) | 493 | t)))) |
| 494 | 494 | ||
| 495 | (defun button--help-echo (button) | 495 | (defun button--help-echo (button) |
| 496 | "Evaluate BUTTON's `help-echo' property and return its value." | 496 | "Evaluate BUTTON's `help-echo' property and return its value. |
| 497 | (let ((help (button-get button 'help-echo))) | 497 | If the result is non-nil, pass it through `substitute-command-keys' |
| 498 | (if (functionp help) | 498 | before returning it, as is done for `show-help-function'." |
| 499 | (let ((obj (if (overlayp button) button (current-buffer)))) | 499 | (let* ((help (button-get button 'help-echo)) |
| 500 | (funcall help (selected-window) obj (button-start button))) | 500 | (help (if (functionp help) |
| 501 | (eval help lexical-binding)))) | 501 | (funcall help |
| 502 | (selected-window) | ||
| 503 | (if (overlayp button) button (current-buffer)) | ||
| 504 | (button-start button)) | ||
| 505 | (eval help lexical-binding)))) | ||
| 506 | (and help (substitute-command-keys help)))) | ||
| 502 | 507 | ||
| 503 | (defun forward-button (n &optional wrap display-message no-error) | 508 | (defun forward-button (n &optional wrap display-message no-error) |
| 504 | "Move to the Nth next button, or Nth previous button if N is negative. | 509 | "Move to the Nth next button, or Nth previous button if N is negative. |