unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12084: 24.1; default value for defcustom :type `choice'
@ 2012-07-29 20:28 Drew Adams
  2012-07-29 20:35 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2012-07-29 20:28 UTC (permalink / raw)
  To: 12084

emacs -Q
 
(defcustom foo ()
  "..."
  :type `(repeat
   (choice ,@(mapcar (lambda (cset) `(const ,cset))
       charset-list)))
  :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
"choice".
 
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
documented.
 
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
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'
 
y







^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#12084: 24.1; default value for defcustom :type `choice'
  2012-07-29 20:28 bug#12084: 24.1; default value for defcustom :type `choice' Drew Adams
@ 2012-07-29 20:35 ` Drew Adams
  2012-09-16 23:38   ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2012-07-29 20:35 UTC (permalink / raw)
  To: 12084

> (defcustom foo ()
>   "..."
>   :type `(repeat
>    (choice ,@(mapcar (lambda (cset) `(const ,cset))
>                      charset-list)))
>   :group 'convenience)

Lest someone reply that the programmer can order the list, e.g. could use, say,
`(charset-priority-list)' instead of `charset-list', let me say that that would
miss the  point.

The problem (bug) is about specifying the default value, and documenting that.
It is not about improving the particular example used to illustrate the problem.






^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#12084: 24.1; default value for defcustom :type `choice'
  2012-07-29 20:35 ` Drew Adams
@ 2012-09-16 23:38   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2012-09-16 23:38 UTC (permalink / raw)
  To: 12084

ping






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-09-16 23:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-29 20:28 bug#12084: 24.1; default value for defcustom :type `choice' Drew Adams
2012-07-29 20:35 ` Drew Adams
2012-09-16 23:38   ` Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).