mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
feat: add doom-module-locate-paths function
This is a common idiom within Doom's internals, to create a list of (existing) module files in any desired order.
This commit is contained in:
@ -189,6 +189,16 @@ returns nil, otherwise an absolute path."
|
|||||||
if (file-exists-p path)
|
if (file-exists-p path)
|
||||||
return (expand-file-name path)))))))
|
return (expand-file-name path)))))))
|
||||||
|
|
||||||
|
(defun doom-module-locate-paths (module-list file)
|
||||||
|
"Return all existing paths to FILE under each module in MODULE-LIST.
|
||||||
|
|
||||||
|
MODULE-LIST is a list of cons cells (GROUP . NAME). See `doom-module-list' for
|
||||||
|
an example."
|
||||||
|
(cl-loop with file = (file-name-sans-extension file)
|
||||||
|
for (group . name) in module-list
|
||||||
|
if (doom-module-locate-path group name file)
|
||||||
|
collect it))
|
||||||
|
|
||||||
(defun doom-module-from-path (path &optional enabled-only)
|
(defun doom-module-from-path (path &optional enabled-only)
|
||||||
"Returns a cons cell (CATEGORY . MODULE) derived from PATH (a file path).
|
"Returns a cons cell (CATEGORY . MODULE) derived from PATH (a file path).
|
||||||
If ENABLED-ONLY, return nil if the containing module isn't enabled."
|
If ENABLED-ONLY, return nil if the containing module isn't enabled."
|
||||||
|
Reference in New Issue
Block a user