Subject: bug#41831: 26.3; Customize UI fails for defcustom with standard default of list heterogenous choice types

From: Mauro Aranda <[email-masked]>
Date: Thu, 18 Jun 2020 09:54:42 -0300

Hello Pierre.

Pierre Rouleau <[email-masked]> writes:

> (defcustom pel-key-chords
>   '((global "<>" ("<>\C-b"))
>     (global             "[]"     ("[]\C-b"))
>     (c-mode             "{}"     ("{\n\n}\C-p"))
>     (c++-mode           "{}"     ("{\n\n}\C-p")))
>   ;; (flyspell-mode    "4r"     flyspell-correct-word-before-point)
>   ;; (flyspell-prog-mode "4r"     flyspell-correct-word-before-point)
>   ;; (global             "6y"     pel-find-file-at-point-in-window)
>   ;; (global             ".;"     pel-search-word-from-top))

My guess is that the functions you are using here are not known to be
defined by the time you want to customize the variable.  In other words,
`functionp' returns nil for these symbols at that time.

I followed this recipe:
1. Start emacs -Q

2. In the *scratch* buffer, I evaluated the following:
(defcustom pel-key-chords
  '((global "<>" ("<>\C-b"))
    (c-mode "{}" ("{\n\n}\C-p"))
    (flyspell-mode "4r" flyspell-correct-word-before-point)
    (global ".;" pel-search-word-from-top))
  "..."
  :type '(repeat
 (choice
  (list
   :tag "expansion-keys"
   (symbol :tag "mode" :value global)
   (string :tag "chars")
   (repeat (key-sequence :tag "key")))
  (list
   :tag "command"
   (symbol :tag "mode" :value global)
   (string :tag "chars")
   (function :tag "command")))))

3. M-x customize-option RET pel-key-chords
That gives me the mismatch message.  At this time, flyspell isn't
loaded, and `pel-search-word-from-top' is not defined.

4. C-x k RET, to kill the customize buffer.

5. Eval:
(require 'flyspell)
(defun pel-search-word-from-top ()
  (ignore))

6. Again: M-x customize-option RET pel-key-chords
Now I see the customize buffer as expected, with the state being
STANDARD.

Would you try the above, to check if my guess is correct?