Function: browse-url-add-buttons

browse-url-add-buttons is a byte-compiled function defined in browse-url.el.gz.

Signature

(browse-url-add-buttons)

Documentation

Add clickable buttons to the text following point in the current buffer.

Everything that matches browse-url-button-regexp will be made clickable and will use browse-url to open the URLs in question.

Probably introduced at or before Emacs version 27.1.

Source Code

;; Defined in /usr/src/emacs/lisp/net/browse-url.el.gz
(defun browse-url-add-buttons ()
  "Add clickable buttons to the text following point in the current buffer.
Everything that matches `browse-url-button-regexp' will be made
clickable and will use `browse-url' to open the URLs in question."
  (let ((inhibit-read-only t))
    (save-excursion
      (while (re-search-forward browse-url-button-regexp nil t)
        (add-text-properties (match-beginning 0)
                             (match-end 0)
                             `(help-echo "Open the URL under point"
                                         keymap ,browse-url-button-map
                                         face browse-url-button
                                         button t
                                         category browse-url
                                         browse-url-data ,(match-string 0)))))))