unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* custom on special option
@ 2004-01-26 22:01 Miguel Frasson
  2004-01-31 20:19 ` Kai Grossjohann
  0 siblings, 1 reply; 3+ messages in thread
From: Miguel Frasson @ 2004-01-26 22:01 UTC (permalink / raw)



Hello.

I want to defcustom an option that is a list that may contain only some
specific symbols (say red, yellow, green), one symbol can appear only
once, or any sexp that does not match any specific symbols. For example,
nil and (red (blablabla) yellow) are valid values, but (green green)
shouldn't be, but I will not care. 

Actually the values different from the specific symbols are meant
to appear rarely and I don't want to spend too much energy with them, for
example I will not care if user actually inserts in the sexp another of
the specific symbols.

I would like in the customization of the option, the user could see INS
and DEL buttons to add/remove elements, and in each element, the "Value
menu" should show only those specific elements that are not already in the
previous/following itens (because the variable allows only 1 or 0 of each
symbol), and "Other" to insert the sexp. Not that I don't mean the symbols
that appear in the SET variable, but that symbols selected meanwhile it is
set.

Example:

The variable is nil (for example). Then I INS, and in the "Value menu" I
see "red, yellow, green, other". I select "green". Then I INS another
element, and I see in the value menu "red, yellow, other". Etc. 
 
Is there a way to custom such option?

[]'s

Miguel.

-- 
Miguel Vinicius Santini Frasson
http://www.math.leidenuniv.nl/~frasson

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

* Re: custom on special option
  2004-01-26 22:01 custom on special option Miguel Frasson
@ 2004-01-31 20:19 ` Kai Grossjohann
  2004-02-20 13:00   ` Per Abrahamsen
  0 siblings, 1 reply; 3+ messages in thread
From: Kai Grossjohann @ 2004-01-31 20:19 UTC (permalink / raw)


Miguel Frasson <frasson@brutus.math.leidenuniv.nl> writes:

> The variable is nil (for example). Then I INS, and in the "Value menu" I
> see "red, yellow, green, other". I select "green". Then I INS another
> element, and I see in the value menu "red, yellow, other". Etc. 

It's easier to make a set, so that you see

[ ] red
[ ] green
[ ] yellow

with some checkboxes.  Not sure, though, how the custom value thing
comes in.

Kai

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

* Re: custom on special option
  2004-01-31 20:19 ` Kai Grossjohann
@ 2004-02-20 13:00   ` Per Abrahamsen
  0 siblings, 0 replies; 3+ messages in thread
From: Per Abrahamsen @ 2004-02-20 13:00 UTC (permalink / raw)


Kai Grossjohann <kai@emptydomain.de> writes:

> Miguel Frasson <frasson@brutus.math.leidenuniv.nl> writes:
>
>> The variable is nil (for example). Then I INS, and in the "Value menu" I
>> see "red, yellow, green, other". I select "green". Then I INS another
>> element, and I see in the value menu "red, yellow, other". Etc. 
>
> It's easier to make a set, so that you see
>
> [ ] red
> [ ] green
> [ ] yellow
>
> with some checkboxes.  Not sure, though, how the custom value thing
> comes in.

(defcustom foo '(red 2 blue)
  "The elements of foo that should be recognized."
  :type '(list (set :inline t 
                    :greedy t
                    (const red) (const blue) (const yellow))
               (repeat :inline t sexp)))

Note that this only works if the order of the elements in the list is
of no importance.

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

end of thread, other threads:[~2004-02-20 13:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-26 22:01 custom on special option Miguel Frasson
2004-01-31 20:19 ` Kai Grossjohann
2004-02-20 13:00   ` Per Abrahamsen

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).