From 34fae1c01ce6800cb7ed8830173cc644988af3e8 Mon Sep 17 00:00:00 2001 From: "Itai Y. Efrat" Date: Sat, 10 Jul 2021 15:52:19 +0300 Subject: [PATCH] Remove remaining `Emacs27+` checks - Remove remaining `EMACS27+` checks, since the whole codebase is assumed to run at version 27 or above now - Remove `EMACS27+` definition since it's no longer needed --- core/cli/doctor.el | 15 +++++++-------- core/core.el | 3 +-- modules/completion/helm/config.el | 5 +---- modules/config/default/config.el | 5 +---- modules/editor/evil/init.el | 7 +++---- modules/emacs/dired/config.el | 19 +++++++++---------- modules/tools/lookup/config.el | 9 ++------- modules/ui/popup/autoload/popup.el | 15 --------------- 8 files changed, 24 insertions(+), 54 deletions(-) diff --git a/core/cli/doctor.el b/core/cli/doctor.el index 90740ec15..3211c66b0 100644 --- a/core/cli/doctor.el +++ b/core/cli/doctor.el @@ -84,14 +84,13 @@ in." "typically installed. If you're seeing a vanilla Emacs splash screen, this " "may explain why. If you use Chemacs, you may ignore this warning.")) - (when EMACS27+ - (print! (start "Checking for great Emacs features...")) - (unless (functionp 'json-serialize) - (warn! "Emacs was not built with native JSON support") - (explain! "Users will see a substantial performance gain by building Emacs with " - "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."))) + (print! (start "Checking for great Emacs features...")) + (unless (functionp 'json-serialize) + (warn! "Emacs was not built with native JSON support") + (explain! "Users will see a substantial performance gain by building Emacs with " + "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.")) (print! (start "Checking for private config conflicts...")) (let ((xdg-dir (concat (or (getenv "XDG_CONFIG_HOME") diff --git a/core/core.el b/core/core.el index d2f4b7ac0..769becc8c 100644 --- a/core/core.el +++ b/core/core.el @@ -21,7 +21,6 @@ envvar will enable this at startup.") (defconst doom-interactive-p (not noninteractive) "If non-nil, Emacs is in interactive mode.") -(defconst EMACS27+ (> emacs-major-version 26)) (defconst EMACS28+ (> emacs-major-version 27)) (defconst IS-MAC (eq system-type 'darwin)) (defconst IS-LINUX (eq system-type 'gnu/linux)) @@ -577,7 +576,7 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions." ;; because the latter is triggered too late (after the file has ;; opened and modes are all set up). (advice-add 'after-find-file :before fn '((depth . -101)))) - ((add-hook hook fn (if EMACS27+ -101)))) + ((add-hook hook fn -101))) fn))) diff --git a/modules/completion/helm/config.el b/modules/completion/helm/config.el index 1f8ff4182..cf15e3da0 100644 --- a/modules/completion/helm/config.el +++ b/modules/completion/helm/config.el @@ -96,10 +96,7 @@ Can be negative.") ;; `completion-styles', since that would be overly intrusive. E.g., it ;; results in `company-capf' returning far to many completion candidates. ;; Instead, append those styles so that they act as a fallback. - (add-to-list 'completion-styles - (if EMACS27+ - (if fuzzy 'flex 'helm) - (if fuzzy 'helm-flex 'helm)) t)) + (add-to-list 'completion-styles (if fuzzy 'flex 'helm) t)) :config (set-popup-rule! "^\\*helm" :vslot -100 :size 0.22 :ttl nil) diff --git a/modules/config/default/config.el b/modules/config/default/config.el index 47fa77112..215b52e70 100644 --- a/modules/config/default/config.el +++ b/modules/config/default/config.el @@ -34,10 +34,7 @@ (after! epa ;; With GPG 2.1+, this forces gpg-agent to use the Emacs minibuffer to prompt ;; for the key passphrase. - (set (if EMACS27+ - 'epg-pinentry-mode - 'epa-pinentry-mode) ; DEPRECATED `epa-pinentry-mode' - 'loopback) + (set 'epg-pinentry-mode 'loopback) ;; Default to the first secret key available in your keyring. (setq-default epa-file-encrypt-to diff --git a/modules/editor/evil/init.el b/modules/editor/evil/init.el index 2e0472a6a..e66e25708 100644 --- a/modules/editor/evil/init.el +++ b/modules/editor/evil/init.el @@ -211,7 +211,7 @@ variable for an explanation of the defaults (in comments). See tar-mode (term term ansi-term multi-term) tetris - ,@(if EMACS27+ '(thread)) + thread tide timer-list transmission @@ -299,9 +299,8 @@ and complains if a module is loaded too early (during startup)." (+evil-collection-init '(process-menu simple))) (add-transient-hook! 'tabulated-list-mode (+evil-collection-init 'tabulated-list)) - (when EMACS27+ - (add-transient-hook! 'tab-bar-mode - (+evil-collection-init 'tab-bar))) + (add-transient-hook! 'tab-bar-mode + (+evil-collection-init 'tab-bar)) ;; HACK Do this ourselves because evil-collection break's `eval-after-load' ;; load order by loading their target plugin before applying keys. This diff --git a/modules/emacs/dired/config.el b/modules/emacs/dired/config.el index 08711d565..9dfe0006a 100644 --- a/modules/emacs/dired/config.el +++ b/modules/emacs/dired/config.el @@ -117,18 +117,17 @@ we have to clean it up ourselves." ;; HACK Fixes #1929: icons break file renaming in Emacs 27+, because the icon ;; is considered part of the filename, so we disable icons while we're in ;; wdired-mode. - (when EMACS27+ - (defvar +wdired-icons-enabled -1) + (defvar +wdired-icons-enabled -1) - (defadvice! +dired-disable-icons-in-wdired-mode-a (&rest _) - :before #'wdired-change-to-wdired-mode - (setq-local +wdired-icons-enabled (if all-the-icons-dired-mode 1 -1)) - (when all-the-icons-dired-mode - (all-the-icons-dired-mode -1))) + (defadvice! +dired-disable-icons-in-wdired-mode-a (&rest _) + :before #'wdired-change-to-wdired-mode + (setq-local +wdired-icons-enabled (if all-the-icons-dired-mode 1 -1)) + (when all-the-icons-dired-mode + (all-the-icons-dired-mode -1))) - (defadvice! +dired-restore-icons-after-wdired-mode-a (&rest _) - :after #'wdired-change-to-dired-mode - (all-the-icons-dired-mode +wdired-icons-enabled)))) + (defadvice! +dired-restore-icons-after-wdired-mode-a (&rest _) + :after #'wdired-change-to-dired-mode + (all-the-icons-dired-mode +wdired-icons-enabled))) (use-package! dired-x diff --git a/modules/tools/lookup/config.el b/modules/tools/lookup/config.el index 792dbefb6..e3840ae87 100644 --- a/modules/tools/lookup/config.el +++ b/modules/tools/lookup/config.el @@ -165,13 +165,8 @@ Dictionary.app behind the scenes to get definitions.") :when (featurep! :completion ivy) :config (set-popup-rule! "^\\*xref\\*$" :ignore t) - ;; xref initialization is different in Emacs 27 - there are two different - ;; variables which can be set rather than just one - (when EMACS27+ - (setq xref-show-definitions-function #'ivy-xref-show-defs)) - ;; Necessary in Emacs <27. In Emacs 27 it will affect all xref-based - ;; commands other than xref-find-definitions too (eg project-find-regexp) - (setq xref-show-xrefs-function #'ivy-xref-show-xrefs) + (setq xref-show-definitions-function #'ivy-xref-show-defs + xref-show-xrefs-function #'ivy-xref-show-xrefs) ;; HACK Fix #4386: `ivy-xref-show-xrefs' calls `fetcher' twice, which has ;; side effects that breaks in some cases (i.e. on `dired-do-find-regexp'). diff --git a/modules/ui/popup/autoload/popup.el b/modules/ui/popup/autoload/popup.el index 2e4f3228e..3b62c396b 100644 --- a/modules/ui/popup/autoload/popup.el +++ b/modules/ui/popup/autoload/popup.el @@ -612,18 +612,3 @@ Accepts the same arguments as `display-buffer-in-side-window'. You must set (setq window--sides-shown t)) (window--display-buffer buffer best-window 'reuse alist))))))))) - - -;; -;; Emacs backwards compatibility - -(unless EMACS27+ - (defadvice! +popup--set-window-dedicated-a (window) - "Ensure `window--display-buffer' respects `display-buffer-mark-dedicated'. - -This was not so until recent Emacs 27 builds, where it causes breaking errors. -This advice ensures backwards compatibility for Emacs <= 26 users." - :filter-return #'window--display-buffer - (when (and (windowp window) display-buffer-mark-dedicated) - (set-window-dedicated-p window display-buffer-mark-dedicated)) - window))