unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Mauro Aranda <maurooaranda@gmail.com>
To: Al Haji-Ali <abdo.haji.ali@gmail.com>, 75171@debbugs.gnu.org
Subject: bug#75171: 30.0.50; Checklist widget inside a group does not initialize correctly
Date: Mon, 6 Jan 2025 12:14:36 -0300	[thread overview]
Message-ID: <26f23271-fc07-4967-b589-ea756598330f@gmail.com> (raw)
In-Reply-To: <94fb0321-f49b-4cbc-84a5-9696f9366cd3@gmail.com>

Mauro Aranda <maurooaranda@gmail.com> writes:

 > Al Haji-Ali <abdo.haji.ali@gmail.com> writes:
 >
 >> On 02/01/2025, Mauro Aranda wrote:
 >>
 >>> Al Haji-Ali <abdo.haji.ali@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.






  reply	other threads:[~2025-01-06 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-29  8:33 bug#75171: 30.0.50; Checklist widget inside a group does not initialize correctly Al Haji-Ali
2025-01-02 13:56 ` Mauro Aranda
2025-01-02 22:04   ` Al Haji-Ali
2025-01-03 13:05     ` Mauro Aranda
2025-01-06 15:14       ` Mauro Aranda [this message]
2025-01-18  9:39         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=26f23271-fc07-4967-b589-ea756598330f@gmail.com \
    --to=maurooaranda@gmail.com \
    --cc=75171@debbugs.gnu.org \
    --cc=abdo.haji.ali@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).