[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2c91540 35/39: Add support for evil's auxiliary maps in sh
From: |
Justin Burkett |
Subject: |
[elpa] master 2c91540 35/39: Add support for evil's auxiliary maps in show-keymap functions |
Date: |
Thu, 21 Jun 2018 15:48:18 -0400 (EDT) |
branch: master
commit 2c915407e15cc2f33d40a5efbc063596dc493991
Author: Justin Burkett <address@hidden>
Commit: Justin Burkett <address@hidden>
Add support for evil's auxiliary maps in show-keymap functions
---
which-key.el | 60 +++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 39 insertions(+), 21 deletions(-)
diff --git a/which-key.el b/which-key.el
index e371895..8c9784d 100644
--- a/which-key.el
+++ b/which-key.el
@@ -646,6 +646,12 @@ update.")
(defvar which-key--previous-frame-size nil)
(defvar which-key--prefix-title-alist nil)
(defvar which-key--debug nil)
+(defvar which-key--evil-keys-regexp (eval-when-compile
+ (regexp-opt '("-state"))))
+(defvar which-key--ignore-non-evil-keys-regexp
+ (eval-when-compile
+ (regexp-opt '("mouse-" "wheel-" "remap" "drag-" "scroll-bar"
+ "select-window" "switch-frame" "which-key-"))))
(defvar which-key--ignore-keys-regexp
(eval-when-compile
(regexp-opt '("mouse-" "wheel-" "remap" "drag-" "scroll-bar"
@@ -1692,27 +1698,39 @@ 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 (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)))
- (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)))))))))
+ (cond ((or (string-match-p
+ which-key--ignore-non-evil-keys-regexp key-desc)
+ (eq ev 'menu-bar)))
+ ;; extract evil keys corresponding to current state
+ ((and (keymapp def)
+ (boundp 'evil-state)
+ (bound-and-true-p evil-local-mode)
+ (string-match-p (format "<%s-state>$" evil-state)
key-desc))
+ (setq bindings
+ (append bindings
+ (which-key--get-keymap-bindings def all
prefix))))
+ ((and (keymapp def)
+ (string-match-p which-key--evil-keys-regexp key-desc)))
+ ((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))))
+ (t
+ (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))
- [elpa] master ff79dff 38/39: Version 3.3.0, (continued)
- [elpa] master ff79dff 38/39: Version 3.3.0, Justin Burkett, 2018/06/21
- [elpa] master 4042f06 34/39: Fix prefix bindings in which-key-show-major-mode, Justin Burkett, 2018/06/21
- [elpa] master 0dc4e84 36/39: Use window-size-change-functions for detecting size changes, Justin Burkett, 2018/06/21
- [elpa] master ab60391 21/39: Use cl-struct to hold which-key pages, Justin Burkett, 2018/06/21
- [elpa] master 0b2739a 27/39: Fix display of meta bindings in which-key-show-keymap, Justin Burkett, 2018/06/21
- [elpa] master f77d421 19/39: Consolidate key binding collection into which-key--get-bindings, Justin Burkett, 2018/06/21
- [elpa] master 4370658 29/39: Factor out which-key--this-command-keys function, Justin Burkett, 2018/06/21
- [elpa] master a4095e8 37/39: Fix handling of duplicate (evil) bindings in show keymap, Justin Burkett, 2018/06/21
- [elpa] master f251541 18/39: Refactor show keymap functions, Justin Burkett, 2018/06/21
- [elpa] master 8a878de 32/39: Version 3.2.0, Justin Burkett, 2018/06/21
- [elpa] master 2c91540 35/39: Add support for evil's auxiliary maps in show-keymap functions,
Justin Burkett <=
- [elpa] master bc97659 31/39: Fix and improve defcustoms, Justin Burkett, 2018/06/21
- [elpa] master ed7aa66 23/39: Remove a bunch of global variables, Justin Burkett, 2018/06/21
- [elpa] master fb09d75 39/39: Merge commit 'ff79dfff66f880885c5893dd6fd05dc51173a476', Justin Burkett, 2018/06/21