Buttons are associated with a region of text, using an overlay or
text properties to hold button-specific information, all of which are
initialized from the button’s type (which defaults to the built-in
button). Like all Emacs text, the appearance of
the button is governed by the
face property; by default (via
face property inherited from the
this is a simple underline, like a typical web-page link.
For convenience, there are two sorts of button-creation functions,
those that add button properties to an existing region of a buffer,
make-...button, and those that also insert the button
The button-creation functions all take the
properties, which should be a sequence of property value
pairs, specifying properties to add to the button; see Button Properties. In addition, the keyword argument
:type may be
used to specify a button-type from which to inherit other properties;
see Button Types. Any properties not explicitly specified
during creation will be inherited from the button’s type (if the type
defines such a property).
The following functions add a button using an overlay (see Overlays) to hold the button properties:
This makes a button from beg to end in the current buffer, and returns it.
This inserts a button with the label label at point, and returns it.
The following functions are similar, but using text properties (see Text Properties) to hold the button properties. Such buttons do not add markers to the buffer, so editing in the buffer does not slow down if there is an extremely large numbers of buttons. However, if there is an existing face text property on the text (e.g., a face assigned by Font Lock mode), the button face may not be visible. Both of these functions return the starting position of the new button.
This makes a button from beg to end in the current buffer, using text properties.
This inserts a button with the label label at point, using text properties.
Sometimes it’s more convenient to make a string into a button without
inserting it into a buffer immediately, for instance when creating
data structures that may then, later, be inserted into a buffer. This
function makes string into such a string, and callback
will be called when the user clicks on the button. The optional
data parameter will be used as the parameter when callback
is called. If
nil, the button is used as the parameter instead.