Function: ansi-color-process-output

ansi-color-process-output is an autoloaded and byte-compiled function defined in ansi-color.el.gz.

Signature

(ansi-color-process-output IGNORED)

Documentation

Maybe translate SGR control sequences of comint output into text properties.

Depending on variable ansi-color-for-comint-mode the comint output is either not processed, SGR control sequences are filtered using ansi-color-filter-region, or SGR control sequences are translated into text properties using ansi-color-apply-on-region.

The comint output is assumed to lie between the marker comint-last-output-start and the process-mark.

This is a good function to put in comint-output-filter-functions.

Source Code

;; Defined in /usr/src/emacs/lisp/ansi-color.el.gz
;;;###autoload
(defun ansi-color-process-output (_ignored)
  "Maybe translate SGR control sequences of comint output into text properties.

Depending on variable `ansi-color-for-comint-mode' the comint output is
either not processed, SGR control sequences are filtered using
`ansi-color-filter-region', or SGR control sequences are translated into
text properties using `ansi-color-apply-on-region'.

The comint output is assumed to lie between the marker
`comint-last-output-start' and the process-mark.

This is a good function to put in `comint-output-filter-functions'."
  (let ((start-marker (if (and (markerp comint-last-output-start)
			       (eq (marker-buffer comint-last-output-start)
				   (current-buffer))
			       (marker-position comint-last-output-start))
			  comint-last-output-start
			(point-min-marker)))
	(end-marker (process-mark (get-buffer-process (current-buffer)))))
    (cond ((eq ansi-color-for-comint-mode nil))
	  ((eq ansi-color-for-comint-mode 'filter)
	   (ansi-color-filter-region start-marker end-marker))
	  (t
	   (ansi-color-apply-on-region start-marker end-marker)))))