Refactor evil-collection-init code

Make it possible to disable image-mode and elisp-mode evil-collection
modules.
This commit is contained in:
Henrik Lissner 2018-06-26 18:43:27 +02:00
parent 7d59b9c5a5
commit fe235c341d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -221,8 +221,12 @@ variable for an explanation of the defaults (in comments). See
"ZQ" 'evil-quit
"ZZ" 'quit-window))
(add-transient-hook! 'image-mode (evil-collection-init 'image))
(add-transient-hook! 'emacs-lisp-mode (evil-collection-init 'elisp-mode))
(defun +evil-collection-init (module)
(unless (memq (or (car-safe module) module) +evil-collection-disabled-list)
(evil-collection-init (list module))))
(add-transient-hook! 'image-mode (+evil-collection-init 'image))
(add-transient-hook! 'emacs-lisp-mode (+evil-collection-init 'elisp-mode))
(defvar evil-collection-mode-list
'(ace-jump-mode
@ -328,10 +332,8 @@ variable for an explanation of the defaults (in comments). See
(ztree ztree-diff)))
(dolist (req evil-collection-mode-list)
(let ((feature (car (doom-enlist req))))
(with-eval-after-load feature
(unless (memq feature +evil-collection-disabled-list)
(evil-collection-init (list req))))))))
(with-eval-after-load (car (doom-enlist req))
(+evil-collection-init (list req))))))
;;