Add doom/switch-theme; a more sensible load-theme

load-theme doesn't disable previously enabled themes before switching.
doom/switch-theme does.

This remaps any keys bound to load-theme to doom/switch-theme.
This commit is contained in:
Henrik Lissner 2018-08-11 00:33:23 +02:00
parent 3b4fd56cac
commit 43e0314e86
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 24 additions and 3 deletions

View file

@ -103,3 +103,20 @@ presentations."
(mapc #'disable-theme custom-enabled-themes))
(doom|init-theme)
(doom|init-fonts)))
;;;###autoload
(defun doom/switch-theme (theme)
"Like `load-theme', but will unload currently loaded themes before switching
to a new one."
(interactive
(list (completing-read
"Load theme: "
(mapcar #'symbol-name
(custom-available-themes)))))
(condition-case nil
(progn
(mapc #'disable-theme custom-enabled-themes)
(load-theme (intern theme) t)
(when (fboundp 'powerline-reset)
(powerline-reset)))
(error "Problem loading theme %s" x)))