From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#75171: 30.0.50; Checklist widget inside a group does not initialize correctly Date: Thu, 2 Jan 2025 10:56:26 -0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13983"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: 75171@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 02 14:57:14 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tTLhK-0003QI-3a for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 02 Jan 2025 14:57:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tTLhC-0002iO-5T; Thu, 02 Jan 2025 08:57:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTLh9-0002hw-Pu for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 08:57:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tTLh9-0002Qn-Gr for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 08:57:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:Mime-Version:References:Date:From:To:Subject; bh=malvDaM4rVRUfWRgsoyBU/vrQdfcrXs7vtYhPSVyLfk=; b=WMxt/M4+qOLJ/7Q+MEK2lxng4zAsVY2FQ8DumrPjEYG56R721rt8+03tVxVnmbyXWkeBwLfqMjogO1WzsEp1ttlPjkRuZdjciT/L2CFwMyqWB5G+UKq/Ek1MIUJiWGgFxqeLtZM3szCD3Jxq0BYzBOlDQ8VR/o5O6j6Z85hWm1/pcXMj3qfK8aNvHmvuCMbvKTe89QoScuQOxVJmVZnxnWyu11QD3guma/KvQeYhGwIWw2C4el2xgBB8Ke32cXAju9Nb8/8AsR7aOLQO2uq42/SPhrFwIrn42YYSCMwWOqHiFsQjTn73uhlIubq1m5Bvbwd8NodPfYP3w6U8U2MMGQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tTLh9-0001RL-4S for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 08:57:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 02 Jan 2025 13:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75171 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17358262085508 (code B ref -1); Thu, 02 Jan 2025 13:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Jan 2025 13:56:48 +0000 Original-Received: from localhost ([127.0.0.1]:43224 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tTLgt-0001Ql-C5 for submit@debbugs.gnu.org; Thu, 02 Jan 2025 08:56:48 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:35612) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tTLgr-0001QR-LJ for submit@debbugs.gnu.org; Thu, 02 Jan 2025 08:56:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTLgk-0002gn-SN for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 08:56:39 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tTLgj-0002NN-C3 for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 08:56:38 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1tTLge-0002gj-Is for bug-gnu-emacs@gnu.org; Thu, 02 Jan 2025 14:56:32 +0100 X-Injected-Via-Gmane: http://gmane.org/ Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=116.202.254.214; envelope-from=geb-bug-gnu-emacs@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: 2 X-Spam_score: 0.2 X-Spam_bar: / X-Spam_report: (0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.2, NML_ADSP_CUSTOM_MED=0.9, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298166 Archived-At: Al Haji-Ali 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.