Function: make-button

make-button is a byte-compiled function defined in button.el.gz.

Signature

(make-button BEG END &rest PROPERTIES)

Documentation

Make a button from BEG to END in the current buffer.

The remaining PROPERTIES arguments form a plist of PROPERTY VALUE pairs, specifying properties to add to the button. In addition, the keyword argument :type may be used to specify a button-type from which to inherit other properties; see define-button-type.

Also see make-text-button, insert-button.

View in manual

Probably introduced at or before Emacs version 27.1.

Source Code

;; Defined in /usr/src/emacs/lisp/button.el.gz
;;; Creating overlay buttons

(defun make-button (beg end &rest properties)
  "Make a button from BEG to END in the current buffer.
The remaining PROPERTIES arguments form a plist of PROPERTY VALUE
pairs, specifying properties to add to the button.
In addition, the keyword argument :type may be used to specify a
`button-type' from which to inherit other properties; see
`define-button-type'.

Also see `make-text-button', `insert-button'."
  (let ((overlay (make-overlay beg end nil t nil)))
    (while properties
      (button-put overlay (pop properties) (pop properties)))
    ;; Put a pointer to the button in the overlay, so it's easy to get
    ;; when we don't actually have a reference to the overlay.
    (overlay-put overlay 'button overlay)
    ;; If the user didn't specify a type, use the default.
    (unless (overlay-get overlay 'category)
      (overlay-put overlay 'category 'default-button))
    ;; OVERLAY is the button, so return it.
    overlay))