fix: doom-incremental-first-idle-timer: type error when nil (part 2)

Amend: 2bce9dbc1a
Ref: #7710
This commit is contained in:
Henrik Lissner 2024-03-11 02:50:33 -04:00
parent e27d9b35d3
commit 4be265ead7
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -211,9 +211,13 @@ Set this to 0 to load all incrementally deferred packages immediately at
(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, PACKAGES will be marked for incremental loading next time
intervals." Emacs is idle for `doom-incremental-first-idle-timer' seconds (falls back to
(let ((gc-cons-threshold most-positive-fixnum)) `doom-incremental-idle-timer'), then in `doom-incremental-idle-timer' intervals
afterwards."
(let* ((gc-cons-threshold most-positive-fixnum)
(first-idle-timer (or doom-incremental-first-idle-timer
doom-incremental-idle-timer)))
(if (not now) (if (not now)
(cl-callf append doom-incremental-packages packages) (cl-callf append doom-incremental-packages packages)
(while packages (while packages
@ -224,7 +228,7 @@ intervals."
(condition-case-unless-debug e (condition-case-unless-debug e
(and (and
(or (null (setq idle-time (current-idle-time))) (or (null (setq idle-time (current-idle-time)))
(< (float-time idle-time) (or doom-incremental-first-idle-timer 0.0)) (< (float-time idle-time) first-idle-timer)
(not (not
(while-no-input (while-no-input
(doom-log "start:iloader: Loading %s (%d left)" req (length packages)) (doom-log "start:iloader: Loading %s (%d left)" req (length packages))
@ -244,7 +248,7 @@ intervals."
(doom-log "start:iloader: Finished!") (doom-log "start:iloader: Finished!")
(run-at-time (if idle-time (run-at-time (if idle-time
doom-incremental-idle-timer doom-incremental-idle-timer
doom-incremental-first-idle-timer) first-idle-timer)
nil #'doom-load-packages-incrementally nil #'doom-load-packages-incrementally
packages t) packages t)
(setq packages nil)))))))) (setq packages nil))))))))