refactor: change doom-module-list signature

Used to return the hash-table `doom-modules` (if not all-p), but I've
changed it to return a list of cons cells (:CATEGORY . MODULE),
representing all enabled modules, in the order they were enabled.

The purpose of this change is to prepare for a change in the structure
of doom-modules, and how Doom stores its module metadata.
This commit is contained in:
Henrik Lissner 2022-09-12 22:50:25 +02:00
parent 775ee2f04a
commit 0c918f3b2d
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
5 changed files with 26 additions and 24 deletions

View file

@ -249,8 +249,8 @@ those directories. The first returned path is always `doom-user-dir'."
:mindepth 1
:depth 1)))
(delq
nil (cl-loop for plist being the hash-values of doom-modules
collect (plist-get plist :path)) ))
nil (cl-loop for (cat . mod) in (doom-module-list)
collect (doom-module-get cat mod :path))))
nil))
(defun doom-module-mplist-map (fn mplist)
@ -309,11 +309,15 @@ those directories. The first returned path is always `doom-user-dir'."
(nreverse results)))
(defun doom-module-list (&optional all-p)
"Minimally initialize `doom-modules' (a hash table) and return it.
This value is cached. If REFRESH-P, then don't use the cached value."
"Return modules as a list of (:CATEGORY . MODULE) in their enabled order.
If ALL-P, return a list of *all* available modules instead, whether or not
they're enabled, and in lexicographical order.
If ALL-P is `real', only return *real"
(if all-p
(mapcar #'doom-module-from-path (cdr (doom-module-load-path 'all)))
doom-modules))
(hash-table-keys doom-modules)))
;;