Add doom-incremental-load-immediately option

Closes #3063
This commit is contained in:
Henrik Lissner 2020-05-08 16:06:55 -04:00
parent 4347cc5277
commit 42a21dffdd
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -379,13 +379,16 @@ Set this to nil to disable incremental loading.")
(defvar doom-incremental-idle-timer 0.75 (defvar doom-incremental-idle-timer 0.75
"How long (in idle seconds) in between incrementally loading packages.") "How long (in idle seconds) in between incrementally loading packages.")
(defvar doom-incremental-load-immediately (daemonp)
"If non-nil, load all incrementally deferred packages immediately at startup.")
(defun doom-load-packages-incrementally (packages &optional now) (defun doom-load-packages-incrementally (packages &optional now)
"Registers PACKAGES to be loaded incrementally. "Registers PACKAGES to be loaded incrementally.
If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer' If NOW is non-nil, load PACKAGES incrementally, in `doom-incremental-idle-timer'
intervals." intervals."
(if (not now) (if (not now)
(nconc doom-incremental-packages packages) (appendq! doom-incremental-packages packages)
(while packages (while packages
(let ((req (pop packages))) (let ((req (pop packages)))
(unless (featurep req) (unless (featurep req)
@ -415,7 +418,7 @@ intervals."
"Begin incrementally loading packages in `doom-incremental-packages'. "Begin incrementally loading packages in `doom-incremental-packages'.
If this is a daemon session, load them all immediately instead." If this is a daemon session, load them all immediately instead."
(if (daemonp) (if doom-incremental-load-immediately
(mapc #'require (cdr doom-incremental-packages)) (mapc #'require (cdr doom-incremental-packages))
(when (numberp doom-incremental-first-idle-timer) (when (numberp doom-incremental-first-idle-timer)
(run-with-idle-timer doom-incremental-first-idle-timer (run-with-idle-timer doom-incremental-first-idle-timer