Subject: Re: bug#14635: 24.3.50; Regression in Customize: no revert changes

From: Mauro Aranda <[email-masked]>
Date: Fri, 30 Oct 2020 10:35:33 -0300

Drew Adams <[email-masked]> writes:

> emacs -Q
> M-x customize-face default
>
> Make some changes.  Then choose Set for current session from the State
> button.
>
> Then try to revert your changes using button `Revert...' > `Revert this
> session's customizations'.  There is no effect: no change in the
> appearance of the buffer.  And trying to revert or undo edits using the
> State button is also impossible: `Revert this session's customizations'
> is now dimmed out.  This is with emacs -Q.
>
> The change of state to revert to no changes seems completely broken (a
> regression).
>

I can reproduce this issue on master.

IIUC, this bug is very similar, if not a duplicate, to Bug#13476.  But
here, we are dealing with the default face, so perhaps it is trickier.

For the default face, face-spec-reset-face only sets all attributes to
default values if (display-graphic-p frame) returns nil.  So on a
graphical display, it never resets :family, :foundry, :width, :height,
:weight, :slant, :foreground and :background.

So, if customizing the foreground color:
M-x customize-face RET default
Move to Foreground and change it to green
C-c C-c to set it for the session
Click State and select: Revert this session's customizations

The default face is still green.  And:
(face-attribute 'default :foreground) ==> "green"

On a TTY the above recipe works just fine, because we do pass default
values here.

What would be the right way for face-spec-reset-face to reset all the
attributes of the default face to the default values, in a graphic
display?