@@ -3721,7 +3721,8 @@ WIDGET should be a `custom-face' widget."
3721
3721
`((t ,(widget-value child)))
3722
3722
(widget-value child)))))
3723
3723
3724
- (defun custom-face-get-current-spec (face )
3724
+ (defun custom-face-get-current-spec-unfiltered (face )
3725
+ " Return the current spec for face FACE, without filtering it."
3725
3726
(let ((spec (or (get face 'customized-face )
3726
3727
(get face 'saved-face )
3727
3728
(get face 'face-defface-spec )
@@ -3732,7 +3733,11 @@ WIDGET should be a `custom-face' widget."
3732
3733
; ; edit it as the user has specified it.
3733
3734
(if (not (face-spec-match-p face spec (selected-frame )))
3734
3735
(setq spec `((t ,(face-attr-construct face (selected-frame ))))))
3735
- (custom-pre-filter-face-spec spec)))
3736
+ spec))
3737
+
3738
+ (defun custom-face-get-current-spec (face )
3739
+ " Return the current spec for face FACE, filtering it."
3740
+ (custom-pre-filter-face-spec (custom-face-get-current-spec-unfiltered face)))
3736
3741
3737
3742
(defun custom-toggle-hide-face (visibility-widget &rest _ignore )
3738
3743
" Toggle the visibility of a `custom-face' parent widget.
@@ -3852,8 +3857,8 @@ the present value is saved to its :shown-value property instead."
3852
3857
(unless (widget-get widget :custom-form )
3853
3858
(widget-put widget :custom-form custom-face-default-form))
3854
3859
3855
- (let* ((spec ( or ( widget-get widget :shown-value )
3856
- (custom-face-get-current-spec symbol)))
3860
+ (let* ((shown-value ( widget-get widget :shown-value ) )
3861
+ (spec ( or shown-value (custom-face-get-current-spec symbol)))
3857
3862
(form (widget-get widget :custom-form ))
3858
3863
(indent (widget-get widget :indent ))
3859
3864
face-alist face-entry spec-default spec-match editor)
@@ -3894,7 +3899,7 @@ the present value is saved to its :shown-value property instead."
3894
3899
widget 'sexp :value spec))))
3895
3900
(push editor children)
3896
3901
(widget-put widget :children children)
3897
- (custom-face-state-set widget))))))
3902
+ (custom-face-state-set widget ( not shown-value) ))))))
3898
3903
3899
3904
(defun cus--face-link (widget _format )
3900
3905
(widget-create-child-and-convert
@@ -4014,13 +4019,18 @@ This is one of `set', `saved', `changed', `themed', or `rogue'."
4014
4019
'changed
4015
4020
state)))
4016
4021
4017
- (defun custom-face-state-set (widget )
4022
+ (defun custom-face-state-set (widget &optional no-filter )
4018
4023
" Set the state of WIDGET, a custom-face widget.
4019
4024
If the user edited the widget, set the state to modified. If not, the new
4020
- state is one of the return values of `custom-face-state' ."
4025
+ state is one of the return values of `custom-face-state' .
4026
+ Optional argument NO-FILTER means to check against an unfiltered spec."
4021
4027
(let ((face (widget-value widget)))
4022
4028
(widget-put widget :custom-state
4023
- (if (face-spec-match-p face (custom-face-widget-to-spec widget))
4029
+ (if (face-spec-match-p
4030
+ face
4031
+ (if no-filter
4032
+ (custom-face-get-current-spec-unfiltered face)
4033
+ (custom-face-widget-to-spec widget)))
4024
4034
(custom-face-state face)
4025
4035
'modified ))))
4026
4036
0 commit comments