[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: defcustom - restricted list of symbols

From: Magnus Henoch
Subject: Re: defcustom - restricted list of symbols
Date: Mon, 16 Oct 2006 01:53:57 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (berkeley-unix)

"Joe Casadonte" <address@hidden> 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))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]