branch: master commit 4042f06564f450838c8ed79d7c0d1bce3124200d Author: Justin Burkett <jus...@burkett.cc> Commit: Justin Burkett <jus...@burkett.cc>
Fix prefix bindings in which-key-show-major-mode --- which-key.el | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/which-key.el b/which-key.el index c6b89ba..e371895 100644 --- a/which-key.el +++ b/which-key.el @@ -1476,16 +1476,21 @@ which are strings. KEY is of the form produced by `key-binding'." (intern (cdr keydesc)))) (defun which-key--map-binding-p (map keydesc) + "Does MAP contain KEYDESC = (key . binding)?" (or (when (bound-and-true-p evil-state) - (eq (which-key--safe-lookup-key - map - (kbd (which-key--current-key-string - (format "<%s-state> %s" evil-state (car keydesc))))) - (intern (cdr keydesc)))) - (eq (which-key--safe-lookup-key - map (kbd (which-key--current-key-string (car keydesc)))) - (intern (cdr keydesc))))) + (let ((lookup + (which-key--safe-lookup-key + map + (kbd (which-key--current-key-string + (format "<%s-state> %s" evil-state (car keydesc))))))) + (or (eq lookup (intern (cdr keydesc))) + (and (keymapp lookup) (string= (cdr keydesc) "Prefix Command"))))) + (let ((lookup + (which-key--safe-lookup-key + map (kbd (which-key--current-key-string (car keydesc)))))) + (or (eq lookup (intern (cdr keydesc))) + (and (keymapp lookup) (string= (cdr keydesc) "Prefix Command")))))) (defun which-key--pseudo-key (key &optional prefix) "Replace the last key in the sequence KEY by a special symbol