8.2.3 Atomic Sexp Widgets

The atoms are s-expressions that do not consist of other s-expressions. For example, a string, a file name, or a symbol are atoms, while a list is a composite type. You can edit the value of an atom with the widgets described in this section.

The syntax for all the atoms is:

type ::= (construct [keyword argument]...  [ value ])

The value, if present, is used to initialize the :value property and must be an expression of the same type as the widget. That is, for example, the string widget can only be initialized with a string.

All the atom widgets take the same keyword arguments as the editable-field widget. See The editable-field Widget.

Widget: string

An editable field widget that can represent any Lisp string.

It offers completion via the ispell library and the :complete property.

Widget: regexp

An editable field widget that can represent a regular expression.

Overrides the :match and the :validate properties to check that the value is a valid regexp.

Widget: character

An editable field widget that can represent a character.

The character widget represents some characters (like the newline character) in a special manner, to make it easier for the user to see what’s the content of the character field.

Widget: file

A widget for editing file names.

Keywords:

:completions

Offers file name completion to the user.

:prompt-value

A function to read a file name from the minibuffer.

:must-match

If this is set to non-nil, only existing file names are allowed when prompting for a value in the minibuffer.

:match

The widget matches if the value is a string, and the file whose name is that string is an existing file, or if :must-match is nil.

:validate

The widget is valid if its value matches.

Widget: directory

A widget for editing directory names.

Its super is the file widget, and it overrides the :completions property, to offer completions only for directories.

Widget: symbol

A widget for editing a Lisp symbol.

Its value by default is nil.

Widget: function

A widget for editing a lambda expression, or a function name, offering completion. Its super is the restricted-sexp widget.

Widget: variable

A widget for editing variable names, offering completion. Its super is the symbol widget.

Widget: integer

A widget for editing integers in an editable field. Its super is the restricted-sexp widget.

It has a default :value of 0.

Widget: natnum

A widget for editing non-negative integers. Its super is the restricted-sexp widget.

It has a default :value of 0.

Widget: float

A widget for editing a floating point number. Its super is the restricted-sexp widget.

It has a default :value of 0.0.

Widget: number

A widget for editing a number, either floating point or integer. Its super is the restricted-sexp widget.

It has a default :value of 0.0.

Widget: boolean

A widget for editing a boolean value. Its super is the toggle widget.

Its value may be nil, meaning false, or non-nil, meaning true.

Widget: color

A widget to edit a color name.

In addition, shows a sample that shows the selected color, if any.

Widget: other

A widget useful as the last item in a choice widget, since it matches any value.

Its super is the sexp widget, and its :value is other, by default.

Widget: coding-system

A widget that can represent a coding system name, offering completions. See Coding Systems in the Emacs Lisp Reference Manual. Its super is the symbol widget.

It has a default value of undecided.

Widget: key

A widget to represent a key sequence.

It uses a special keymap as the :keymap.