Defer evaluation of custom-set-faces!'s arguments
...until the theme has first loaded. You'll need to set `doom-theme` to nil if you want to use this macro without a theme!
This commit is contained in:
parent
a940d07e4b
commit
ee80ed680c
2 changed files with 23 additions and 16 deletions
|
@ -10,31 +10,34 @@
|
||||||
(`((,(car spec) ,(cdr spec))))))
|
(`((,(car spec) ,(cdr spec))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun custom-theme-set-faces! (theme &rest specs)
|
(defmacro custom-theme-set-faces! (theme &rest specs)
|
||||||
"Apply a list of face SPECS as user customizations for THEME.
|
"Apply a list of face SPECS as user customizations for THEME.
|
||||||
|
|
||||||
THEME can be a single symbol or list thereof. If nil, apply these settings to
|
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."
|
all themes. It will apply to all themes once they are loaded."
|
||||||
(let* ((themes (doom-enlist (or theme 'user)))
|
(declare (indent defun))
|
||||||
(fn (gensym (format "doom--customize-%s-h-" (mapconcat #'symbol-name themes "-")))))
|
`(let* ((themes (doom-enlist (or (list ,theme) 'user)))
|
||||||
(fset fn
|
(fn (gensym (format "doom--customize-%s-h-" (mapconcat #'symbol-name themes "-")))))
|
||||||
(lambda ()
|
(fset
|
||||||
(dolist (theme themes)
|
fn (lambda ()
|
||||||
(when (or (eq theme 'user)
|
(dolist (theme themes)
|
||||||
(custom-theme-enabled-p theme))
|
(when (or (eq theme 'user)
|
||||||
(apply #'custom-theme-set-faces 'user
|
(custom-theme-enabled-p theme))
|
||||||
(mapcan #'doom--custom-theme-set-face
|
(apply #'custom-theme-set-faces 'user
|
||||||
specs))))))
|
(mapcan #'doom--custom-theme-set-face
|
||||||
(funcall fn)
|
(list ,@specs)))))))
|
||||||
(add-hook 'doom-load-theme-hook fn)))
|
(when (or doom-init-theme-p (null doom-theme))
|
||||||
|
(funcall fn))
|
||||||
|
(add-hook 'doom-load-theme-hook fn 'append)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun custom-set-faces! (&rest specs)
|
(defmacro custom-set-faces! (&rest specs)
|
||||||
"Apply a list of face SPECS as user customizations.
|
"Apply a list of face SPECS as user customizations.
|
||||||
|
|
||||||
This is a drop-in replacement for `custom-set-face' that allows for a simplified
|
This is a drop-in replacement for `custom-set-face' that allows for a simplified
|
||||||
face format."
|
face format."
|
||||||
(apply #'custom-theme-set-faces! 'user specs))
|
(declare (indent defun))
|
||||||
|
`(custom-theme-set-faces! 'user ,@specs))
|
||||||
|
|
||||||
(defvar doom--prefer-theme-elc)
|
(defvar doom--prefer-theme-elc)
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
;;
|
;;
|
||||||
;;; Variables
|
;;; Variables
|
||||||
|
|
||||||
|
(defvar doom-init-theme-p nil
|
||||||
|
"If non-nil, a theme as been loaded.")
|
||||||
|
|
||||||
(defvar doom-theme nil
|
(defvar doom-theme nil
|
||||||
"A symbol representing the Emacs theme to load at startup.
|
"A symbol representing the Emacs theme to load at startup.
|
||||||
|
|
||||||
|
@ -633,7 +636,8 @@ behavior). Do not set this directly, this is let-bound in `doom-init-theme-h'.")
|
||||||
"Set up `doom-load-theme-hook' to run after `load-theme' is called."
|
"Set up `doom-load-theme-hook' to run after `load-theme' is called."
|
||||||
:after-while #'load-theme
|
:after-while #'load-theme
|
||||||
(unless no-enable
|
(unless no-enable
|
||||||
(setq doom-theme theme)
|
(setq doom-theme theme
|
||||||
|
doom-init-theme-p t)
|
||||||
(run-hooks 'doom-load-theme-hook)))
|
(run-hooks 'doom-load-theme-hook)))
|
||||||
|
|
||||||
(defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args)
|
(defadvice! doom--prefer-compiled-theme-a (orig-fn &rest args)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue