Function: ansi-color-filter-apply

Filter out all ANSI control sequences from STRING.

Every call to this function will set and use the buffer-local variable
`ansi-color-context' to save partial escape sequences. This information
will be used for the next call to `ansi-color-apply'. Set
`ansi-color-context' to nil if you don't want this.

This function can be added to `comint-preoutput-filter-functions'.