refactor: deprecate EMACS2[89]+, NATIVECOMP, MODULES

To reduce redundancy, remove the maintenance hassle that version
constants would impose later on, and rely on built-in
facilities (featurep) more over global variables or doomisms, these
global constants have been deprecated in favor of Emacs "features":

- EMACS28+   -- replace with (> emacs-major-version 27)
- EMACS29+   -- replace with (> emacs-major-version 28)
- NATIVECOMP -- replace with (featurep 'native-compile)
- MODULES    -- replace with (featurep 'dynamic-modules)

(These constants will be formally removed when v3 is released. The IS-*
constants are likely next, but I haven't decided on their substitutes
yet)

I also decided to follow native-compile's example and provide features
for Emacs' system features (since system-configuration-features' docs
outs itself as a poor method to detect features):

- dynamic-modules
- jansson
- native-compile -- this one already exists, but will instead be removed
  if it's non-functional; i.e. (native-comp-available-p) returns nil.

These are now detectable using featurep, which is fast and built-in.
This commit is contained in:
Henrik Lissner 2022-08-12 20:07:08 +02:00
parent c540f1b515
commit 0407621aff
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
12 changed files with 54 additions and 35 deletions

View file

@ -67,7 +67,7 @@ in."
"\t- might depend subtly on upstream packages updates.\n"
"You might need to unpin packages to get a fix for a specific commit of Emacs, "
"and you should be ready to downgrade Emacs if something is just not fixable."))
(EMACS29+
((> emacs-major-version 28)
(warn! "Emacs %s detected" emacs-version)
(explain! "Doom supports this version, but you are living on the edge! "
"Be prepared for breakages in future versions of Emacs."))
@ -108,13 +108,12 @@ in."
"jansson support (i.e. a native JSON library), particularly LSP users. "
"You must install a prebuilt Emacs binary with this included, or compile "
"Emacs with the --with-json option."))
(when EMACS28+
(unless NATIVECOMP
(warn! "Emacs was not built with native compilation support")
(explain! "Users will see a substantial performance gain by building Emacs with "
"native compilation support, availible in emacs 28+."
"You must install a prebuilt Emacs binary with this included, or compile "
"Emacs with the --with-native-compilation option.")))
(unless (featurep 'native-compile)
(warn! "Emacs was not built with native compilation support")
(explain! "Users will see a substantial performance gain by building Emacs with "
"native compilation support, availible in emacs 28+."
"You must install a prebuilt Emacs binary with this included, or compile "
"Emacs with the --with-native-compilation option."))
(print! (start "Checking for private config conflicts..."))
(let* ((xdg-dir (concat (or (getenv "XDG_CONFIG_HOME")