From 01618da3bb1e18b063beeb9cedfd038feb01d121 Mon Sep 17 00:00:00 2001 From: James Nguyen Date: Sat, 28 May 2022 18:12:16 -0400 Subject: [PATCH] Add function to check if key can be bound --- evil-collection.el | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/evil-collection.el b/evil-collection.el index 46b8537..fedcd93 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -476,6 +476,13 @@ to filter keys on the basis of `evil-collection-key-whitelist' and (setq filtered-bindings (nreverse filtered-bindings)) (evil-collection--define-key states-to-bind map-sym filtered-bindings)))) +(defun evil-collection-can-bind-key (key) + "Return whether or not we should bind KEY." + (let* ((whitelist (mapcar 'kbd evil-collection-key-whitelist)) + (blacklist (mapcar 'kbd evil-collection-key-blacklist))) + (or (and whitelist (member key whitelist)) + (not (member key blacklist))))) + (defun evil-collection--define-key (state map-sym bindings) "Workhorse function for `evil-collection-define-key'.