Subject: bug#69941: 30.0.50; Faulty fontification of radio button widgets

From: Mauro Aranda <[email-masked]>
Date: Sat, 8 Feb 2025 14:06:21 -0300

Stephen Berman <[email-masked]> writes:

 > On Thu, 6 Feb 2025 19:54:02 -0300 Mauro Aranda 
<[email-masked]> wrote:
 >
 >> Stephen Berman <[email-masked]> writes:
 >>
 >>> On Thu, 6 Feb 2025 11:19:53 -0300 Mauro Aranda <[email-masked]>
 >>  wrote:
 >>>
 >>>> Stephen Berman <[email-masked]> writes:
 >>>>
 >>>>> On Wed, 05 Feb 2025 15:10:16 +0200 Eli Zaretskii <[email-masked]> 
wrote:
 >>>>>
 >>>>>>> From: Stefan Monnier <[email-masked]>
 >>>>>>> Cc: Mauro Aranda <[email-masked]>,  [email-masked],
 >>>>>>>   [email-masked]
 >>>>>>> Date: Sun, 02 Feb 2025 18:28:39 -0500
 >>>>>>>
 >>>>>>> > Stefan, any further comments, or should we install this?
 >>>>>>>
 >>>>>>> We can install this, AFAIC.
 >>>>>>
 >>>>>> Thanks, installed on the master branch, and closing the bug.
 >>>>>
 >>>>> I've only now found time to try Mauro's patch, and while I can 
confirm
 >>>>> that it fixes the example of misfontification I reported in my OP,
 >>>>> unfortunately I still see the same kind of misfontification with the
 >>>>> program of mine that prompted my OP.  I haven't had time to 
investigate
 >>>>> further and I'm not sure when I will, but if and when I can 
provide more
 >>>>> information, I'll either reopen this bug or file a new one.
 >>>>>
 >>>>> Steve Berman
 >>>>
 >>>> Can you share some code? Either here or by private email?
 >>>
 >>> Rather than posting or sending you the whole program as well as a data
 >>> file needed to run it and explaining how to use it, I'd prefer to try
 >>> and isolate the problem and provide a small and self-contained code
 >>> snippet to reproduce it.  I'll try to do that in the next few days.
 >>>
 >>> Steve Berman
 >>
 >> Ok then, I'll wait.
 >
 > With the attached file I can reproduce the problem.  Save the file and
 > then invoke Emacs from master (i.e., with your patch) as follows:
 >
 > emacs -Q -l srb-widget-test.el -f srb-widget-test
 >
 > In the displayed buffer "*Widget Test*" the three radio buttons "One",
 > "Two" and "Confirm" are active, which the default face visually
 > confirms.  (Their labels are fontified with face `widget-unselected'.)
 > Now do the following steps:
 >
 > 1. Hit TAB to move point to radio button "One".
 > 2. Type RET to activate the "Reset" button and move point to it.  Also,
 >    the radio buttons are now deactivated, which is indicated by their
 >    now being fontified with face `widget-inactive' (as are their
 >    labels).
 > 3. Type RET on the "Reset" button to reactivate the radio buttons.
 > 4. Hit TAB twice to move point to radio button "Two". Hitting RET
 >    results in the same state as in step 2.
 > 5. Repeat step 3 and then hit TAB three times (or S-TAB once) to move
 >    point to radio button "Confirm".  This pops up two indented radio
 >    buttons "Right" and "Wrong" under "Confirm", and point is now on
 >    "Right".  Note that the radio buttons "One", "Two" and "Confirm" are
 >    deactivated, while "Right" and "Wrong" are active.
 > 6. Type RET on radio button "Right".  This deletes radio buttons "Right"
 >    and "Wrong" and moves point to "Reset".  Radio buttons "One", "Two"
 >    and "Confirm" remain deactivated (confirmed by tabbing to each and
 >    typing RET, which dings and displays the message "Attempt to perform
 >    action on inactive widget"); however:
 > => Now radio button "One" is misfontified with the default face instead
 >    of face `widget-inactive'.
 >
 > If you repeat step 5 and then tab to radio button "Wrong" and hit RET,
 > the resulting state is the same as in step 6, i.e., radio button "One"
 > (and only it) is again misfontified.

Thank you for taking your time to put together this recipe.  I'll be
debugging this between today and tomorrow when I'll have some free
time.

 > Note that if you load the file and execute the recipe in emacs-30, the
 > misfontification of radio button "One" also happens on steps 2, 4 and 5.
 > So the correct fontification on these steps in master is due to your
 > patch.  But the patch doesn't prevent the misfontification in step 6.
 > However, I have found two ways to avoid this misfontification: One way
 > is to uncomment the line `(widget-apply srb--radio-widget :activate)' in
 > `srb--confirm', the other way is to comment out the line
 > `(widget-value-set srb--radio-widget "")' in `srb--result'.

Ok, good to know that the patch was a step forward.  I'm still not sure
if it's the same bug or something different.