branch: master
commit a4095e8ee6f932e049cebd90ab41b95b869ce3e4
Author: Justin Burkett <jus...@burkett.cc>
Commit: Justin Burkett <jus...@burkett.cc>

    Fix handling of duplicate (evil) bindings in show keymap
---
 which-key.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/which-key.el b/which-key.el
index e4c372d..29b38f0 100644
--- a/which-key.el
+++ b/which-key.el
@@ -1707,8 +1707,12 @@ ones. PREFIX is for internal use and should not be used."
                      (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))))
+                      ;; this function keeps the latter of the two duplicates
+                      ;; which will be the evil binding
+                      (cl-remove-duplicates
+                       (append bindings
+                               (which-key--get-keymap-bindings def all prefix))
+                       :test (lambda (a b) (string= (car a) (car b))))))
                ((and (keymapp def)
                      (string-match-p which-key--evil-keys-regexp key-desc)))
                ((and (keymapp def)

Reply via email to