fix(lib): package! not overriding defaults

This regression was introduced in 5a5195b; it broke `package!`s ability
to override the recipes of packages declared by other modules, due to
some API assumptions that aren't true yet (in unpushed post 3.1 work).

Amend: 5a5195b84d
Fix: #6901
This commit is contained in:
Henrik Lissner 2022-10-22 20:02:36 +02:00
parent d25ff46d46
commit a1f8063485
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -446,27 +446,29 @@ If MODULE-LIST is omitted, read enabled module list in configdepth order (see
`doom-module-set'). Otherwise, MODULE-LIST may be any symbol (or t) to mean read `doom-module-set'). Otherwise, MODULE-LIST may be any symbol (or t) to mean read
all modules in `doom-modules-dir', including :core and :user. MODULE-LIST may all modules in `doom-modules-dir', including :core and :user. MODULE-LIST may
also be a list of module keys." also be a list of module keys."
(let ((module-list (cond ((null module-list) (doom-module-list)) (let ((module-list (cond ((null module-list) (doom-module-list))
((symbolp module-list) (doom-module-list 'all)) ((symbolp module-list) (doom-module-list 'all))
(module-list))) (module-list)))
(packages-file doom-module-packages-file) (packages-file doom-module-packages-file)
doom-disabled-packages doom-disabled-packages
doom-packages) doom-packages)
(letf! (defun read-packages (key) (letf! (defun read-packages (key)
(doom-module-context-with key (doom-module-context-with key
(when-let (file (doom-module-locate-path (when-let (file (doom-module-locate-path
(car key) (cdr key) doom-module-packages-file)) (car key) (cdr key) doom-module-packages-file))
(doom-packages--read file nil 'noerror)))) (doom-packages--read file nil 'noerror))))
(doom-context-with 'packages (doom-context-with 'packages
(when (assq :user module-list) (let ((user? (assq :user module-list)))
(when user?
;; We load the private packages file twice to populate ;; We load the private packages file twice to populate
;; `doom-disabled-packages' disabled packages are seen ASAP, and a ;; `doom-disabled-packages' disabled packages are seen ASAP...
;; second time to ensure privately overridden packages are properly
;; overwritten.
(let (doom-packages) (let (doom-packages)
(read-packages (cons :user nil)))) (read-packages (cons :user nil))))
(mapc #'read-packages module-list) (mapc #'read-packages module-list)
(nreverse doom-packages))))) ;; ...Then again to ensure privately overriden packages are properly
;; overwritten.
(if user? (read-packages (cons :user nil)))
(nreverse doom-packages))))))
(defun doom-package-pinned-list () (defun doom-package-pinned-list ()
"Return an alist mapping package names (strings) to pinned commits (strings)." "Return an alist mapping package names (strings) to pinned commits (strings)."