From cebbd76f3d59647d7329608e8a202fa483a9f5cf Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 9 May 2021 20:12:45 -0400 Subject: [PATCH] Revert to 'user theme Trying to get 'doom to behave like 'user is too much trouble and causes too many problems. The magic around 'user is too deeply woven into custom.el. The whole custom.el fiasco needs to be dealt with another way. Fixes #5000 Fixes #5009 --- core/autoload/themes.el | 6 +++--- core/core-ui.el | 40 ++++++++++++++-------------------------- 2 files changed, 17 insertions(+), 29 deletions(-) diff --git a/core/autoload/themes.el b/core/autoload/themes.el index bed7c4f37..2f890b364 100644 --- a/core/autoload/themes.el +++ b/core/autoload/themes.el @@ -28,8 +28,8 @@ all themes. It will apply to all themes once they are loaded." `(progn (defun ,fn () (let (custom--inhibit-theme-enable) - (dolist (theme (doom-enlist (or ,theme 'doom))) - (when (or (memq theme '(user doom)) + (dolist (theme (doom-enlist (or ,theme 'user))) + (when (or (eq theme 'user) (custom-theme-enabled-p theme)) (apply #'custom-theme-set-faces theme (mapcan #'doom--custom-theme-set-face @@ -52,7 +52,7 @@ This is a convenience macro alternative to `custom-set-face' which allows for a simplified face format, and takes care of load order issues, so you can use doom-themes' API without worry." (declare (indent defun)) - `(custom-theme-set-faces! 'doom ,@specs)) + `(custom-theme-set-faces! 'user ,@specs)) ;;;###autoload (defun doom/reload-theme () diff --git a/core/core-ui.el b/core/core-ui.el index 1330805e1..5a6d594b2 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -567,10 +567,6 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original ;; ;;; Theme & font -;; 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) - ;; User themes should live in ~/.doom.d/themes, not ~/.emacs.d (setq custom-theme-directory (concat doom-private-dir "themes/")) @@ -592,16 +588,13 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original (set-fontset-font t 'unicode font)) (when doom-unicode-font (set-fontset-font t 'unicode doom-unicode-font)))) - ;; Changes to a theme don't take effect immediately if the theme isn't `user', - ;; so we must force it to. - (let (custom--inhibit-theme-enable) - (apply #'custom-theme-set-faces 'doom - (append (when doom-font - `((fixed-pitch ((t (:font ,doom-font)))))) - (when doom-serif-font - `((fixed-pitch-serif ((t (:font ,doom-serif-font)))))) - (when doom-variable-pitch-font - `((variable-pitch ((t (:font ,doom-variable-pitch-font))))))))) + (apply #'custom-set-faces + (append (when doom-font + `((fixed-pitch ((t (:font ,doom-font)))))) + (when doom-serif-font + `((fixed-pitch-serif ((t (:font ,doom-serif-font)))))) + (when doom-variable-pitch-font + `((variable-pitch ((t (:font ,doom-variable-pitch-font)))))))) (cond (doom-font ;; I avoid `set-frame-font' at startup because it is expensive; doing extra, @@ -620,15 +613,12 @@ 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." - (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))) + (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)))) (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'." @@ -645,9 +635,7 @@ 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' must have precedence - (enable-theme 'doom)))))) + (doom-run-hooks 'doom-load-theme-hook)))))) ;;