Skip to content

Generic Sexp Widget

The sexp widget can contain any Lisp expression, and allows the user to edit it inline in the buffer.

The syntax for the sexp widget is:

bash
type ::= (sexp [keyword argument]...  [ value ])

Widget: sexp

This widget represents an editable field that’s useful to edit any valid s-expression.

The sexp widget takes the same keyword arguments as the editable-field widget. See The editable-field Widget.

Its default value is nil.

Widget: restricted-sexp

A widget to edit Lisp expressions restricted to certain values or types. Its super is the sexp widget.

It works just like the sexp widget, but it overrides the :match function to match for certain values. To use this widget, either you must define a :match function or give a :match-alternatives property. The :match-alternatives property holds a list of predicate functions to call when checking if a given value matches the widget. Each predicate function will be called with one argument, the value to be matched, and should return non-nil on success.

As an example, the integer widget overrides :match-alternatives to (integerp).