fix: lingering autoloads from inactive packages

A package's autoloads aren't expunged from Doom's profile init file,
even after that package has been disabled. If a package's autoloads has
side-effects, this can lead to void references/function errors. One such
case is with php-extras, which will try to call
`php-extras-company-setup` after company loads from its autoloads, but
this function naturally won't be loaded if the package is disabled.

This change fixes this, fully expunging orphaned autoloads on `doom
sync`.
This commit is contained in:
Henrik Lissner 2023-09-14 16:07:13 +02:00
parent eec8808f45
commit b58dc721aa
No known key found for this signature in database
GPG Key ID: B60957CA074D39A3

View File

@ -652,6 +652,7 @@ If ELPA-P, include packages installed with package.el (M-x package-install)."
(doom-initialize-packages)
(doom-packages--barf-if-incomplete)
(print! (start "Purging orphaned packages (for the emperor)..."))
(quiet! (straight-prune-build-cache))
(cl-destructuring-bind (&optional builds-to-purge repos-to-purge repos-to-regraft)
(let ((rdirs
(and (or repos-p regraft-repos-p)
@ -672,8 +673,7 @@ If ELPA-P, include packages installed with package.el (M-x package-install)."
nil (list
(if (not builds-p)
(ignore (print! (item "Skipping builds")))
(and (/= 0 (doom-packages--purge-builds builds-to-purge))
(quiet! (straight-prune-build-cache))))
(/= 0 (doom-packages--purge-builds builds-to-purge)))
(if (not elpa-p)
(ignore (print! (item "Skipping elpa packages")))
(/= 0 (doom-packages--purge-elpa)))