From 502def36c0228854b5f0ef962c4084a6c0119143 Mon Sep 17 00:00:00 2001 From: noctuid Date: Sat, 14 Apr 2018 17:17:40 -0400 Subject: [PATCH] Optionally provide modes to evil-collection-init --- evil-collection.el | 12 +++++++++--- readme.org | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/evil-collection.el b/evil-collection.el index 884f318..937d03c 100644 --- a/evil-collection.el +++ b/evil-collection.el @@ -256,7 +256,7 @@ should consist of key swaps (e.g. \"a\" \"b\" is equivalent to \"a\" \"b\" \"b\" `(evil-collection-translate-key ,states ,keymaps ,@args)) ;;;###autoload -(defun evil-collection-init () +(defun evil-collection-init (&optional modes) "Register the Evil bindings for all modes in `evil-collection-mode-list'. Alternatively, you may register select bindings manually, for @@ -264,9 +264,15 @@ instance: (with-eval-after-load 'calendar (require 'evil-collection-calendar) - (evil-collection-calendar-setup))" + (evil-collection-calendar-setup)) + +If MODES is specified (as either one mode or a list of modes), use those modes +instead of the modes in `evil-collection-mode-list'." (interactive) - (dolist (mode evil-collection-mode-list) + (if modes + (or (listp modes) (setq modes (list modes))) + (setq modes evil-collection-mode-list)) + (dolist (mode modes) (let ((m mode) (reqs (list mode))) (when (listp mode) diff --git a/readme.org b/readme.org index d5fab97..7912b66 100644 --- a/readme.org +++ b/readme.org @@ -41,6 +41,10 @@ some default bindings to change in the future. : (with-eval-after-load 'calendar (require 'evil-collection-calendar) (evil-collection-calendar-setup)) + or by providing an argument to ~evil-collection-init~: + + : (evil-collection-init 'calendar) + The list of supported modes is configured by ~~evil-collection-mode-list~~. ~evil-collection~ assumes ~evil-want-integration~ is set to nil before loading ~evil~ and ~evil-collection.~