all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to declare a recursive customization type?
@ 2002-12-16 12:17 David Kastrup
  2002-12-17 11:23 ` Per Abrahamsen
  0 siblings, 1 reply; 2+ messages in thread
From: David Kastrup @ 2002-12-16 12:17 UTC (permalink / 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to declare a recursive customization type?
  2002-12-16 12:17 How to declare a recursive customization type? David Kastrup
@ 2002-12-17 11:23 ` Per Abrahamsen
  0 siblings, 0 replies; 2+ messages in thread
From: Per Abrahamsen @ 2002-12-17 11:23 UTC (permalink / raw)


David Kastrup <David.Kastrup@t-online.de> writes:

> But how does one achieve that?  

Basically, it is as hard as writing a new primitive widget, which is
hard indeed.

I really ought to write some helper widget for recursive datatypes.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-17 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-16 12:17 How to declare a recursive customization type? David Kastrup
2002-12-17 11:23 ` Per Abrahamsen

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.