Subject: bug#76181: 30.0.93; defcustom is not ordering-agnostic

From: Robert Pluim <[email-masked]>
Date: Mon, 10 Feb 2025 18:07:13 +0100

>>>>> On Mon, 10 Feb 2025 13:19:14 -0300, Mauro Aranda <[email-masked]> said:

    Mauro> Robert Pluim <[email-masked]> 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
--