Previous: , Up: Sexp Types   [Contents]


6.4 Composite Sexp Widgets.

The syntax for the composite are

TYPE ::= (NAME [KEYWORD ARGUMENT]...  COMPONENT...)

Where each component must be a widget type. Each component widget will be displayed in the buffer, and be editable to the user.

Widget: cons

The value of a cons widget is a cons-cell where the car is the value of the first component and the cdr is the value of the second component. There must be exactly two components.

Widget: list

The value of a list widget is a list containing the value of each of its component.

Widget: vector

The value of a vector widget is a vector containing the value of each of its component.

The above suffice for specifying fixed size lists and vectors. To get variable length lists and vectors, you can use a choice, set or repeat widgets together with the :inline keywords. If any component of a composite widget has the :inline keyword set, its value must be a list which will then be spliced into the composite. For example, to specify a list whose first element must be a file name, and whose remaining arguments should either by the symbol t or two files, you can use the following widget specification:

(list file
      (choice (const t)
              (list :inline t
                    :value ("foo" "bar")
                    string string)))

The value of a widget of this type will either have the form ‘(file t)’ or (file string string).

This concept of inline is probably hard to understand. It was certainly hard to implement so instead of confusing you more by trying to explain it here, I’ll just suggest you meditate over it for a while.

Widget: choice

Allows you to edit a sexp which may have one of a fixed set of types. It is currently implemented with the choice-menu basic widget, and has a similar syntax.

Widget: set

Allows you to specify a type which must be a list whose elements all belong to given set. The elements of the list is not significant. This is implemented on top of the checklist basic widget, and has a similar syntax.

Widget: repeat

Allows you to specify a variable length list whose members are all of the same type. Implemented on top of the ‘editable-list’ basic widget, and has a similar syntax.


Previous: , Up: Sexp Types   [Contents]