emacs -Q M-x ansi-term /bin/bash cd /tmp printf '%4090s' x On my system this gives the error message: error in process filter: No such directory found via CDPATH environment variable I think the following is happening: - Bash will after each command send ?\032 and the current directory "/tmp" to inform term.el. - Bash output is buffered in 4096 bytes chunks. The end of the first chunk will be "/tm" - term.el interprets "/tm" as the current directory and tries to cd there. Since /tm does not exist it signals an error. I don't know if this buffer size of 4096 varies from system to system. In that case maybe the above recipe will not trigger the error on all systems. The following term.el patch is an attempt to fix this: --- original/term.el 2013-01-03 20:33:13.862726000 +0100 +++ elisp/term.el 2013-01-03 20:35:02.374726000 +0100 @@ -2895,11 +2895,11 @@ (beep t)) ((and (eq char ?\032) (not handled-ansi-message)) - (let ((end (string-match "\r?$" str i))) + (let ((end (string-match "\r?\n" str i))) (if end (funcall term-command-hook (prog1 (substring str (1+ i) end) - (setq i (match-end 0)))) + (setq i (1- (match-end 0))))) (setq term-terminal-parameter (substring str i)) (setq term-terminal-state 4) (setq i str-length)))) I guess that all 032 escape sequences ends with a newline and that this is what the regex wants to detect. But the current regex "\r?$" will match all strings. And therefore the mechanism for saving the first part of the command until the second part arrives will never run. Regards, /Johan