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

@ -307,7 +307,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
(setq resize-mini-windows 'grow-only)
;; Typing yes/no is obnoxious when y/n will do
(if EMACS28+
(if (boundp 'use-short-answers)
(setq use-short-answers t)
;; DEPRECATED Remove when we drop 27.x support
(advice-add #'yes-or-no-p :override #'y-or-n-p))
@ -513,7 +513,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; Fix #2742: cursor is off by 4 characters in `artist-mode'
;; REVIEW Reported upstream https://debbugs.gnu.org/cgi/bugreport.cgi?bug=43811
;; DEPRECATED Fixed in Emacs 28; remove when we drop 27 support
(unless EMACS28+
(unless (> emacs-major-version 27)
(add-hook 'artist-mode-hook #'doom-disable-line-numbers-h))