I am using some complicated combination of Cygwin (for emacs) and Docker (for Linux environment) for C++ development on my laptop.

Recently I noticed that Docker dumps lots of ANSI and XTERM sequences into my *Compilation* buffer. Using redirection solved the problem:

docker run .... 2>&1 | cat

This tells me that somewhere between the latest Cygwin, Emacs and Docker the Docker now thinks it's running in a proper interactive terminal. I'd rather the Docker behaved as if it's redirecting to a file and not do things like clear screen and colorize the output.

So the question is: Is there any way to run the compilation command in Emacs without allocating a TTY?

P.S. I considered the ANSI filter on compilation output as described here. It does not quite work, as the Docker uses cursor positioning and other XTerm escape sequences that ANSI library in Emacs does not understand, plus it inserts newlines to clear screen and limit lines to 80 characters.

  • 1
    Hmm, process-connection-type maybe?
    – rpluim
    Feb 6, 2020 at 7:56

1 Answer 1


After a kind hint from @rpluim, I wrote this in my .emacs :

(defun plain-pipe-for-process () (setq-local process-connection-type nil))
(add-hook 'compilation-mode-hook 'plain-pipe-for-process)

It does exactly what I need. Docker is no longer spamming me with ANSI codes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.