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.
(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)))
(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