Fix #5009: custom-{,theme-}set-faces\! at startup

An erroneous check preventing these macros from taking effect any other
time but before your doom-theme has loaded.
This commit is contained in:
Henrik Lissner 2021-05-08 13:50:48 -04:00
parent 1c549f21d6
commit f3c496d295
2 changed files with 15 additions and 8 deletions

View file

@ -34,7 +34,12 @@ all themes. It will apply to all themes once they are loaded."
(apply #'custom-theme-set-faces theme (apply #'custom-theme-set-faces theme
(mapcan #'doom--custom-theme-set-face (mapcan #'doom--custom-theme-set-face
(list ,@specs))))))) (list ,@specs)))))))
(unless doom-theme (funcall #',fn)) ;; Apply the changes immediately if the user is using the default theme
;; or the theme has already loaded. This allows you to evaluate these
;; macros on the fly and customize your faces iteratively.
(when (or (get 'doom-theme 'previous-themes)
(null doom-theme))
(funcall #',fn))
;; TODO Append to `doom-load-theme-hook' with DEPTH instead when Emacs ;; TODO Append to `doom-load-theme-hook' with DEPTH instead when Emacs
;; 26.x support is dropped. ;; 26.x support is dropped.
(add-hook 'doom-customize-theme-hook #',fn 'append)))) (add-hook 'doom-customize-theme-hook #',fn 'append))))

View file

@ -634,13 +634,15 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
;; buffer-local face remaps (by `mixed-pitch-mode', for instance) won't ;; buffer-local face remaps (by `mixed-pitch-mode', for instance) won't
;; interfere with recalculating faces in new themes. ;; interfere with recalculating faces in new themes.
(with-temp-buffer (with-temp-buffer
;; Disable previous themes so there are no conflicts. If you truly want (let ((last-themes (copy-sequence custom-enabled-themes)))
;; multiple themes enabled, then use `enable-theme' instead. ;; Disable previous themes so there are no conflicts. If you truly want
(mapc #'disable-theme custom-enabled-themes) ;; multiple themes enabled, then use `enable-theme' instead.
(prog1 (funcall orig-fn theme no-confirm no-enable) (mapc #'disable-theme custom-enabled-themes)
(when (and (not no-enable) (custom-theme-enabled-p theme)) (prog1 (funcall orig-fn theme no-confirm no-enable)
(setq doom-theme theme) (when (and (not no-enable) (custom-theme-enabled-p theme))
(doom-run-hooks 'doom-load-theme-hook))))) (setq doom-theme theme)
(put 'doom-theme 'previous-themes last-themes)
(doom-run-hooks 'doom-load-theme-hook))))))
;; ;;