From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: David Kastrup Newsgroups: gmane.emacs.help Subject: How to declare a recursive customization type? Date: 16 Dec 2002 13:17:37 +0100 Organization: T-Online Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1040046404 20104 80.91.224.249 (16 Dec 2002 13:46:44 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 16 Dec 2002 13:46:44 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18NvZy-0005E6-00 for ; Mon, 16 Dec 2002 14:46:43 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18NvUW-0007wJ-00 for gnu-help-gnu-emacs@m.gmane.org; Mon, 16 Dec 2002 08:41:04 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.com!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help,comp.emacs,comp.emacs.xemacs Original-Lines: 40 Original-X-Trace: news.t-online.com 1040041060 00 28718 YPX1EuZXSMAdCS 021216 12:17:40 Original-X-Complaints-To: abuse@t-online.com X-Sender: 520018396234-0001@t-dialin.net X-Face: 2FEFf>]>q>2iw=B6,xrUubRI>pR&Ml9=ao@P@i)L:\urd*t9M~y1^:+Y]'C0~{mAl`oQuAl \!3KEIp?*w`|bL5qr,H)LFO6Q=qx~iH4DN;i"; /yuIsqbLLCh/!U#X[S~(5eZ41to5f%E@'ELIi$t^ Vc\LWP@J5p^rst0+('>Er0=^1{]M9!p?&:\z]|;&=NP3AhB!B_bi^]Pfkw User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-Xref: shelby.stanford.edu gnu.emacs.help:108163 comp.emacs:76449 comp.emacs.xemacs:69127 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:4693 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:4693 Hello, I have a certain recursive data structure which I want to define as a custom type. Currently I use the following contraption (defconst preview-expandable-string ((lambda (f) (funcall f (funcall f 'sexp))) (lambda (x) `(choice string (cons :tag "List with separators" (string :tag "Separator") (choice (symbol :tag "Variable to concatenate.") (repeat :tag "Explicit elements" ,x))) (symbol :tag "Indirect variable")))) "Type to be used for `preview-string-expand'. Recursive definitions are not popular with Emacs, so we define this type just two levels deep. This kind of strings can either be just a string, or a cons cell with a separator string in the CAR, and either an explicit list of elements in the CDR, or a symbol to be consulted recursively.") which is going to be used just as :type preview-expandable-string in a defcustom. However, this sort of broken-off recursion is not satisfactory. One should probably define preview-expandable-string as a proper type to be used as :type 'preview-expandable-string in a defcuston, and then it will probably be able to refer to itself cleanly. But how does one achieve that? I digged through what I could find about both customize, widget, and wid-edit, and have again to admit that I am too stupid to find how to do what must be a simple thing, really. -- David Kastrup, Kriemhildstr. 15, 44793 Bochum