Ensure evil-collection doesn't load early

This commit is contained in:
Henrik Lissner 2020-08-17 18:00:11 -04:00
parent 8fa5b9406c
commit 1c9918e61e
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -225,6 +225,11 @@ and complains if a module is loaded too early (during startup)."
(with-demoted-errors "evil-collection error: %s"
(evil-collection-init (list module)))))
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
(let (evil-collection-key-blacklist)
(funcall-interactively orig-fn)))
;; These modes belong to packages that Emacs always loads at startup, causing
;; evil-collection to load immediately. We avoid this by loading them after
;; evil-collection has first loaded...
@ -245,12 +250,8 @@ and complains if a module is loaded too early (during startup)."
(mapc #'+evil-collection-init '(comint custom help)))
(defadvice! +evil-collection-disable-blacklist-a (orig-fn)
:around #'evil-collection-vterm-toggle-send-escape ; allow binding to ESC
(let (evil-collection-key-blacklist)
(funcall-interactively orig-fn)))
;; ...or on first invokation of their associated major/minor modes.
(after! evil
(add-transient-hook! 'Buffer-menu-mode
(+evil-collection-init '(buff-menu "buff-menu")))
(add-transient-hook! 'image-mode
@ -275,4 +276,4 @@ and complains if a module is loaded too early (during startup)."
(dolist (mode evil-collection-mode-list)
(dolist (req (or (cdr-safe mode) (list mode)))
(with-eval-after-load req
(+evil-collection-init mode +evil-collection-disabled-list)))))
(+evil-collection-init mode +evil-collection-disabled-list))))))