From 8f3b7986209817305f544fac83baa7cd0f1d5ced Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 9 May 2021 01:19:57 -0400 Subject: [PATCH] Fix #5000: ensure 'doom always has precedence 'doom is a pseudo theme used to store internal faces and variables, and must have the highest precedence (like the 'user theme, but without the risk of being written to custom-file). --- core/core-ui.el | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index cc1851e97..1330805e1 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -567,7 +567,7 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ;; ;;; Theme & font -;; Use a psuedo theme to store internal and user faces + custom.el settings +;; Use a pseudo theme to store internal and user faces + custom.el settings ;; without risk of them being written to `custom-file'. (custom-declare-theme 'doom nil) @@ -620,12 +620,15 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (defun doom-init-theme-h (&optional frame) "Load the theme specified by `doom-theme' in FRAME." - (when (and doom-theme (not (custom-theme-enabled-p doom-theme))) - ;; Fix #1397: if `doom-init-theme-h' is used on `after-make-frame-functions' - ;; (for daemon sessions), the new frame must be focused to ensure the theme - ;; loads correctly. - (with-selected-frame (or frame (selected-frame)) - (load-theme doom-theme t)))) + (if doom-theme + (unless (custom-theme-enabled-p doom-theme) + ;; Fix #1397: if `doom-init-theme-h' is used on `after-make-frame-functions' + ;; (for daemon sessions), the new frame must be focused to ensure the theme + ;; loads correctly. + (with-selected-frame (or frame (selected-frame)) + (load-theme doom-theme t))) + ;; Ensure custom faces apply and have highest precendence + (enable-theme 'doom))) (defadvice! doom--load-theme-a (orig-fn theme &optional no-confirm no-enable) "Record `doom-theme', disable old themes, and trigger `doom-load-theme-hook'." @@ -642,7 +645,9 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (when (and (not no-enable) (custom-theme-enabled-p theme)) (setq doom-theme theme) (put 'doom-theme 'previous-themes last-themes) - (doom-run-hooks 'doom-load-theme-hook)))))) + (doom-run-hooks 'doom-load-theme-hook) + ;; `doom' must have precedence + (enable-theme 'doom)))))) ;;