diff options
| author | Robert Pluim | 2022-09-21 09:12:53 +0200 |
|---|---|---|
| committer | Robert Pluim | 2022-09-21 09:15:47 +0200 |
| commit | cee9a2cbe0cd2cb1af602077727c03f2ae62fa90 (patch) | |
| tree | f61fde18b86fa47ae9a49694529442bca2746d1f | |
| parent | 5fbf93d918ba85afa8506569328dfc9c510cee42 (diff) | |
| download | emacs-cee9a2cbe0cd2cb1af602077727c03f2ae62fa90.tar.gz emacs-cee9a2cbe0cd2cb1af602077727c03f2ae62fa90.zip | |
Fix substitute-command-keys for global binding lookup
The previous change forgot to account for the (rare) case of doing a
lookup for a global binding when a specific keymap is in force.
* lisp/help.el (substitute-command-keys): Redo lookup in global map if
lookup in specific map fails.
*
test/lisp/help-tests.el (help-tests-substitute-command-keys/keymap-change):
Add testcase for specific map overriding advertised-binding.
| -rw-r--r-- | lisp/help.el | 6 | ||||
| -rw-r--r-- | test/lisp/help-tests.el | 6 |
2 files changed, 11 insertions, 1 deletions
diff --git a/lisp/help.el b/lisp/help.el index 0ec5b9c85b8..b4b9120da3e 100644 --- a/lisp/help.el +++ b/lisp/help.el | |||
| @@ -1208,6 +1208,12 @@ Otherwise, return a new string." | |||
| 1208 | (and keymap | 1208 | (and keymap |
| 1209 | (list keymap)) | 1209 | (list keymap)) |
| 1210 | t)))) | 1210 | t)))) |
| 1211 | ;; If we're looking in a particular keymap which has | ||
| 1212 | ;; no binding, then we need to redo the lookup, with | ||
| 1213 | ;; the global map as well this time. | ||
| 1214 | (when (and (not key) keymap) | ||
| 1215 | (setq key (with-current-buffer orig-buf | ||
| 1216 | (where-is-internal fun keymap t)))) | ||
| 1211 | (if (not key) | 1217 | (if (not key) |
| 1212 | ;; Function is not on any key. | 1218 | ;; Function is not on any key. |
| 1213 | (let ((op (point))) | 1219 | (let ((op (point))) |
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 6f1dcfa5b6b..0fcaacb6443 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el | |||
| @@ -181,8 +181,12 @@ M-g M-c switch-to-completions | |||
| 181 | 181 | ||
| 182 | (ert-deftest help-tests-substitute-command-keys/keymap-change () | 182 | (ert-deftest help-tests-substitute-command-keys/keymap-change () |
| 183 | (with-substitute-command-keys-test | 183 | (with-substitute-command-keys-test |
| 184 | ;; Global binding should be found even if specifying a specific map | ||
| 184 | (test "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]" "C-]") | 185 | (test "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]" "C-]") |
| 185 | (test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x"))) | 186 | (test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x") |
| 187 | ;; Specific map overrides advertised-binding | ||
| 188 | (test "\\<undo-repeat-map>\\[undo]" "u") | ||
| 189 | (test "\\[undo]" "C-x u"))) | ||
| 186 | 190 | ||
| 187 | (defvar-keymap help-tests-remap-map | 191 | (defvar-keymap help-tests-remap-map |
| 188 | :full t | 192 | :full t |