all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Magnus Henoch <mange@freemail.hu>
Subject: Re: defcustom - restricted list of symbols
Date: Mon, 16 Oct 2006 01:53:57 +0200	[thread overview]
Message-ID: <87r6x9b0fe.fsf@freemail.hu> (raw)
In-Reply-To: uslhpife7.fsf@terrapin.northbound-train.com

"Joe Casadonte" <jcasadonte@northbound-train.com> writes:

> 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

This seems to work:

(eval-when-compile (require 'cl))

(defcustom malekzista 'foo
  "An option with restrictions decided at runtime."
  :type '(radio (const foo)))

(defun malekzista-add-option (new-option)
  "Add new option to variable `malekzista'."
  (push (list 'const new-option) (cdr (get 'malekzista 'custom-type))))

Magnus

  reply	other threads:[~2006-10-15 23:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-15 18:48 defcustom - restricted list of symbols Joe Casadonte
2006-10-15 23:53 ` Magnus Henoch [this message]
     [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

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

  git send-email \
    --in-reply-to=87r6x9b0fe.fsf@freemail.hu \
    --to=mange@freemail.hu \
    /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.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.