Refactor require! macro
This commit is contained in:
parent
2ef38b73a7
commit
df93fd8ce4
1 changed files with 12 additions and 14 deletions
|
@ -400,21 +400,19 @@ If NOERROR is non-nil, don't throw an error if the file doesn't exist."
|
||||||
"Loads the module specified by MODULE (a property) and SUBMODULE (a symbol).
|
"Loads the module specified by MODULE (a property) and SUBMODULE (a symbol).
|
||||||
|
|
||||||
The module is only loaded once. If RELOAD-P is non-nil, load it again."
|
The module is only loaded once. If RELOAD-P is non-nil, load it again."
|
||||||
(let ((loaded-p (doom-module-loaded-p module submodule)))
|
(when (or reload-p (not (doom-module-loaded-p module submodule)))
|
||||||
(when (or reload-p (not loaded-p))
|
(let ((module-path (doom-module-path module submodule)))
|
||||||
(unless loaded-p
|
(if (not (file-directory-p module-path))
|
||||||
(doom-module-enable module submodule flags))
|
|
||||||
(let ((module-path (doom-module-path module submodule)))
|
|
||||||
(if (file-directory-p module-path)
|
|
||||||
`(condition-case-unless-debug ex
|
|
||||||
(load! config ,module-path t)
|
|
||||||
('error
|
|
||||||
(lwarn 'doom-modules :error
|
|
||||||
"%s in '%s %s' -> %s"
|
|
||||||
(car ex) ,module ',submodule
|
|
||||||
(error-message-string ex))))
|
|
||||||
(lwarn 'doom-modules :warning "Couldn't find module '%s %s'"
|
(lwarn 'doom-modules :warning "Couldn't find module '%s %s'"
|
||||||
module submodule))))))
|
module submodule)
|
||||||
|
(doom-module-enable module submodule flags)
|
||||||
|
`(condition-case-unless-debug ex
|
||||||
|
(load! config ,module-path t)
|
||||||
|
('error
|
||||||
|
(lwarn 'doom-modules :error
|
||||||
|
"%s in '%s %s' -> %s"
|
||||||
|
(car ex) ,module ',submodule
|
||||||
|
(error-message-string ex))))))))
|
||||||
|
|
||||||
(defmacro featurep! (module &optional submodule flag)
|
(defmacro featurep! (module &optional submodule flag)
|
||||||
"A convenience macro wrapper for `doom-module-loaded-p'. It is evaluated at
|
"A convenience macro wrapper for `doom-module-loaded-p'. It is evaluated at
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue