Last active
August 29, 2015 14:11
-
-
Save kofno/09ae381b99ee049e7b54 to your computer and use it in GitHub Desktop.
Colorize your process buffers with a custom process filter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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