Function: comint-osc-process-output

comint-osc-process-output is a byte-compiled function defined in comint.el.gz.

Signature

(comint-osc-process-output _)

Documentation

Interpret OSC escape sequences in comint output.

This function is intended to be added to comint-output-filter-functions in order to interpret escape sequences of the forms

    ESC ] command ; text BEL
    ESC ] command ; text ESC \

Specifically, every occurrence of such escape sequences is removed from the buffer. Then, if command is a key of the ansi-osc-handlers alist, the corresponding value, which should be a function, is called with command and text as arguments, with point where the escape sequence was located.

Probably introduced at or before Emacs version 28.1.

Source Code

;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-osc-process-output (_)
  "Interpret OSC escape sequences in comint output.
This function is intended to be added to
`comint-output-filter-functions' in order to interpret escape
sequences of the forms

    ESC ] command ; text BEL
    ESC ] command ; text ESC \\

Specifically, every occurrence of such escape sequences is
removed from the buffer.  Then, if `command' is a key of the
`ansi-osc-handlers' alist, the corresponding value, which
should be a function, is called with `command' and `text' as
arguments, with point where the escape sequence was located."
  (let ((start (1- comint-last-output-start))
        ;; Start one char before last output to catch a possibly stray ESC
        (bound (process-mark (get-buffer-process (current-buffer)))))
    (ansi-osc-apply-on-region start bound)))