diff --git a/bin/doom b/bin/doom index a1c391f26..255d68c99 100755 --- a/bin/doom +++ b/bin/doom @@ -294,7 +294,7 @@ SEE ALSO: (let ((cli-file "cli")) (defcli-group! "Module commands" - (dolist (key (hash-table-keys doom-modules)) + (dolist (key (doom-module-list)) (when-let (path (doom-module-expand-path (car key) (cdr key) cli-file)) (defcli-group! :prefix (format "+%s" (cdr key)) (doom-load path t))))) diff --git a/lisp/doom-modules.el b/lisp/doom-modules.el index 4ff2678ba..5fe001374 100644 --- a/lisp/doom-modules.el +++ b/lisp/doom-modules.el @@ -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))) ;; diff --git a/lisp/doom-packages.el b/lisp/doom-packages.el index 6edc1a619..b416d1c79 100644 --- a/lisp/doom-packages.el +++ b/lisp/doom-packages.el @@ -452,8 +452,7 @@ ones." (doom--read-packages (doom-path doom-core-dir packages-file) all-p 'noerror) (unless core-only-p - (let ((private-packages (doom-path doom-user-dir packages-file)) - (doom-modules (doom-module-list))) + (let ((private-packages (doom-path doom-user-dir packages-file))) (if all-p (mapc #'doom--read-packages (doom-files-in doom-modules-dir @@ -465,10 +464,10 @@ ones." ;; overwritten. (let (doom-packages) (doom--read-packages private-packages nil 'noerror)) - (cl-loop for key being the hash-keys of doom-modules - for path = (doom-module-expand-path (car key) (cdr key) packages-file) - for doom--current-module = key - for doom--current-flags = (doom-module-get (car key) (cdr key) :flags) + (cl-loop for (cat . mod) in (doom-module-list) + for path = (doom-module-expand-path cat mod packages-file) + for doom--current-module = (cons cat mod) + for doom--current-flags = (doom-module-get cat mod :flags) do (doom--read-packages path nil 'noerror))) (doom--read-packages private-packages all-p 'noerror))) (cl-remove-if-not diff --git a/lisp/lib/debug.el b/lisp/lib/debug.el index 913cbcfbf..75b814c44 100644 --- a/lisp/lib/debug.el +++ b/lisp/lib/debug.el @@ -300,15 +300,15 @@ ready to be pasted in a bug report on github." if (eq type 'theme-value) collect var))) (modules - ,@(or (cl-loop with cat = nil - for key being the hash-keys of doom-modules - if (or (not cat) - (not (eq cat (car key)))) - do (setq cat (car key)) - and collect cat + ,@(or (cl-loop with lastcat = nil + for (cat . mod) in (cddr (doom-module-list)) + if (or (not lastcat) + (not (eq lastcat cat))) + do (setq lastcat cat) + and collect lastcat collect - (let* ((flags (doom-module-get cat (cdr key) :flags)) - (path (doom-module-get cat (cdr key) :path)) + (let* ((flags (doom-module-get lastcat mod :flags)) + (path (doom-module-get lastcat mod :path)) (module (append (cond ((null path) @@ -316,8 +316,8 @@ ready to be pasted in a bug report on github." ((not (file-in-directory-p path doom-modules-dir)) (list '&user))) (if flags - `(,(cdr key) ,@flags) - (list (cdr key)))))) + `(,mod ,@flags) + (list mod))))) (if (= (length module) 1) (car module) module))) diff --git a/lisp/lib/help.el b/lisp/lib/help.el index 11e7968f4..121880f7b 100644 --- a/lisp/lib/help.el +++ b/lisp/lib/help.el @@ -342,8 +342,7 @@ without needing to check if they are available." (describe-function fn)))) (defun doom--help-modules-list () - (cl-loop for path in (cdr (doom-module-load-path 'all)) - for (cat . mod) = (doom-module-from-path path) + (cl-loop for (cat . mod) in (doom-module-list 'all) for readme-path = (or (doom-module-locate-path cat mod "README.org") (doom-module-locate-path cat mod)) for format = (format "%s %s" cat mod)