Rename {if,when}! -> eval-{if,when}!
To better represent its purpose, as extensions to Emacs' eval-when* API (for control flow at compile time).
This commit is contained in:
parent
7808f02646
commit
518c97a2ac
5 changed files with 12 additions and 12 deletions
|
@ -220,19 +220,19 @@ writes to `standard-output'."
|
||||||
(funcall write-region start end filename append visit lockname mustbenew)))
|
(funcall write-region start end filename append visit lockname mustbenew)))
|
||||||
,@forms))))
|
,@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.
|
"Expands to THEN if COND is non-nil, to BODY otherwise.
|
||||||
COND is checked at compile/expansion time, allowing BODY to be omitted
|
COND is checked at compile/expansion time, allowing BODY to be omitted entirely
|
||||||
entirely when the elisp is byte-compiled. Use this for forms that contain
|
when the elisp is byte-compiled. Use this for forms that contain expensive
|
||||||
expensive macros that could safely be removed at compile time."
|
macros that could safely be removed at compile time."
|
||||||
(declare (indent 2))
|
(declare (indent 2))
|
||||||
(if (eval cond)
|
(if (eval cond)
|
||||||
then
|
then
|
||||||
(macroexp-progn body)))
|
(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.
|
"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))
|
(declare (indent 1))
|
||||||
(when (eval cond)
|
(when (eval cond)
|
||||||
(macroexp-progn body)))
|
(macroexp-progn body)))
|
||||||
|
@ -639,7 +639,7 @@ testing advice (when combined with `rotate-text').
|
||||||
;;
|
;;
|
||||||
;;; Backports
|
;;; Backports
|
||||||
|
|
||||||
(when! (version< emacs-version "27.0.90")
|
(eval-when! (version< emacs-version "27.0.90")
|
||||||
;; DEPRECATED Backported from Emacs 27
|
;; DEPRECATED Backported from Emacs 27
|
||||||
(defmacro setq-local (&rest pairs)
|
(defmacro setq-local (&rest pairs)
|
||||||
"Make variables in PAIRS buffer-local and assign them the corresponding values.
|
"Make variables in PAIRS buffer-local and assign them the corresponding values.
|
||||||
|
|
|
@ -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))
|
(run-hooks 'doom-load-theme-hook))
|
||||||
result)))
|
result)))
|
||||||
|
|
||||||
(when! (not EMACS27+)
|
(eval-when! (not EMACS27+)
|
||||||
;; DEPRECATED `doom--load-theme-a' handles this for us after the theme is
|
;; DEPRECATED `doom--load-theme-a' handles this for us after the theme is
|
||||||
;; loaded, but this only works on Emacs 27+. Disabling old themes
|
;; loaded, but this only works on Emacs 27+. Disabling old themes
|
||||||
;; must be done *before* the theme is loaded in Emacs 26.
|
;; must be done *before* the theme is loaded in Emacs 26.
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
;;
|
;;
|
||||||
;;; Implementations
|
;;; Implementations
|
||||||
|
|
||||||
(if! (not (featurep! +flyspell))
|
(eval-if! (not (featurep! +flyspell))
|
||||||
|
|
||||||
(use-package! spell-fu
|
(use-package! spell-fu
|
||||||
:when (executable-find "aspell")
|
:when (executable-find "aspell")
|
||||||
|
|
|
@ -309,8 +309,8 @@
|
||||||
;;
|
;;
|
||||||
;;; LSP
|
;;; LSP
|
||||||
|
|
||||||
(when! (and (featurep! +lsp)
|
(eval-when! (and (featurep! +lsp)
|
||||||
(not (featurep! :tools lsp +eglot)))
|
(not (featurep! :tools lsp +eglot)))
|
||||||
|
|
||||||
(use-package! lsp-python-ms
|
(use-package! lsp-python-ms
|
||||||
:unless (featurep! +pyright)
|
:unless (featurep! +pyright)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
;; support symlinks as unix knows them, so `magit-version' can't resolve
|
;; support symlinks as unix knows them, so `magit-version' can't resolve
|
||||||
;; its own repo's path.
|
;; its own repo's path.
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(when! IS-WINDOWS
|
(eval-when! IS-WINDOWS
|
||||||
(defadvice! +magit--ignore-version-a (&optional print-dest)
|
(defadvice! +magit--ignore-version-a (&optional print-dest)
|
||||||
:override #'magit-version
|
:override #'magit-version
|
||||||
(when print-dest
|
(when print-dest
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue