refactor: deprecate featurep! for modulep!

featurep! will be renamed modulep! in the future, so it's been
deprecated. They have identical interfaces, and can be replaced without
issue.

featurep! was never quite the right name for this macro. It implied that
it had some connection to featurep, which it doesn't (only that it was
similar in purpose; still, Doom modules are not features). To undo such
implications and be consistent with its namespace (and since we're
heading into a storm of breaking changes with the v3 release anyway),
now was the best opportunity to begin the transition.
This commit is contained in:
Henrik Lissner 2022-08-12 20:29:19 +02:00
parent 0407621aff
commit ad6a3d0f33
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
316 changed files with 1109 additions and 1103 deletions

View file

@ -549,12 +549,15 @@ WARNINGS:
(lambda () ,@body)
'append)))
(defmacro featurep! (category &optional module flag)
"Returns t if CATEGORY MODULE is enabled.
;; DEPRECATED Remove in 3.0
(define-obsolete-function-alias 'featurep! 'modulep! "3.0.0")
(defmacro modulep! (category &optional module flag)
"Return t if FEATURES are all present.
If FLAG is provided, returns t if CATEGORY MODULE has FLAG enabled.
(featurep! :config default)
(modulep! :config default)
Module FLAGs are set in your config's `doom!' block, typically in
~/.doom.d/init.el. Like so:
@ -562,13 +565,13 @@ Module FLAGs are set in your config's `doom!' block, typically in
:config (default +flag1 -flag2)
CATEGORY and MODULE can be omitted When this macro is used from inside a module
(except your DOOMDIR, which is a special module). e.g. (featurep! +flag)"
(except your DOOMDIR, which is a special module). e.g. (modulep! +flag)"
(and (cond (flag (memq flag (doom-module-get category module :flags)))
(module (doom-module-p category module))
(doom--current-flags (memq category doom--current-flags))
((if-let (module (doom-module-from-path))
(memq category (doom-module-get (car module) (cdr module) :flags))
(error "(featurep! %s %s %s) couldn't figure out what module it was called from (in %s)"
(error "(modulep! %s %s %s) couldn't figure out what module it was called from (in %s)"
category module flag (file!)))))
t))