diff --git a/lisp/lib/themes.el b/lisp/lib/themes.el index 9af956e65..983c127fc 100644 --- a/lisp/lib/themes.el +++ b/lisp/lib/themes.el @@ -6,13 +6,17 @@ (add-hook! 'doom-load-theme-hook (defun doom-apply-customized-faces-h () "Run `doom-customize-theme-hook'." - (run-hooks 'doom-customize-theme-hook))) + (letf! (defun custom-push-theme (prop symbol theme mode &optional value) + (funcall custom-push-theme prop symbol theme mode value) + (if (facep symbol) (face-spec-set symbol value t))) + (let ((custom--inhibit-theme-enable t)) + (run-hooks 'doom-customize-theme-hook))))) -(defun doom--custom-theme-set-face (spec) +(defun doom--normalize-face-spec (spec) (cond ((listp (car spec)) (cl-loop for face in (car spec) collect - (car (doom--custom-theme-set-face (cons face (cdr spec)))))) + (car (doom--normalize-face-spec (cons face (cdr spec)))))) ((keywordp (cadr spec)) `((,(car spec) ((t ,(cdr spec)))))) (`((,(car spec) ,(cdr spec)))))) @@ -27,13 +31,12 @@ all themes. It will apply to all themes once they are loaded." (let ((fn (gensym "doom--customize-themes-h-"))) `(progn (defun ,fn () - (let (custom--inhibit-theme-enable) - (dolist (theme (ensure-list (or ,theme 'user))) - (when (or (eq theme 'user) - (custom-theme-enabled-p theme)) + (dolist (theme (ensure-list (or ,theme 'user))) + (if (or (eq theme 'user) + (custom-theme-enabled-p theme)) (apply #'custom-theme-set-faces theme - (mapcan #'doom--custom-theme-set-face - (list ,@specs))))))) + (mapcan #'doom--normalize-face-spec + (list ,@specs)))))) ;; Apply the changes immediately if the user is using the default theme ;; or the theme has already loaded. This allows you to evaluate these ;; macros on the fly and customize your faces iteratively.