mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-05 11:45:45 +00:00
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.
This commit is contained in:
parent
5fbf93d918
commit
cee9a2cbe0
@ -1208,6 +1208,12 @@ Otherwise, return a new string."
|
||||
(and keymap
|
||||
(list keymap))
|
||||
t))))
|
||||
;; If we're looking in a particular keymap which has
|
||||
;; no binding, then we need to redo the lookup, with
|
||||
;; the global map as well this time.
|
||||
(when (and (not key) keymap)
|
||||
(setq key (with-current-buffer orig-buf
|
||||
(where-is-internal fun keymap t))))
|
||||
(if (not key)
|
||||
;; Function is not on any key.
|
||||
(let ((op (point)))
|
||||
|
@ -181,8 +181,12 @@ M-g M-c switch-to-completions
|
||||
|
||||
(ert-deftest help-tests-substitute-command-keys/keymap-change ()
|
||||
(with-substitute-command-keys-test
|
||||
;; Global binding should be found even if specifying a specific map
|
||||
(test "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]" "C-]")
|
||||
(test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x")))
|
||||
(test "\\<emacs-lisp-mode-map>\\[eval-defun]" "C-M-x")
|
||||
;; Specific map overrides advertised-binding
|
||||
(test "\\<undo-repeat-map>\\[undo]" "u")
|
||||
(test "\\[undo]" "C-x u")))
|
||||
|
||||
(defvar-keymap help-tests-remap-map
|
||||
:full t
|
||||
|
Loading…
Reference in New Issue
Block a user