GNU bug report logs - #12084
24.1; default value for defcustom :type `choice'

Previous Next

Package: emacs;

Reported by: "Drew Adams" <drew.adams <at> oracle.com>

Date: Sun, 29 Jul 2012 20:37:02 UTC

Severity: wishlist

Found in version 24.1

To reply to this bug, email your comments to 12084 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12084; Package emacs. (Sun, 29 Jul 2012 20:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Drew Adams" <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 29 Jul 2012 20:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <bug-gnu-emacs <at> gnu.org>
Subject: 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))
       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






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12084; Package emacs. (Sun, 29 Jul 2012 20:43:01 GMT) Full text and rfc822 format available.

Message #8 received at 12084 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <12084 <at> debbugs.gnu.org>
Subject: RE: bug#12084: 24.1; default value for defcustom :type `choice'
Date: Sun, 29 Jul 2012 13:35:31 -0700
> (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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12084; Package emacs. (Sun, 16 Sep 2012 23:40:02 GMT) Full text and rfc822 format available.

Message #11 received at 12084 <at> debbugs.gnu.org (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <12084 <at> debbugs.gnu.org>
Subject: RE: bug#12084: 24.1; default value for defcustom :type `choice'
Date: Sun, 16 Sep 2012 16:38:00 -0700
ping





Severity set to 'wishlist' from 'minor' Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 30 Oct 2019 23:43:01 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 226 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.