diff --git a/Terminal.c b/Terminal.c index a1174bffaf4d331b2274a47bf02ac72cde9a0c2e..977482a11dcaf9ec9a59d18a7974c3c1bd7f2a45 100644 --- a/Terminal.c +++ b/Terminal.c @@ -160,6 +160,15 @@ static const char* kwsysTerminalVT100Names[] = static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100, int default_tty) { + /* If running inside emacs the terminal is not VT100. Some emacs + seem to claim the TERM is xterm even though they do not support + VT100 escapes. */ + const char* emacs = getenv("EMACS"); + if(emacs && *emacs == 't') + { + return 0; + } + /* Check for a valid terminal. */ if(!default_vt100) {