fix(lib): doom/reload-theme not reloading active theme

Rather than reloading whatever `doom-theme` is set to, reload the
currently active theme(s). Although `load-theme` is advised to change
the value of `doom-theme`, not all theme switching commands use
`load-theme` (e.g. `consult-theme`).

Fix #5539
This commit is contained in:
Henrik Lissner 2021-09-30 14:47:25 +02:00
parent 49c94dc78c
commit 3ad9e39559

View file

@ -54,11 +54,20 @@ doom-themes' API without worry."
;;;###autoload
(defun doom/reload-theme ()
"Reload the current color theme."
"Reload the current Emacs theme."
(interactive)
(unless doom-theme
(user-error "No theme is active"))
(let ((themes (copy-sequence custom-enabled-themes)))
(load-theme doom-theme t)
(mapc #'disable-theme custom-enabled-themes)
(let (doom-load-theme-hook)
(mapc #'enable-theme (reverse themes)))
(doom-run-hooks 'doom-load-theme-hook)
(doom/reload-font)
(message "%s %s"
(propertize "Reloaded themes:" 'face 'bold)
(propertize
(format "Reloaded %d theme%s:"
(length themes)
(if (cdr themes) "s" ""))
'face 'bold)
(mapconcat #'prin1-to-string themes ", "))))