GNU bug report logs -
#75171
30.0.50; Checklist widget inside a group does not initialize correctly
Previous Next
Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Date: Sun, 29 Dec 2024 08:41:02 UTC
Severity: normal
Tags: notabug
Found in version 30.0.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 75171 in the body.
You can then email your comments to 75171 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Sun, 29 Dec 2024 08:41:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Al Haji-Ali <abdo.haji.ali <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sun, 29 Dec 2024 08:41:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The following function creates four widgets (two radio button lists and two checklists) inside a group. All lists have an initial value, while the group has a nil value. Strangely, the radio buttons get initialized correctly (selecting the correct button based on their value), but the checkboxes do not (all boxes are unchecked regardless of the value). Removing the group results in correct initialization.
--8<---------------cut here---------------start------------->8---
(defun widget-test ()
(let ((items '((item :format "%[One%] " :value 1)
(item :format "%[Two%] " :value 2)
(item :format "%[Three%] " :value 3))))
(widget-create
'group
(append '(radio-button-choice
:inline t
:format "Inline radio:\n%v\n"
:value 2)
items)
(append '(radio-button-choice
:format "Not inline radio:\n%v\n"
:value 2)
items)
(append '(checklist
:inline t
:format "Inline checks:\n%v\n"
:value (1 2))
items)
(append '(checklist
:format "Not inline checks:\n%v\n"
:value (1 2))
items)))
(widget-setup))
--8<---------------cut here---------------end--------------->8---
If this is unintended behaviour, I managed to fix the inline version of the checklists with this advice
--8<---------------cut here---------------start------------->8---
(advice-add 'widget-checklist-match-inline
:around
(lambda (old-fn wid val)
(when val
(funcall old-fn wid val))))
--8<---------------cut here---------------end--------------->8---
The non-inline version probably requires a fix in `widget-checklist-match`, but I can't make out the logic in this function (it seems to return non-nil when not matching?!).
If it is intended behaviour, how can I correctly set the value of a checklist? and why is there a discrepancy between radio buttons and check lists?
-- Al
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Thu, 02 Jan 2025 13:57:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
> The following function creates four widgets (two radio button lists
> and two checklists) inside a group. All lists have an initial value,
> while the group has a nil value. Strangely, the radio buttons get
> initialized correctly (selecting the correct button based on their
> value), but the checkboxes do not (all boxes are unchecked regardless
> of the value). Removing the group results in correct initialization.
>
> (defun widget-test ()
> (let ((items '((item :format "%[One%] " :value 1)
> (item :format "%[Two%] " :value 2)
> (item :format "%[Three%] " :value 3))))
> (widget-create
> 'group
> (append '(radio-button-choice
> :inline t
> :format "Inline radio:\n%v\n"
> :value 2)
> items)
> (append '(radio-button-choice
> :format "Not inline radio:\n%v\n"
> :value 2)
> items)
> (append '(checklist
> :inline t
> :format "Inline checks:\n%v\n"
> :value (1 2))
> items)
> (append '(checklist
> :format "Not inline checks:\n%v\n"
> :value (1 2))
> items)))
> (widget-setup))
>
There's no explicit :value for the group widget, so its value is nil,
and then the Widget library tries to create all four children with a nil
value. The radio-button-choice widget differs from the checklist widget
in that the former tries to be created with a selected choice, and tries
harder than the checklist widget, which is fine with a value of nil.
That way, you see that the specified value is obeyed in
radio-button-choice but not in the checklist widget.
FTR, I'm not saying this is 100% correct. I'm just trying to explain
how it works now.
> If this is unintended behaviour, I managed to fix the inline version
> of the checklists with this advice
This is intended behavior, AFAIU. The parent can override values for
the children, and that way we can recreate widgets with new values just
by changing the values of the parent.
> If it is intended behaviour, how can I correctly set the value of a
> checklist? and why is there a discrepancy between radio buttons and
> check lists?
I'm not sure if you want them inline or not, but here's a modification
to your recipe that works:
(defun widget-test ()
(let ((items '((item :format "%[One%] " :value 1)
(item :format "%[Two%] " :value 2)
(item :format "%[Three%] " :value 3))))
(widget-create
'group
:value '(2 (1 2))
(append '(radio-button-choice
:format "Not inline radio:\n%v\n"
:value 2)
items)
(append '(checklist
:format "Not inline checks:\n%v\n"
:value (1 2))
items)))
(widget-setup))
As you can see, it's a matter of giving the correct value to the group
widget.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Thu, 02 Jan 2025 13:57:03 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Thu, 02 Jan 2025 22:08:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 75171 <at> debbugs.gnu.org (full text, mbox):
On 02/01/2025, Mauro Aranda wrote:
> Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
> There's no explicit :value for the group widget, so its value is nil,
> and then the Widget library tries to create all four children with a nil
> value. The radio-button-choice widget differs from the checklist widget
> in that the former tries to be created with a selected choice, and tries
> harder than the checklist widget, which is fine with a value of nil.
>
> That way, you see that the specified value is obeyed in
> radio-button-choice but not in the checklist widget.
>
> FTR, I'm not saying this is 100% correct. I'm just trying to explain
> how it works now.
Thanks, this makes sense. Did I miss an explanation of this issue somewhere in the docs?
> This is intended behavior, AFAIU. The parent can override values for
> the children, and that way we can recreate widgets with new values just
> by changing the values of the parent.
I was aware of this behaviour for the group, but I didn't twig the consequence on a checklist.
I have to say that I find it a bit counter-intuitive. Also the fact that there is no way to set the value of a checklist without repeating it in the group is somewhat awkward (certainly it will complicate my implementation) and a bit inconsistent since setting the value of the checklist after the group creation would override the value of the group. A fix, or a some way, that would prevents the group from overriding the values of the children would be useful, IMO.
With that being said, this issue should probably be closed as "not a bug".
Thanks,
-- Al
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Fri, 03 Jan 2025 13:06:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 75171 <at> debbugs.gnu.org (full text, mbox):
Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
> On 02/01/2025, Mauro Aranda wrote:
>
>> Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
>> There's no explicit :value for the group widget, so its value is nil,
>> and then the Widget library tries to create all four children with a nil
>> value. The radio-button-choice widget differs from the checklist widget
>> in that the former tries to be created with a selected choice, and tries
>> harder than the checklist widget, which is fine with a value of nil.
>>
>> That way, you see that the specified value is obeyed in
>> radio-button-choice but not in the checklist widget.
>>
>> FTR, I'm not saying this is 100% correct. I'm just trying to explain
>> how it works now.
>
> Thanks, this makes sense. Did I miss an explanation of this issue
> somewhere in the docs?
I don't think so. The manual is still missing good explanations.
>> This is intended behavior, AFAIU. The parent can override values for
>> the children, and that way we can recreate widgets with new values just
>> by changing the values of the parent.
>
> I was aware of this behaviour for the group, but I didn't twig the
> consequence on a checklist.
>
> I have to say that I find it a bit counter-intuitive. Also the fact
> that there is no way to set the value of a checklist without repeating
> it in the group is somewhat awkward (certainly it will complicate my
> implementation)
Note that you don't necessarily need to repeat it in the checklist
widget. In my example, you only need to pass the :value in group:
(defun widget-test ()
(let ((items '((item :format "%[One%] " :value 1)
(item :format "%[Two%] " :value 2)
(item :format "%[Three%] " :value 3))))
(widget-create
'group
:value '(2 (1 2))
(append '(radio-button-choice
:format "Not inline radio:\n%v\n")
items)
(append '(checklist
:format "Not inline checks:\n%v\n")
items)))
(widget-setup))
When created, radio-button-choice will get its :value set to 2 and
checklist will get it set to (1 2).
> and a bit inconsistent since setting the value of the
> checklist after the group creation would override the value of the
> group. A fix, or a some way, that would prevents the group from
> overriding the values of the children would be useful, IMO.
> With that being said, this issue should probably be closed as "not a
bug".
I'd like to take some time to study this and see if there's a way to
improve the situation.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Mon, 06 Jan 2025 15:15:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 75171 <at> debbugs.gnu.org (full text, mbox):
Mauro Aranda <maurooaranda <at> gmail.com> writes:
> Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
>
>> On 02/01/2025, Mauro Aranda wrote:
>>
>>> Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
>>> This is intended behavior, AFAIU. The parent can override values for
>>> the children, and that way we can recreate widgets with new values just
>>> by changing the values of the parent.
>>
>> I was aware of this behaviour for the group, but I didn't twig the
>> consequence on a checklist.
>>
>> I have to say that I find it a bit counter-intuitive. Also the fact
>> that there is no way to set the value of a checklist without repeating
>> it in the group is somewhat awkward (certainly it will complicate my
>> implementation)
>
> Note that you don't necessarily need to repeat it in the checklist
> widget. In my example, you only need to pass the :value in group:
>
> (defun widget-test ()
> (let ((items '((item :format "%[One%] " :value 1)
> (item :format "%[Two%] " :value 2)
> (item :format "%[Three%] " :value 3))))
> (widget-create
> 'group
> :value '(2 (1 2))
> (append '(radio-button-choice
> :format "Not inline radio:\n%v\n")
> items)
> (append '(checklist
> :format "Not inline checks:\n%v\n")
> items)))
> (widget-setup))
>
> When created, radio-button-choice will get its :value set to 2 and
> checklist will get it set to (1 2).
>
>> and a bit inconsistent since setting the value of the
>> checklist after the group creation would override the value of the
>> group. A fix, or a some way, that would prevents the group from
>> overriding the values of the children would be useful, IMO.
>>
>> With that being said, this issue should probably be closed as "not a
>> bug".
>
> I'd like to take some time to study this and see if there's a way to
> improve the situation.
Making the group widget create its children with their default
values is easy, by testing if it has a explicit nil value or not. But
since it has worked this way forever, I wouldn't suggest changing it.
I think that specifying the :value in the group widget is the way that
the group widget it's supposed to work. There are ways to derive a
widget from it that doesn't enforce it, so I'm inclined to mark this as
notabug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#75171
; Package
emacs
.
(Sat, 18 Jan 2025 09:40:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 75171 <at> debbugs.gnu.org (full text, mbox):
tags 75171 notabug
close 75171
thanks
> Date: Mon, 6 Jan 2025 12:14:36 -0300
> From: Mauro Aranda <maurooaranda <at> gmail.com>
>
> Mauro Aranda <maurooaranda <at> gmail.com> writes:
>
> > Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
> >
> >> On 02/01/2025, Mauro Aranda wrote:
> >>
> >>> Al Haji-Ali <abdo.haji.ali <at> gmail.com> writes:
> >>> This is intended behavior, AFAIU. The parent can override values for
> >>> the children, and that way we can recreate widgets with new values just
> >>> by changing the values of the parent.
> >>
> >> I was aware of this behaviour for the group, but I didn't twig the
> >> consequence on a checklist.
> >>
> >> I have to say that I find it a bit counter-intuitive. Also the fact
> >> that there is no way to set the value of a checklist without repeating
> >> it in the group is somewhat awkward (certainly it will complicate my
> >> implementation)
> >
> > Note that you don't necessarily need to repeat it in the checklist
> > widget. In my example, you only need to pass the :value in group:
> >
> > (defun widget-test ()
> > (let ((items '((item :format "%[One%] " :value 1)
> > (item :format "%[Two%] " :value 2)
> > (item :format "%[Three%] " :value 3))))
> > (widget-create
> > 'group
> > :value '(2 (1 2))
> > (append '(radio-button-choice
> > :format "Not inline radio:\n%v\n")
> > items)
> > (append '(checklist
> > :format "Not inline checks:\n%v\n")
> > items)))
> > (widget-setup))
> >
> > When created, radio-button-choice will get its :value set to 2 and
> > checklist will get it set to (1 2).
> >
> >> and a bit inconsistent since setting the value of the
> >> checklist after the group creation would override the value of the
> >> group. A fix, or a some way, that would prevents the group from
> >> overriding the values of the children would be useful, IMO.
> >>
> >> With that being said, this issue should probably be closed as "not a
> >> bug".
> >
> > I'd like to take some time to study this and see if there's a way to
> > improve the situation.
>
> Making the group widget create its children with their default
> values is easy, by testing if it has a explicit nil value or not. But
> since it has worked this way forever, I wouldn't suggest changing it.
>
> I think that specifying the :value in the group widget is the way that
> the group widget it's supposed to work. There are ways to derive a
> widget from it that doesn't enforce it, so I'm inclined to mark this as
> notabug.
No further comments, so I'm now closing this bug as not-a-bug.
Added tag(s) notabug.
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 18 Jan 2025 09:40:02 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
75171 <at> debbugs.gnu.org and Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Request was from
Eli Zaretskii <eliz <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 18 Jan 2025 09:40:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 15 Feb 2025 12:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 121 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.