branch: elpa/evil commit 9daad9cca5e44887c5408b3cbbeb437b8fb80fa8 Author: Axel Forsman <axels...@gmail.com> Commit: Axel Forsman <axels...@gmail.com>
Use extended-format menu item for leader bindings This fixes the issue of the evil-send-(local-)leader commands being recognized as the motion while in Operator-pending state. Additionally, describe-key (C-h k) can now be used to lookup keybindings using leader. Note that simply binding [(local-)leader] keyboard macros would not work, since then the command would not receive the prefix argument. Closes #1711 --- evil-core.el | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/evil-core.el b/evil-core.el index b43c1545d1..2205ea525c 100644 --- a/evil-core.el +++ b/evil-core.el @@ -926,20 +926,6 @@ A return value of t means all states." (t state)))) -(defun evil-send-leader () - "Put symbol leader in `unread-command-events' to trigger any -<leader> bindings." - (interactive) - (setq prefix-arg current-prefix-arg) - (push '(t . leader) unread-command-events)) - -(defun evil-send-localleader () - "Put symbol localleader in `unread-command-events' to trigger any -<localleader> bindings." - (interactive) - (setq prefix-arg current-prefix-arg) - (push '(t . localleader) unread-command-events)) - (defun evil-set-leader (state key &optional localleader) "Set KEY to trigger leader bindings in STATE. KEY should be in the form produced by `kbd'. STATE is one of @@ -951,7 +937,9 @@ instead." (states (cond ((null state) all-states) ((consp state) state) (t (list state)))) - (binding (if localleader #'evil-send-localleader #'evil-send-leader))) + (leaderkey (if localleader [localleader] [leader])) + (binding + `(menu-item "" nil :filter ,(lambda (_cmd) (key-binding leaderkey))))) (dolist (state states) (evil-global-set-key state key binding))))