all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <David.Kastrup@t-online.de>
Subject: How to declare a recursive customization type?
Date: 16 Dec 2002 13:17:37 +0100	[thread overview]
Message-ID: <x5n0n6taxq.fsf@lola.goethe.zz> (raw)


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

             reply	other threads:[~2002-12-16 12:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-16 12:17 David Kastrup [this message]
2002-12-17 11:23 ` How to declare a recursive customization type? Per Abrahamsen

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=x5n0n6taxq.fsf@lola.goethe.zz \
    --to=david.kastrup@t-online.de \
    /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.