Warn us if evil-collection module loads too early

This commit is contained in:
Henrik Lissner 2019-05-17 20:23:52 -04:00
parent 3ed54e191b
commit 507fb50ff2
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -167,14 +167,20 @@ variable for an explanation of the defaults (in comments). See
(ztree ztree-diff))) (ztree ztree-diff)))
(defun +evil-collection-init (module) (defun +evil-collection-init (module)
"Initialize evil-collection-MODULE.
Unlike `evil-collection-init', this respects `+evil-collection-disabled-list',
and complains if a module is loaded too early (during startup)."
(unless (memq (or (car-safe module) module) +evil-collection-disabled-list) (unless (memq (or (car-safe module) module) +evil-collection-disabled-list)
(doom-log "Initialized evil-collection-%s" (or (car-safe module) module)) (let ((module-sym (or (car-safe module) module)))
(doom-log "Initialized evil-collection-%s %s"
module-sym (if doom-init-time "" "(too early!)")))
(with-demoted-errors "evil-collection error: %s" (with-demoted-errors "evil-collection error: %s"
(evil-collection-init (list module))))) (evil-collection-init (list module)))))
;; ;;
;; Bootstrap ;;; Bootstrap
;; These modes belong to packages that Emacs always loads at startup, causing ;; 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 to load immediately. We avoid this by loading them after