From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Magnus Henoch Newsgroups: gmane.emacs.help Subject: Re: defcustom - restricted list of symbols Date: Mon, 16 Oct 2006 01:53:57 +0200 Message-ID: <87r6x9b0fe.fsf@freemail.hu> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1160956480 5848 80.91.229.2 (15 Oct 2006 23:54:40 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 15 Oct 2006 23:54:40 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 16 01:54:38 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GZFoT-0003PX-7J for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Oct 2006 01:54:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GZFoS-0005v9-En for geh-help-gnu-emacs@m.gmane.org; Sun, 15 Oct 2006 19:54:36 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GZFoD-0005oW-Q0 for help-gnu-emacs@gnu.org; Sun, 15 Oct 2006 19:54:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GZFoB-0005hf-L7 for help-gnu-emacs@gnu.org; Sun, 15 Oct 2006 19:54:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GZFoB-0005hQ-GY for help-gnu-emacs@gnu.org; Sun, 15 Oct 2006 19:54:19 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GZFxA-0007Vz-5N for help-gnu-emacs@gnu.org; Sun, 15 Oct 2006 20:03:37 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GZFnx-0003Nc-UN for help-gnu-emacs@gnu.org; Mon, 16 Oct 2006 01:54:07 +0200 Original-Received: from etthundrat.olf.sgsnet.se ([193.11.222.85]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Oct 2006 01:54:05 +0200 Original-Received: from mange by etthundrat.olf.sgsnet.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 16 Oct 2006 01:54:05 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-To: help-gnu-emacs@gnu.org Original-Lines: 25 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: etthundrat.olf.sgsnet.se Mail-Copies-To: never Jabber-Id: legoscia@jabber.cd.chalmers.se User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (berkeley-unix) Cancel-Lock: sha1:kg2RCGznZ6vHeYfNUDHkKO4gEcg= X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:38058 Archived-At: "Joe Casadonte" 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