From 458d6bd0f2a48a5986fb93e624f9720707078ab6 Mon Sep 17 00:00:00 2001 From: James Nguyen Date: Thu, 4 Feb 2021 02:39:46 -0800 Subject: [PATCH] Tweak how annalist records bindings in evil-collection-define-operator-key --- evil-collection.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/evil-collection.el b/evil-collection.el index 658b631..1aa4ee6 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -359,7 +359,8 @@ binding in `annalist' as so." (while bindings (let* ((key (pop bindings)) (key-with-prefix (concat prefix key)) - (def + (def (pop bindings)) + (def-with-menu-item `(menu-item "" nil @@ -369,16 +370,21 @@ binding in `annalist' as so." (eq evil-this-operator (key-binding ,remap)) (memq evil-this-operator ,operators)) (setq evil-inhibit-operator t) - ',(pop bindings)))))) + ',def))))) (when (or (and whitelist (member key-with-prefix whitelist)) (not (member key-with-prefix blacklist))) (annalist-record 'evil-collection 'keybindings - (list map-sym 'operator key-with-prefix def) + ;; Record the binding as if it was in 'normal mode + ;; instead of 'operator mode as the user would be in + ;; normal mode when triggering the operator. + (list map-sym 'normal key-with-prefix def) :local (or (eq map-sym 'local) (local-variable-p map-sym))) ;; Use the original key declared when actually setting the binding. (push key filtered-bindings) - (push def filtered-bindings)))) + ;; Use the definition attached to the menu-item when setting the + ;; binding. + (push def-with-menu-item filtered-bindings)))) (setq filtered-bindings (nreverse filtered-bindings)) (evil-collection--define-key 'operator map-sym filtered-bindings)))