Function: buttonize

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

Signature

(buttonize STRING CALLBACK &optional DATA HELP-ECHO)

Documentation

Make STRING into a button and return it.

When clicked, CALLBACK will be called with the DATA as the function argument. If DATA isn't present (or is nil), the button itself will be used instead as the function argument.

If HELP-ECHO, use that as the help-echo property.

Also see buttonize-region.

View in manual

Probably introduced at or before Emacs version 29.1.

Aliases

button-buttonize (obsolete since 29.1)

Source Code

;; Defined in /usr/src/emacs/lisp/button.el.gz
(defun buttonize (string callback &optional data help-echo)
  "Make STRING into a button and return it.
When clicked, CALLBACK will be called with the DATA as the
function argument.  If DATA isn't present (or is nil), the button
itself will be used instead as the function argument.

If HELP-ECHO, use that as the `help-echo' property.

Also see `buttonize-region'."
  (let ((string
         (apply #'propertize string
                (button--properties callback data help-echo))))
    ;; Add the face to the end so that it can be overridden.
    (add-face-text-property 0 (length string) 'button t string)
    string))