Function: ansi-osc-hyperlink-handler

ansi-osc-hyperlink-handler is a byte-compiled function defined in ansi-osc.el.gz.

Signature

(ansi-osc-hyperlink-handler _ TEXT)

Documentation

Create a hyperlink from an OSC 8 escape sequence.

This function is intended to be included as an element of the list that is the value of ansi-osc-handlers.

Aliases

comint-osc-hyperlink-handler (obsolete since 30.1)

Source Code

;; Defined in /usr/src/emacs/lisp/ansi-osc.el.gz
(defun ansi-osc-hyperlink-handler (_ text)
  "Create a hyperlink from an OSC 8 escape sequence.
This function is intended to be included as an element of the list
that is the value of `ansi-osc-handlers'."
  (when ansi-osc-hyperlink--state
    (let ((start (car ansi-osc-hyperlink--state))
          (url (cdr ansi-osc-hyperlink--state)))
      (make-text-button start (point)
                        'type 'ansi-osc-hyperlink
                        'browse-url-data url)))
  (setq ansi-osc-hyperlink--state
        (and (string-match ";\\(.+\\)" text)
             (cons (point-marker) (match-string-no-properties 1 text)))))