Revamp face-spec-set to be more analogous to setq for faces.
* lisp/faces.el (face-spec-set): Change the third arg to specify whether this function is being called via defface, customize, or a third party. Set the appropriate symbol properties. Clear the override spec if setting via Custom. Initialize face if necessary. (face-spec-recalc): Allow theme faces to completely replace the defface spec, in the same way as custom faces (Bug#8454). * lisp/cus-edit.el (custom-face-set, custom-face-mark-to-save) (custom-face-reset-saved, custom-face-mark-to-reset-standard): Simplify by using the new arg to face-spec-set. * lisp/cus-face.el (custom-declare-face): Move face initialization to face-spec-set. (custom-theme-set-faces): Don't initialize the face name here, as that is now done in face-spec-set. * lisp/emacs-lisp/lisp-mode.el (eval-defun-1): When evaluating defface, reset face-override-spec too, and use custom-declare-face. Fixes: debbugs:4988
This commit is contained in:
parent
61d841dd15
commit
1c4f115d4c
6 changed files with 117 additions and 105 deletions
|
@ -847,21 +847,8 @@ Reinitialize the face according to the `defface' specification."
|
|||
(setq face-new-frame-defaults
|
||||
(assq-delete-all face-symbol face-new-frame-defaults))
|
||||
(put face-symbol 'face-defface-spec nil)
|
||||
(put face-symbol 'face-documentation (nth 3 form))
|
||||
;; Setting `customized-face' to the new spec after calling
|
||||
;; the form, but preserving the old saved spec in `saved-face',
|
||||
;; imitates the situation when the new face spec is set
|
||||
;; temporarily for the current session in the customize
|
||||
;; buffer, thus allowing `face-user-default-spec' to use the
|
||||
;; new customized spec instead of the saved spec.
|
||||
;; Resetting `saved-face' temporarily to nil is needed to let
|
||||
;; `defface' change the spec, regardless of a saved spec.
|
||||
(prog1 `(prog1 ,form
|
||||
(put ,(nth 1 form) 'saved-face
|
||||
',(get face-symbol 'saved-face))
|
||||
(put ,(nth 1 form) 'customized-face
|
||||
,(nth 2 form)))
|
||||
(put face-symbol 'saved-face nil))))
|
||||
(put face-symbol 'face-override-spec nil))
|
||||
form)
|
||||
((eq (car form) 'progn)
|
||||
(cons 'progn (mapcar 'eval-defun-1 (cdr form))))
|
||||
(t form)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue