unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Joe Casadonte" <jcasadonte@northbound-train.com>
Subject: defcustom - restricted list of symbols
Date: Sun, 15 Oct 2006 14:48:48 -0400	[thread overview]
Message-ID: <uslhpife7.fsf@terrapin.northbound-train.com> (raw)


I'd like to write a defcustom variable definition that:

1. is a symbol (but could be a string, if need be)
2. is one of a list of "acceptable" symbols
3. the complete list of "acceptable" symbols is not know at the time I
   write I write the defcustom itself (but is known at run-time)
4. by the nature of #3, I need to be able to add to the list of valid
   symbols
5. presented to the user as a radio button or check box would be

Here's an example:

Let's say I have a generic dictionary front-end module, and I ship
with the two dictionaries: English and German.  When the user goes to
customize the 'default-dictionary' for this module, I want them to be
able to choose between English, German and any other dictionary they
have installed.  I don't know at the time I write the front-end which
dictionaries are available (as more could be added), and I don't know
which the user will have installed.  I can, however, count on the
proper installation of a dictionary to update some other variable,
which comprises a list of installed dictionaries.

If that is somehow possible, is it then possible to make this variable
just one element in a list of values that comprise a single variable?
To continue the above (completely contrived) example, say I want to
link a given mode and a default dictionary, so that message-mode uses
German as the default, and text-mode uses English.  Normally I would
create a compound defcustom definition, using the 'list type and
choice and what-not.

Now, assuming all of that *is* possible, is there a reason not to use
it?  Care would have to be taken to ensure that the list of installed
dictionaries is known *before* `custom-set-variables' is called.  But
I think that's possible to do given the :set-after and :require
keywords.

Thanks for the help!

--
Regards,


joe
Joe Casadonte
jcasadonte@northbound-train.com

------------------------------------------------------------------------------
         Llama Fresh Farms => http://www.northbound-train.com
   Gay Media Resource List => http://www.northbound-train.com/gaymedia.html
            Perl for Win32 => http://www.northbound-train.com/perlwin32.html
               Emacs Stuff => http://www.northbound-train.com/emacs.html
          Music CD Trading => http://www.northbound-train.com/cdr.html
------------------------------------------------------------------------------
                       Live Free, that's the message!
------------------------------------------------------------------------------

             reply	other threads:[~2006-10-15 18:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-15 18:48 Joe Casadonte [this message]
2006-10-15 23:53 ` defcustom - restricted list of symbols Magnus Henoch
     [not found] ` <mailman.8194.1160956463.9609.help-gnu-emacs@gnu.org>
2006-10-17  2:11   ` Joe Casadonte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uslhpife7.fsf@terrapin.northbound-train.com \
    --to=jcasadonte@northbound-train.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).