Revise featurep! docstring & error message

This commit is contained in:
Henrik Lissner 2019-04-20 02:17:51 -04:00
parent 7e7d6ae5a2
commit 3e74b339c7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -427,8 +427,9 @@ to have them return non-nil (or exploit that to overwrite Doom's config)."
,category ',module)))) ,category ',module))))
(defmacro featurep! (category &optional module flag) (defmacro featurep! (category &optional module flag)
"Returns t if CATEGORY MODULE is enabled. If FLAG is provided, returns t if "Returns t if CATEGORY MODULE is enabled.
CATEGORY MODULE has FLAG enabled.
If FLAG is provided, returns t if CATEGORY MODULE has FLAG enabled.
(featurep! :config default) (featurep! :config default)
@ -437,8 +438,8 @@ Module FLAGs are set in your config's `doom!' block, typically in
:config (default +flag1 -flag2) :config (default +flag1 -flag2)
When this macro is used from inside a module, CATEGORY and MODULE can be CATEGORY and MODULE can be omitted When this macro is used from inside a module
omitted. eg. (featurep! +flag1)" (except your DOOMDIR, which is a special moduel). e.g. (featurep! +flag)"
(and (cond (flag (memq flag (doom-module-get category module :flags))) (and (cond (flag (memq flag (doom-module-get category module :flags)))
(module (doom-module-p category module)) (module (doom-module-p category module))
(doom--current-flags (memq category doom--current-flags)) (doom--current-flags (memq category doom--current-flags))
@ -446,7 +447,7 @@ omitted. eg. (featurep! +flag1)"
(or doom--current-module (or doom--current-module
(doom-module-from-path (FILE!))))) (doom-module-from-path (FILE!)))))
(unless module-pair (unless module-pair
(error "featurep! couldn't detect what module its in! (in %s)" (FILE!))) (error "featurep! call couldn't auto-detect what module its in (from %s)" (FILE!)))
(memq category (doom-module-get (car module-pair) (cdr module-pair) :flags))))) (memq category (doom-module-get (car module-pair) (cdr module-pair) :flags)))))
t)) t))