Subject: 30.0.93; defcustom is not ordering-agnostic

From: Robert Pluim <[email-masked]>
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)