Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kofno
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kofno/09ae381b99ee049e7b54 to your computer and use it in GitHub Desktop.
Save kofno/09ae381b99ee049e7b54 to your computer and use it in GitHub Desktop.
Colorize your process buffers with a custom process filter
(defun kofno/ansi-color-proc-filter (proc string)
(when (buffer-live-p (process-buffer proc))
(with-current-buffer (process-buffer proc)
(let ((moving (= (point) (process-mark proc))))
(save-excursion
;; Insert the text, advancing the process marker.
(goto-char (process-mark proc))
(insert string)
(ansi-color-apply-on-region (point-min) (point-max))
(set-marker (process-mark proc) (point)))
(if moving (goto-char (process-mark proc)))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment