mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-02 03:40:36 -08:00
Allow for nil local-map. Fixes #57
This commit is contained in:
parent
d613dfe395
commit
32c57075a3
1 changed files with 7 additions and 3 deletions
10
which-key.el
10
which-key.el
|
|
@ -712,6 +712,10 @@ width) in lines and characters respectively."
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Functions for retrieving and formatting keys
|
||||
|
||||
(defsubst which-key--safe-lookup-key (keymap key)
|
||||
"Version of `lookup-key' that allows KEYMAP to be nil. KEY is not checked."
|
||||
(when (keymapp keymap) (lookup-key keymap key)))
|
||||
|
||||
(defun which-key--maybe-replace (string repl-alist &optional literal)
|
||||
"Perform replacements on STRING.
|
||||
REPL-ALIST is an alist where the car of each element is the text
|
||||
|
|
@ -796,7 +800,7 @@ alists. Returns a list (key separator description)."
|
|||
(desc (cdr key-desc-cons))
|
||||
(group (which-key--group-p desc))
|
||||
(keys (concat (key-description which-key--current-prefix) " " key))
|
||||
(local (eq (lookup-key local-map (kbd keys)) (intern desc)))
|
||||
(local (eq (which-key--safe-lookup-key local-map (kbd keys)) (intern desc)))
|
||||
(key (which-key--maybe-replace
|
||||
key which-key-key-replacement-alist))
|
||||
(desc (which-key--maybe-replace
|
||||
|
|
@ -1142,9 +1146,9 @@ Finally, show the buffer."
|
|||
(or
|
||||
(keymapp (key-binding prefix-keys))
|
||||
;; Some keymaps are stored here like iso-transl-ctl-x-8-map
|
||||
(keymapp (lookup-key key-translation-map prefix-keys))
|
||||
(keymapp (which-key--safe-lookup-key key-translation-map prefix-keys))
|
||||
;; just in case someone uses one of these
|
||||
(keymapp (lookup-key function-key-map prefix-keys)))
|
||||
(keymapp (which-key--safe-lookup-key function-key-map prefix-keys)))
|
||||
(not which-key-inhibit))
|
||||
(which-key--create-buffer-and-show prefix-keys))))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue