Subject: bug#64347: 30.0.50; Some customize faces shown as edited with -Q

From: Mauro Aranda <[email-masked]>
Date: Fri, 30 Jun 2023 08:33:39 -0300

Eli Zaretskii <[email-masked]> writes:

 >> From: Stephen Berman <[email-masked]>
 >> Date: Thu, 29 Jun 2023 12:15:00 +0200
 >>
 >> 0. emacs -Q
 >> 1. M-x customize-face RET RET
 >> 2. Toggle all face entries in the buffer *Customize Faces* (e.g. by
 >>    creating this keyboard macro: C-s C-q C-j S RET C-f and then
 >>    executing it 164 times) and search for the string "EDITED" in the
 >>    buffer.
 >>    => The following faces show the State "EDITED, shown value does not
 >>    take effect until you set or save it.":
 >>    confusingly-reordered
 >>    custom-button
 >>    custom-button-mouse
 >>    custom-button-pressed
 >>    mode-line
 >>    mode-line-highlight
 >>    mode-line-inactive
 >>    tab-bar-tab
 >>    tool-bar
 >>    All other faces show the State "STANDARD".
 >> 3. Clicking the State button of these faces and selecting either "Undo
 >>    Edits" or "Revert This Session's Customization" does not change the
 >>    State shown.
 >> 4. Clicking the State button of, e.g., mode-line and selecting "Set for
 >>    Current Session" changes the State shown to "SET for current session
 >>    only."  I see no difference in the appearance of the mode line before
 >>    and after this State change.
 >> 5. Clicking the State button of mode-line again and selecting "Revert
 >>    This Session's Customization" changes the State shown back to
 >>    "EDITED, shown value does not take effect until you set or save it.",
 >>    and again the appearance of the mode-line is unchanged.
 >
 > This is a regression between Emacs 27.2 and Emacs 28.1. Bisecting
 > will be welcome.

I tried to bisect but I'm finding build errors on older commits:
CC       sysdep.o
sysdep.c:1784:22: error: variably modified ‘sigsegv_stack’ at file scope
  1784 | static unsigned char sigsegv_stack[SIGSTKSZ];

So I did some debugging.  I noted that all the faces posted by Stephen
(except confusingly-reordered) have a Horizontal Width widget.  So
something like this is enough to get Custom confused:
(defface test
   '((t :box (:line-width 2 :style released-button)))
   "...")

M-x customize-face RET test
Shows the EDITED State.

So that points to Custom fiddling with the real value, i.e., what
face-attribute would return, but not with the "customized value", the
value that holds the Widget.

Looking at the changes in custom-face-attributes, I see this commit:
commit 34ae2d0c220c945443e94a43d043a4a63c444bf4
Author: Alexandre Adolphe <[email-masked]>
Date:   Sat Aug 10 22:57:24 2019 +0200

     Allow negative line width for :box face attribute

And I noticed that it modified the real-value filter, but not the
customized-value filter.  So I suspect that might be the problem.

Maybe someone that is able to build Emacs for that and previous commits
can confirm.

In the meantime, I'll read the documentation on :line-width, since I'm
pretty sure a changed in the customized value filter is required.

(And I don't know what's wrong with the confusingly-reordered face yet)