Minimize custom-set-faces! clobbering doom-load-theme-hook
Evaluating custom-set-faces! calls would add setter functions to doom-load-theme-hook indefinitely, which could add up each time you M-x doom/reload. Now it adds them to a subhook, which is reset whenever Doom is reloaded.
This commit is contained in:
parent
d502c7c06a
commit
95eb2989dc
1 changed files with 20 additions and 13 deletions
|
@ -9,6 +9,13 @@
|
|||
`((,(car spec) ((t ,(cdr spec))))))
|
||||
(`((,(car spec) ,(cdr spec))))))
|
||||
|
||||
;;;###autoload
|
||||
(defconst doom-customize-theme-hook nil)
|
||||
|
||||
(add-hook! 'doom-load-theme-hook :append
|
||||
(defun doom-apply-customized-faces-h ()
|
||||
(run-hooks 'doom-customize-theme-hook)))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro custom-theme-set-faces! (theme &rest specs)
|
||||
"Apply a list of face SPECS as user customizations for THEME.
|
||||
|
@ -16,19 +23,19 @@
|
|||
THEME can be a single symbol or list thereof. If nil, apply these settings to
|
||||
all themes. It will apply to all themes once they are loaded."
|
||||
(declare (indent defun))
|
||||
`(let ((fn (gensym "doom--customize-themes-h-")))
|
||||
(fset
|
||||
fn (lambda ()
|
||||
(let ((fn (gensym "doom--customize-themes-h-")))
|
||||
`(progn
|
||||
(defun ,fn ()
|
||||
(let (custom--inhibit-theme-enable)
|
||||
(dolist (theme (doom-enlist (or ,theme 'user)))
|
||||
(when (or (eq theme 'user)
|
||||
(custom-theme-enabled-p theme))
|
||||
(apply #'custom-theme-set-faces theme
|
||||
(mapcan #'doom--custom-theme-set-face
|
||||
(list ,@specs))))))))
|
||||
(list ,@specs)))))))
|
||||
(when (or doom-init-theme-p (null doom-theme))
|
||||
(funcall fn))
|
||||
(add-hook 'doom-load-theme-hook fn 'append)))
|
||||
(funcall #',fn))
|
||||
(add-hook 'doom-customize-theme-hook #',fn 'append))))
|
||||
|
||||
;;;###autoload
|
||||
(defmacro custom-set-faces! (&rest specs)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue