Deprecate prefer-byte-compiled theme optimization

This optimization was incorporated into load-theme in Emacs 27+.
This commit is contained in:
Henrik Lissner 2020-03-25 15:47:17 -04:00
parent 0e2c9e8cb0
commit 53970b3a59
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -541,6 +541,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; Underline looks a bit better when drawn lower ;; Underline looks a bit better when drawn lower
(setq x-underline-at-descent-line t) (setq x-underline-at-descent-line t)
;; DEPRECATED In Emacs 27
(defvar doom--prefer-theme-elc nil (defvar doom--prefer-theme-elc nil
"If non-nil, `load-theme' will prefer the compiled theme (unlike its default "If non-nil, `load-theme' will prefer the compiled theme (unlike its default
behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.") behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
@ -588,7 +589,7 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
"Load the theme specified by `doom-theme' in FRAME." "Load the theme specified by `doom-theme' in FRAME."
(when (and doom-theme (not (memq doom-theme custom-enabled-themes))) (when (and doom-theme (not (memq doom-theme custom-enabled-themes)))
(with-selected-frame (or frame (selected-frame)) (with-selected-frame (or frame (selected-frame))
(let ((doom--prefer-theme-elc t)) (let ((doom--prefer-theme-elc t)) ; DEPRECATED in Emacs 27
(load-theme doom-theme t))))) (load-theme doom-theme t)))))
(defadvice! doom--run-load-theme-hooks-a (theme &optional _no-confirm no-enable) (defadvice! doom--run-load-theme-hooks-a (theme &optional _no-confirm no-enable)
@ -605,9 +606,12 @@ Otherwise, themes can conflict with each other."
:before #'load-theme :before #'load-theme
(mapc #'disable-theme custom-enabled-themes)) (mapc #'disable-theme custom-enabled-themes))
(defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args) (unless EMACS27+
"Make `load-theme' prioritize the byte-compiled theme for a moderate boost in ;; DEPRECATED Not needed in Emacs 27
startup (or theme switch) time, so long as `doom--prefer-theme-elc' is non-nil." (defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args)
"Have `load-theme' prioritize the byte-compiled theme.
This offers a moderate boost in startup (or theme switch) time, so long as
`doom--prefer-theme-elc' is non-nil."
:around #'load-theme :around #'load-theme
(if (or (null after-init-time) (if (or (null after-init-time)
doom--prefer-theme-elc) doom--prefer-theme-elc)
@ -616,7 +620,7 @@ startup (or theme switch) time, so long as `doom--prefer-theme-elc' is non-nil."
(lambda (filename path &optional _suffixes predicate) (lambda (filename path &optional _suffixes predicate)
(funcall old-locate-file filename path '("c" "") predicate)))) (funcall old-locate-file filename path '("c" "") predicate))))
(apply orig-fn args)) (apply orig-fn args))
(apply orig-fn args))) (apply orig-fn args))))
;; ;;