Add nested face support to custom-theme-set-faces!
And convert it and custom-set-faces! to functions because they didn't need to be macros.
This commit is contained in:
parent
5cc0e92a48
commit
ecb655dc01
1 changed files with 16 additions and 10 deletions
|
@ -1,8 +1,16 @@
|
||||||
;;; ../work/conf/doom-emacs/core/autoload/themes.el -*- lexical-binding: t; -*-
|
;;; ../work/conf/doom-emacs/core/autoload/themes.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(defun doom--custom-theme-set-face (spec)
|
||||||
|
(cond ((listp (car spec))
|
||||||
|
(cl-loop for face in (car spec)
|
||||||
|
collect `(,face ,(cdr spec))))
|
||||||
|
((keywordp (car spec))
|
||||||
|
`((,(car spec) ((t ,(cdr spec))))))
|
||||||
|
(`((,(car spec) ,(cdr spec))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro custom-theme-set-faces! (theme &rest specs)
|
(defun 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.
|
||||||
|
@ -14,7 +22,7 @@ all themes. It will apply to all themes once they are loaded.
|
||||||
'(org-tag :background \"#4499FF\")
|
'(org-tag :background \"#4499FF\")
|
||||||
'(org-ellipsis :inherit org-tag)
|
'(org-ellipsis :inherit org-tag)
|
||||||
'(which-key-docstring-face :inherit font-lock-comment-face))"
|
'(which-key-docstring-face :inherit font-lock-comment-face))"
|
||||||
`(let* ((themes (doom-enlist (or ,theme 'user)))
|
`(let* ((themes (doom-enlist (or theme 'user)))
|
||||||
(fn (gensym (format "doom--customize-%s-h-" (mapconcat #'symbol-name themes "-")))))
|
(fn (gensym (format "doom--customize-%s-h-" (mapconcat #'symbol-name themes "-")))))
|
||||||
(fset fn
|
(fset fn
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
@ -22,16 +30,14 @@ all themes. It will apply to all themes once they are loaded.
|
||||||
(when (or (eq theme 'user)
|
(when (or (eq theme 'user)
|
||||||
(custom-theme-enabled-p theme))
|
(custom-theme-enabled-p theme))
|
||||||
(apply #'custom-theme-set-faces 'user
|
(apply #'custom-theme-set-faces 'user
|
||||||
(cl-loop for (face . spec) in (list ,@specs)
|
(mapcan #'doom--custom-theme-set-face
|
||||||
if (keywordp (car spec))
|
specs))))))
|
||||||
collect `(,face ((t ,spec)))
|
|
||||||
else collect `(,face ,spec)))))))
|
|
||||||
(funcall fn)
|
(funcall fn)
|
||||||
(add-hook 'doom-load-theme-hook fn)))
|
(add-hook 'doom-load-theme-hook fn)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defmacro custom-set-faces! (&rest specs)
|
(defun custom-set-faces! (&rest specs)
|
||||||
"Apply a list of face specs as user customizations.
|
"Apply a list of face SPECS as user customizations.
|
||||||
|
|
||||||
SPECS is a list of face specs.
|
SPECS is a list of face specs.
|
||||||
|
|
||||||
|
@ -45,7 +51,7 @@ face format, e.g.
|
||||||
'(org-tag :background \"#4499FF\")
|
'(org-tag :background \"#4499FF\")
|
||||||
'(org-ellipsis :inherit org-tag)
|
'(org-ellipsis :inherit org-tag)
|
||||||
'(which-key-docstring-face :inherit font-lock-comment-face))"
|
'(which-key-docstring-face :inherit font-lock-comment-face))"
|
||||||
`(custom-theme-set-faces! 'user ,@specs))
|
(apply #'custom-theme-set-faces! 'user specs))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom/reload-theme ()
|
(defun doom/reload-theme ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue