fix(lib): avoid writing customized faces to custom.el (take 3)
Wrap doom-customize-theme-hook and use that wrapper also when the local
doom--customize-themes-h-* hook is called immediately, otherwise
settings will be written to custom-file, which is what I've been trying
to avoid with all these takes!
Amend: 0b13525252
Ref: #7929
Close: #7933
Co-authored-by: real-or-random <real-or-random@users.noreply.github.com>
This commit is contained in:
parent
0b13525252
commit
afb9773d7c
1 changed files with 10 additions and 6 deletions
|
@ -3,14 +3,18 @@
|
|||
;;;###autoload
|
||||
(defconst doom-customize-theme-hook nil)
|
||||
|
||||
(add-hook! 'doom-load-theme-hook
|
||||
(defun doom-apply-customized-faces-h ()
|
||||
"Run `doom-customize-theme-hook'."
|
||||
(defun doom--run-customize-theme-hook (fn)
|
||||
"Run FN, but suppress any writes to `custom-file'."
|
||||
(letf! ((#'custom--should-apply-setting #'ignore)
|
||||
(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))))
|
||||
(run-hooks 'doom-customize-theme-hook))))
|
||||
(funcall fn)))
|
||||
|
||||
(add-hook! 'doom-load-theme-hook
|
||||
(defun doom-apply-customized-faces-h ()
|
||||
"Run `doom-customize-theme-hook'."
|
||||
(run-hook-wrapped 'doom-customize-theme-hook #'doom--run-customize-theme-hook)))
|
||||
|
||||
(defun doom--normalize-face-spec (spec)
|
||||
(cond ((listp (car spec))
|
||||
|
@ -42,7 +46,7 @@ all themes. It will apply to all themes once they are loaded."
|
|||
;; macros on the fly and customize your faces iteratively.
|
||||
(when (or (get 'doom-theme 'previous-themes)
|
||||
(null doom-theme))
|
||||
(funcall #',fn))
|
||||
(doom--run-customize-theme-hook #',fn))
|
||||
;; FIXME Prevent clobbering this on-the-fly
|
||||
(add-hook 'doom-customize-theme-hook #',fn 100))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue