Function: ansi-osc-filter-region
ansi-osc-filter-region is a byte-compiled function defined in
ansi-osc.el.gz.
Signature
(ansi-osc-filter-region BEGIN END)
Documentation
Filter out all OSC control sequences from region between BEGIN and END.
When an unfinished escape sequence is found, the start position is saved
to ansi-osc--marker. Later call will override BEGIN with the position
pointed by ansi-osc--marker.
Source Code
;; Defined in /usr/src/emacs/lisp/ansi-osc.el.gz
(defun ansi-osc-filter-region (begin end)
"Filter out all OSC control sequences from region between BEGIN and END.
When an unfinished escape sequence is found, the start position is saved
to `ansi-osc--marker'. Later call will override BEGIN with the position
pointed by `ansi-osc--marker'."
(let ((end-marker (copy-marker end)))
(save-excursion
(goto-char (or ansi-osc--marker begin))
(when (eq (char-before) ?\e) (backward-char))
(while (re-search-forward "\e]" end-marker t)
(let ((pos0 (match-beginning 0)))
(if (re-search-forward
"\\=[\x08-\x0D]*[\x20-\x7E]*\\(\a\\|\e\\\\\\)"
end-marker t)
(delete-region pos0 (point))
(setq ansi-osc--marker (copy-marker pos0))))))))