Optionally provide modes to evil-collection-init

This commit is contained in:
noctuid 2018-04-14 17:17:40 -04:00 committed by James N
parent 0d3c3b7bc3
commit 502def36c0
2 changed files with 13 additions and 3 deletions

View File

@ -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)) `(evil-collection-translate-key ,states ,keymaps ,@args))
;;;###autoload ;;;###autoload
(defun evil-collection-init () (defun evil-collection-init (&optional modes)
"Register the Evil bindings for all modes in `evil-collection-mode-list'. "Register the Evil bindings for all modes in `evil-collection-mode-list'.
Alternatively, you may register select bindings manually, for Alternatively, you may register select bindings manually, for
@ -264,9 +264,15 @@ instance:
(with-eval-after-load 'calendar (with-eval-after-load 'calendar
(require 'evil-collection-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) (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) (let ((m mode)
(reqs (list mode))) (reqs (list mode)))
(when (listp mode) (when (listp mode)

View File

@ -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)) : (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~~. 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.~ ~evil-collection~ assumes ~evil-want-integration~ is set to nil before loading ~evil~ and ~evil-collection.~