GNU bug report logs - #63290
30.0.50; Customize UI shows extra fields for (choice (const ...) (alist ...))

Previous Next

Package: emacs;

Reported by: Thomas Fitzsimmons <fitzsim <at> fitzsim.org>

Date: Fri, 5 May 2023 06:04:01 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Thomas Fitzsimmons <fitzsim <at> fitzsim.org>
Subject: bug#63290: closed (Re: bug#63290: 30.0.50; Customize UI shows
 extra fields for (choice (const ...) (alist ...)))
Date: Sat, 19 Aug 2023 08:35:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#63290: 30.0.50; Customize UI shows extra fields for (choice (const ...) (alist ...))

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 63290 <at> debbugs.gnu.org.

-- 
63290: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63290
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 63290-done <at> debbugs.gnu.org, fitzsim <at> fitzsim.org
Subject: Re: bug#63290: 30.0.50;
 Customize UI shows extra fields for (choice (const ...) (alist ...))
Date: Sat, 19 Aug 2023 11:34:24 +0300
> Cc: 63290 <at> debbugs.gnu.org
> Date: Tue, 15 Aug 2023 19:46:35 -0300
> From: Mauro Aranda <maurooaranda <at> gmail.com>
> 
> So, in case the :value is missing for the alist widget, we want to
> compute the default-value with the :options, and without including the
> editable-list.
> 
> Hopefully the attached patch is 100% correct now.  I did try it with
> excorporate-configuration and I think it works OK, but please give it
> yourself a try.  And thank you for your patience.

Thanks, I've now installed this on the master branch, and I'm closing
the bug.

[Message part 3 (message/rfc822, inline)]
From: Thomas Fitzsimmons <fitzsim <at> fitzsim.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Customize UI shows extra fields for (choice (const ...)
 (alist ...))
Date: Fri, 05 May 2023 02:02:53 -0400
This test case shows the issue:

(defcustom test-custom nil "" :type
  '(choice (alist
	    :key-type (string :tag "key")
	    :value-type (string :tag "value"))
           (const :tag "auto" nil)))
(customize-variable 'test-custom)

The UI first shows:

Hide Test Custom: Choice: Value Menu Alist:
INS
    State : STANDARD.

Then if I choose "Value Menu", and option 1 to choose the "auto" const
value, I get:

Hide Test Custom: Choice: Value Menu auto
    State : EDITED, shown value does not take effect until you set or save it.

which is fine.  Then if I choose "Value Menu" again and choose 0 for the
Alist, I get:

Hide Test Custom: Choice: Value Menu Alist:
INS DEL key: 
            value: 
INS
    State : EDITED, shown value does not take effect until you set or save it.

I wasn't expecting:

INS DEL key: 
            value: 

If I then save the customization, test-custom is ("" . "").  I think it
should instead be nil.

I noticed this on excorporate-configuration, which has:

(defcustom test-custom nil "" :type
  '(choice (const :tag "auto" nil)
           (alist
	    :key-type (string :tag "key")
	    :value-type (string :tag "value"))))

but where the alist is a large nested structure.  If the user
customizes, test-custom, selects the alist, and saves, the structure has
degenerate ("" . ""), or (nil . nil) entries in it.  To avoid this, the
user would have to hit "DEL" on the empty key/value entries, which is
not ideal.

It seems like after a const is shown, Customize considers the variable
"edited".  I don't know why it is adding those extra INS/DEL key/value
UI boxes though.

Thomas



This bug report was last modified 1 year and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.