all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Al Haji-Ali <abdo.haji.ali@gmail.com>
To: 75171@debbugs.gnu.org
Subject: bug#75171: 30.0.50; Checklist widget inside a group does not initialize correctly
Date: Sun, 29 Dec 2024 08:33:44 +0000	[thread overview]
Message-ID: <m2ldvyriqf.fsf@gmail.com> (raw)


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





             reply	other threads:[~2024-12-29  8:33 UTC|newest]

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

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

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

  git send-email \
    --in-reply-to=m2ldvyriqf.fsf@gmail.com \
    --to=abdo.haji.ali@gmail.com \
    --cc=75171@debbugs.gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.