GNU bug report logs - #76181
30.0.93; defcustom is not ordering-agnostic

Previous Next

Package: emacs;

Reported by: Robert Pluim <rpluim <at> gmail.com>

Date: Mon, 10 Feb 2025 16:02:01 UTC

Severity: normal

Tags: notabug

Found in version 30.0.93

Done: Robert Pluim <rpluim <at> gmail.com>

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 76181 in the body.
You can then email your comments to 76181 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Mon, 10 Feb 2025 16:02:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Robert Pluim <rpluim <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 10 Feb 2025 16:02:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.93; defcustom is not ordering-agnostic
Date: Mon, 10 Feb 2025 17:00:52 +0100
(this is a reduced test case after I noticed
`org-table-duration-custom-format' behaving funny.)

emacs -Q -nw
;; evaluate the following defcustoms

(defcustom this-is-broken 'one
  "user option one"
  :type '(choice
          (symbol :tag "two" two)
	  (symbol :tag "one" one)))

(defcustom this-is-ok 'one
  "user option two"
  :type '(choice 
	  (symbol :tag "one" one)
          (symbol :tag "two" two)))

M-x customize-variable RET this-is-broken RET

;; The display is wrong, itʼs showing the "two" tag, but the correct
;; value:

    Hide This Is Broken: Choice: [Value Menu] two: one
       [ State ]: STANDARD.
       user option one

;; Select "Value Menu", choose option 0 (which is labelled "two").
;; The display doesnʼt change (and setting the option doesnʼt change the
;; value of the variable)

If you repeat all the above with `this-is-ok', everything works, and the
only difference is the ordering in the choice portion of the type.

The behaviour is the same in emacs-master, emacs-29, and emacs-28

In GNU Emacs 30.0.93 (build 14, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2025-02-10 built on rltb
Repository revision: 317a5015f8a561317da829f3430829a3ef8a4d13
Repository branch: emacs-30
System Description: Debian GNU/Linux 12 (bookworm)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Mon, 10 Feb 2025 16:20:02 GMT) Full text and rfc822 format available.

Message #8 received at 76181 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>, 76181 <at> debbugs.gnu.org
Subject: Re: bug#76181: 30.0.93; defcustom is not ordering-agnostic
Date: Mon, 10 Feb 2025 13:19:14 -0300
Robert Pluim <rpluim <at> gmail.com> writes:

> (this is a reduced test case after I noticed
> `org-table-duration-custom-format' behaving funny.)
>
> emacs -Q -nw
> ;; evaluate the following defcustoms
>
> (defcustom this-is-broken 'one
>   "user option one"
>   :type '(choice
>           (symbol :tag "two" two)
> 	  (symbol :tag "one" one)))
>
> (defcustom this-is-ok 'one
>   "user option two"
>   :type '(choice
> 	  (symbol :tag "one" one)
>           (symbol :tag "two" two)))
>
> M-x customize-variable RET this-is-broken RET
>
> ;; The display is wrong, itʼs showing the "two" tag, but the correct
> ;; value:

For the 'choice type, manual says:

If some values are covered by more than one of the alternatives,
customize will choose the first alternative that the value fits.
This means you should always list the most specific types first,
and the most general last.

So this works as expected, a symbol matches a symbol widget, no matter
what the default value for that symbol widget is.

Alternative is to use const.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Mon, 10 Feb 2025 17:08:02 GMT) Full text and rfc822 format available.

Message #11 received at 76181 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 76181 <at> debbugs.gnu.org
Subject: Re: bug#76181: 30.0.93; defcustom is not ordering-agnostic
Date: Mon, 10 Feb 2025 18:07:13 +0100
>>>>> On Mon, 10 Feb 2025 13:19:14 -0300, Mauro Aranda <maurooaranda <at> gmail.com> said:

    Mauro> Robert Pluim <rpluim <at> gmail.com> writes:
    >> (this is a reduced test case after I noticed
    >> `org-table-duration-custom-format' behaving funny.)
    >> 
    >> emacs -Q -nw
    >> ;; evaluate the following defcustoms
    >> 
    >> (defcustom this-is-broken 'one
    >> "user option one"
    >> :type '(choice
    >> (symbol :tag "two" two)
    >> (symbol :tag "one" one)))
    >> 
    >> (defcustom this-is-ok 'one
    >> "user option two"
    >> :type '(choice
    >> (symbol :tag "one" one)
    >> (symbol :tag "two" two)))
    >> 
    >> M-x customize-variable RET this-is-broken RET
    >> 
    >> ;; The display is wrong, itʼs showing the "two" tag, but the correct
    >> ;; value:

    Mauro> For the 'choice type, manual says:

    Mauro> If some values are covered by more than one of the alternatives,
    Mauro> customize will choose the first alternative that the value fits.
    Mauro> This means you should always list the most specific types first,
    Mauro> and the most general last.

Hmm, ok. Although in this case the types are equally specific.

    Mauro> So this works as expected, a symbol matches a symbol widget, no matter
    Mauro> what the default value for that symbol widget is.

    Mauro> Alternative is to use const.

Yes, that works better. Although if `choice' can figure it out based
on the values for `const', it should be able to do the same for
`symbol'. Any pointers to where I should look to fix this?

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Mon, 10 Feb 2025 17:27:02 GMT) Full text and rfc822 format available.

Message #14 received at 76181 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 76181 <at> debbugs.gnu.org
Subject: Re: bug#76181: 30.0.93; defcustom is not ordering-agnostic
Date: Mon, 10 Feb 2025 14:26:36 -0300
Robert Pluim <rpluim <at> gmail.com> writes:

>>>>>> On Mon, 10 Feb 2025 13:19:14 -0300, Mauro Aranda
>> <maurooaranda <at> gmail.com> said:
>
>     Mauro> Robert Pluim <rpluim <at> gmail.com> writes:
>     >> (this is a reduced test case after I noticed
>     >> `org-table-duration-custom-format' behaving funny.)
>     >>
>     >> emacs -Q -nw
>     >> ;; evaluate the following defcustoms
>     >>
>     >> (defcustom this-is-broken 'one
>     >> "user option one"
>     >> :type '(choice
>     >> (symbol :tag "two" two)
>     >> (symbol :tag "one" one)))
>     >>
>     >> (defcustom this-is-ok 'one
>     >> "user option two"
>     >> :type '(choice
>     >> (symbol :tag "one" one)
>     >> (symbol :tag "two" two)))
>     >>
>     >> M-x customize-variable RET this-is-broken RET
>     >>
>     >> ;; The display is wrong, itʼs showing the "two" tag, but the 
correct
>     >> ;; value:
>
>     Mauro> For the 'choice type, manual says:
>
>     Mauro> If some values are covered by more than one of the 
alternatives,
>     Mauro> customize will choose the first alternative that the value 
fits.
>     Mauro> This means you should always list the most specific types 
first,
>     Mauro> and the most general last.
>
> Hmm, ok. Although in this case the types are equally specific.

So, the first one wins.  The :tag is just informative, it has nothing to
do with the symbol widget's value.  And the default value is for
creating it if nothing else is specified.  In this case, there's a
symbol specified, one.

>     Mauro> So this works as expected, a symbol matches a symbol
>     Mauro> widget, no matter
>     Mauro> what the default value for that symbol widget is.
>
>     Mauro> Alternative is to use const.
>
> Yes, that works better. Although if `choice' can figure it out based
> on the values for `const', it should be able to do the same for
> `symbol'. Any pointers to where I should look to fix this?

I don't think there's anything to fix.  What's the point in using two
symbol widgets in a choice? A symbol widget is for the user to enter a
symbol, and it can be done regardless of the tag or its default value.

What you're asking is to match according to the default value, and that
will break a lot of stuff: after editing the widget, the current
value isn't equal to the default value anymore, and that will result in
perfectly valid values being rejected.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Mon, 10 Feb 2025 17:52:02 GMT) Full text and rfc822 format available.

Message #17 received at 76181 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 76181 <at> debbugs.gnu.org
Subject: Re: bug#76181: 30.0.93; defcustom is not ordering-agnostic
Date: Mon, 10 Feb 2025 18:50:56 +0100
tags 76181 notabug
close 76181
quit

>>>>> On Mon, 10 Feb 2025 14:26:36 -0300, Mauro Aranda <maurooaranda <at> gmail.com> said:
    >> Yes, that works better. Although if `choice' can figure it out based
    >> on the values for `const', it should be able to do the same for
    >> `symbol'. Any pointers to where I should look to fix this?

    Mauro> I don't think there's anything to fix.  What's the point in using two
    Mauro> symbol widgets in a choice? A symbol widget is for the user to enter a
    Mauro> symbol, and it can be done regardless of the tag or its default value.

I think I understand now, thank you for the explanations. Perhaps Iʼll
put some warnings in the custom info manual.

Closing.

Robert
-- 




Added tag(s) notabug. Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 10 Feb 2025 17:52:03 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 76181 <at> debbugs.gnu.org and Robert Pluim <rpluim <at> gmail.com> Request was from Robert Pluim <rpluim <at> gmail.com> to control <at> debbugs.gnu.org. (Mon, 10 Feb 2025 17:52:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Mon, 10 Feb 2025 19:03:02 GMT) Full text and rfc822 format available.

Message #24 received at 76181 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 76181 <at> debbugs.gnu.org
Subject: Re: bug#76181: 30.0.93; defcustom is not ordering-agnostic
Date: Mon, 10 Feb 2025 16:02:31 -0300
On 10/2/25 14:50, Robert Pluim wrote:
> tags 76181 notabug
> close 76181
> quit
>
>>>>>> On Mon, 10 Feb 2025 14:26:36 -0300, Mauro Aranda 
<maurooaranda <at> gmail.com> said:
>      >> Yes, that works better. Although if `choice' can figure it 
out based
>      >> on the values for `const', it should be able to do the same for
>      >> `symbol'. Any pointers to where I should look to fix this?
>
>      Mauro> I don't think there's anything to fix.  What's the point 
in using two
>      Mauro> symbol widgets in a choice? A symbol widget is for the 
user to enter a
>      Mauro> symbol, and it can be done regardless of the tag or its 
default value.
>
> I think I understand now, thank you for the explanations. Perhaps Iʼll
> put some warnings in the custom info manual.
>

No problem.  Looking at org-table-duration-custom-format, looks like you
found the same bug I did a week ago:
https://list.orgmode.org/87ikpjgfkr.fsf <at> localhost/T/#t

But I missed entirely that there were multiple symbol widgets used as
choice.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#76181; Package emacs. (Tue, 11 Feb 2025 08:31:01 GMT) Full text and rfc822 format available.

Message #27 received at 76181 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>
Cc: 76181 <at> debbugs.gnu.org
Subject: Re: bug#76181: 30.0.93; defcustom is not ordering-agnostic
Date: Tue, 11 Feb 2025 09:30:39 +0100
>>>>> On Mon, 10 Feb 2025 16:02:31 -0300, Mauro Aranda <maurooaranda <at> gmail.com> said:

    Mauro> No problem.  Looking at org-table-duration-custom-format, looks like you
    Mauro> found the same bug I did a week ago:
    Mauro> https://list.orgmode.org/87ikpjgfkr.fsf <at> localhost/T/#t

🙂 And itʼs fixed already.

    Mauro> But I missed entirely that there were multiple symbol widgets used as
    Mauro> choice.

Iʼll send a followup patch, I think.

Robert
-- 




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 11 Mar 2025 11:24:19 GMT) Full text and rfc822 format available.

This bug report was last modified 102 days ago.

Previous Next


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