From 518c97a2ac3f4db8093bce9d31873521ad789b9d Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 26 Aug 2020 21:40:53 -0400 Subject: [PATCH] Rename {if,when}! -> eval-{if,when}! To better represent its purpose, as extensions to Emacs' eval-when* API (for control flow at compile time). --- core/core-lib.el | 14 +++++++------- core/core-ui.el | 2 +- modules/checkers/spell/config.el | 2 +- modules/lang/python/config.el | 4 ++-- modules/tools/magit/autoload.el | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/core-lib.el b/core/core-lib.el index 27812766d..1cea6ce2f 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -220,19 +220,19 @@ writes to `standard-output'." (funcall write-region start end filename append visit lockname mustbenew))) ,@forms)))) -(defmacro if! (cond then &rest body) +(defmacro eval-if! (cond then &rest body) "Expands to THEN if COND is non-nil, to BODY otherwise. -COND is checked at compile/expansion time, allowing BODY to be omitted -entirely when the elisp is byte-compiled. Use this for forms that contain -expensive macros that could safely be removed at compile time." +COND is checked at compile/expansion time, allowing BODY to be omitted entirely +when the elisp is byte-compiled. Use this for forms that contain expensive +macros that could safely be removed at compile time." (declare (indent 2)) (if (eval cond) then (macroexp-progn body))) -(defmacro when! (cond &rest body) +(defmacro eval-when! (cond &rest body) "Expands to BODY if CONDITION is non-nil at compile/expansion time. -See `if!' for details on this macro's purpose." +See `eval-if!' for details on this macro's purpose." (declare (indent 1)) (when (eval cond) (macroexp-progn body))) @@ -639,7 +639,7 @@ testing advice (when combined with `rotate-text'). ;; ;;; Backports -(when! (version< emacs-version "27.0.90") +(eval-when! (version< emacs-version "27.0.90") ;; DEPRECATED Backported from Emacs 27 (defmacro setq-local (&rest pairs) "Make variables in PAIRS buffer-local and assign them the corresponding values. diff --git a/core/core-ui.el b/core/core-ui.el index af1b2d257..95cfb64b6 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -598,7 +598,7 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.") (run-hooks 'doom-load-theme-hook)) result))) -(when! (not EMACS27+) +(eval-when! (not EMACS27+) ;; DEPRECATED `doom--load-theme-a' handles this for us after the theme is ;; loaded, but this only works on Emacs 27+. Disabling old themes ;; must be done *before* the theme is loaded in Emacs 26. diff --git a/modules/checkers/spell/config.el b/modules/checkers/spell/config.el index 3cd2546d4..3ef75d375 100644 --- a/modules/checkers/spell/config.el +++ b/modules/checkers/spell/config.el @@ -64,7 +64,7 @@ ;; ;;; Implementations -(if! (not (featurep! +flyspell)) +(eval-if! (not (featurep! +flyspell)) (use-package! spell-fu :when (executable-find "aspell") diff --git a/modules/lang/python/config.el b/modules/lang/python/config.el index 634b3c362..12540413f 100644 --- a/modules/lang/python/config.el +++ b/modules/lang/python/config.el @@ -309,8 +309,8 @@ ;; ;;; LSP -(when! (and (featurep! +lsp) - (not (featurep! :tools lsp +eglot))) +(eval-when! (and (featurep! +lsp) + (not (featurep! :tools lsp +eglot))) (use-package! lsp-python-ms :unless (featurep! +pyright) diff --git a/modules/tools/magit/autoload.el b/modules/tools/magit/autoload.el index 14418d17e..85c8d7e2c 100644 --- a/modules/tools/magit/autoload.el +++ b/modules/tools/magit/autoload.el @@ -6,7 +6,7 @@ ;; support symlinks as unix knows them, so `magit-version' can't resolve ;; its own repo's path. ;;;###autoload -(when! IS-WINDOWS +(eval-when! IS-WINDOWS (defadvice! +magit--ignore-version-a (&optional print-dest) :override #'magit-version (when print-dest