Add doom-get-package-alist

New function returns a list of (NAME . DESC) cons cells in the order
they were declared (in module packages.el files).

Fixes a load-order issue where autoloads from one package would depend
on the autoloads of another package, but was inserted into
doom-package-autoload-file *before* the depended package, causing
void-variable errors.

Also allows for a big refactor of the :plugins byte-compile target.
This commit is contained in:
Henrik Lissner 2018-06-14 00:04:12 +02:00
parent 08a4701774
commit 69c6e0b8fb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 22 additions and 15 deletions

View file

@ -188,6 +188,23 @@ files."
((equal (plist-get plist :pin) pinned)))))
collect (cons sym plist)))
;;;###autoload
(defun doom-get-package-alist ()
"Returns a list of all desired packages, their dependencies and their desc
objects, in the order of their `package! blocks.'"
(doom-initialize-packages)
(cl-remove-duplicates
(let (packages)
(dolist (name (append (mapcar #'car doom-packages) doom-core-packages))
(when-let* ((desc (cadr (assq name package-alist))))
(push (cons name desc) packages)
(cl-loop for dep in (package--get-deps name)
if (assq dep package-alist)
do (push (cons dep (cadr it)) packages))))
packages)
:key #'car
:from-end t))
;;;###autoload
(defun doom-get-depending-on (name)
"Return a list of packages that depend on the package named NAME."