Fix autoloads load order

Trying to start doom-example after enabling `scheme +guile` confirmed we
have at least one package (geiser-guile) that requires its dependency's
autoloads are loaded before its own are.

Fix it by assuming `package-activated-list` is in reverse order of
activation. That behavior is (as far as I could find) not documented,
but sufficiently obvious it seems safe enough to rely on it.
This commit is contained in:
Marien Zwart 2024-04-07 20:40:12 +10:00
parent 9fea22f0c5
commit d05ecd9b19
No known key found for this signature in database

14
cli2.el
View file

@ -39,9 +39,17 @@ it. Just skip it entirely."
(mapcar (lambda (s)
(format "%s.el"
(package--autoloads-file-name (package-get-descriptor s))))
(seq-difference package-activated-list
(mapcar #'intern-soft
doom-autoloads-excluded-packages)))
;; Packages are (currently...) pushed onto package-activated-list as
;; they are activated. Reverse the list here so packages activated
;; first get their autoloads loaded first.
;;
;; An example package that requires this is geiser-guile: it calls
;; geiser-activate-implementation from autoloads, requiring geiser's
;; autoloads are loaded first.
(nreverse
(seq-difference package-activated-list
(mapcar #'intern-soft
doom-autoloads-excluded-packages))))
doom-autoloads-excluded-files
'literal))