branch: master
commit 0b2739a2bedfb117afc39e9101bdd2ec0a120897
Author: Justin Burkett <[email protected]>
Commit: Justin Burkett <[email protected]>
Fix display of meta bindings in which-key-show-keymap
---
which-key.el | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/which-key.el b/which-key.el
index a6a4c3e..c76b653 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1687,20 +1687,27 @@ ones. PREFIX is for internal use and should not be
used."
(lambda (ev def)
(let* ((key (append prefix (list ev)))
(key-desc (key-description key)))
- (unless (string-match-p which-key--ignore-keys-regexp key-desc)
- (if (and all (keymapp def))
+ (unless (or (string-match-p which-key--ignore-keys-regexp key-desc)
+ (eq ev 'menu-bar))
+ (if (and (keymapp def)
+ (or all
+ ;; event 27 is escape, so this will pick up meta
+ ;; bindings and hopefully not too much more
+ (and (numberp ev) (= ev 27))))
(setq bindings
(append bindings
(which-key--get-keymap-bindings def t key)))
- (cl-pushnew
- (cons key-desc
- (cond
- ((keymapp def) "Prefix Command")
- ((symbolp def) (copy-sequence (symbol-name def)))
- ((eq 'lambda (car-safe def)) "lambda")
- ((eq 'menu-item (car-safe def)) "menu-item")
- (t (format "%s" def))))
- bindings :test (lambda (a b) (string= (car a) (car b))))))))
+ (when def
+ (cl-pushnew
+ (cons key-desc
+ (cond
+ ((keymapp def) "Prefix Command")
+ ((symbolp def) (copy-sequence (symbol-name def)))
+ ((eq 'lambda (car-safe def)) "lambda")
+ ((eq 'menu-item (car-safe def)) "menu-item")
+ ((stringp def) def)
+ (t "unknown")))
+ bindings :test (lambda (a b) (string= (car a) (car b)))))))))
keymap)
bindings))