From 273c1e0861bd0366f64aa3a5ce1452d7a2d8808b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 27 Mar 2020 02:49:05 -0400 Subject: [PATCH] Disable former themes only if new one loaded successfully --- core/core-ui.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/core-ui.el b/core/core-ui.el index 4e7617476..765283ed9 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -600,11 +600,12 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.") doom-init-theme-p t) (run-hooks 'doom-load-theme-hook))) -(defadvice! doom--disable-enabled-themes-a (&rest _) +(defadvice! doom--disable-enabled-themes-a (theme &optional _no-confirm no-enable) "Disable previously enabled themes before loading a new one. Otherwise, themes can conflict with each other." - :before #'load-theme - (mapc #'disable-theme custom-enabled-themes)) + :after-while #'load-theme + (unless no-enable + (mapc #'disable-theme (remq theme custom-enabled-themes)))) (unless EMACS27+ ;; DEPRECATED Not needed in Emacs 27