Disable former themes only if new one loaded successfully

This commit is contained in:
Henrik Lissner 2020-03-27 02:49:05 -04:00
parent a0f674fc78
commit 273c1e0861
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -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