[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12084: 24.1; default value for defcustom :type `choice'

From: Drew Adams
Subject: bug#12084: 24.1; default value for defcustom :type `choice'
Date: Sun, 29 Jul 2012 13:28:34 -0700

emacs -Q
(defcustom foo ()
  :type `(repeat
   (choice ,@(mapcar (lambda (cset) `(const ,cset))
  :group 'convenience)
That defines an option whose value is a list of charsets (symbols).
When you try to use `M-x customize-option foo', and you click [INS] to
choose a charset to insert into the list, you should, I think,
immediately get the prompt to choose a charset using completion.
Instead, you immediately get the first charset in `charset-list' as your
"choice".  You are not given any chance to _choose_, for this supposed
Yes, you can then click button Value Menu, which will prompt you to
choose.  But you did not choose the initial value that was inserted
(e.g., `chinese-cns11643-15').
This is not good.
Worse, there is no way, AFAICT, for you to specify a default value for
`choice'.  You can use :value to specify a default for any given
`choice' possibility (alternative), but you cannot specify a default
value for the overall `choice'.
And yet there is such a default value imposed by Emacs: a value appears
when you click [INS], before you click Value Menu and are presented with
a chance to choose.  A preliminary choice is made for you: a default
value is inserted.
Finally, this default value is described nowhere in the doc.  It seems
to be the first element of the `choice' list, but I do not see this
Well, there is this bit buried in the doc of `choice', under a
discussion of :value (which applies only to the default value of an
individual alternative):
 "If some values are covered by more than one of the alternatives,
  customize will choose the first alternative that the value fits."
It is not clear what "the value" is here, that is being tested to fit.
But I guess that sentence applies to our case here, in this sense: All
of the possible alternatives "fit", so the first is used (it is the
first that "fits").
In sum, there are 3 problems reported here:
1. Clicking button [INS] immediately sets the value.  You are not given
a prompt to choose a value.
2. There is no way for the programmer to define that default value that
is inserted as soon as you click [INS].
3. There is no documentation regarding this default value.
I would like for #1 to be fixed, if possible.  That would presumably
obviate any need to fix #2 and #3.  In effect, if #1 is fixed then there
is no default value needed because you would be immediately forced to
choose the value.
However, when you do choose, there could be a default value for your
minibuffer entry.  In that case, i.e., if we did provide for you to be
able to just hit RET without explicitly choosing an alternative
(e.g. using completion), then #2 and #3 would still apply: there should
be a way to specify the default value (#2), and specifying the default
value should be documented (#3).

In GNU Emacs 24.1.1 (i386-mingw-nt5.1.2600)
 of 2012-06-10 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --cflags

reply via email to

[Prev in Thread] Current Thread [Next in Thread]