refactor!: replace doom-incremental-load-immediately var

BREAKING CHANGE: This removes the doom-incremental-load-immediately
variable. Instead, set doom-incremental-first-idle-timer to 0 to force
all iloaded packages be eagerly loaded at startup. This is already the
default behavior for daemon sessions.
This commit is contained in:
Henrik Lissner 2022-09-11 00:00:55 +02:00
parent bcf7a8a554
commit 0c43c769ef
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -84,17 +84,16 @@ If you want to disable incremental loading altogether, either remove
`doom-incremental-first-idle-timer' to nil. Incremental loading does not occur `doom-incremental-first-idle-timer' to nil. Incremental loading does not occur
in daemon sessions (they are loaded immediately at startup).") in daemon sessions (they are loaded immediately at startup).")
(defvar doom-incremental-first-idle-timer 2.0 (defvar doom-incremental-first-idle-timer (if (daemonp) 0 2.0)
"How long (in idle seconds) until incremental loading starts. "How long (in idle seconds) until incremental loading starts.
Set this to nil to disable incremental loading.") Set this to nil to disable incremental loading.
Set this to 0 to load all incrementally deferred packages immediately at
`emacs-startup-hook'.")
(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.
@ -140,9 +139,9 @@ 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 doom-incremental-load-immediately (when (numberp doom-incremental-first-idle-timer)
(mapc #'require (cdr doom-incremental-packages)) (if (zerop doom-incremental-first-idle-timer)
(when (numberp doom-incremental-first-idle-timer) (mapc #'require (cdr doom-incremental-packages))
(run-with-idle-timer doom-incremental-first-idle-timer (run-with-idle-timer doom-incremental-first-idle-timer
nil #'doom-load-packages-incrementally nil #'doom-load-packages-incrementally
(cdr doom-incremental-packages) t)))) (cdr doom-incremental-packages) t))))