In ansi-term when using mongo console (or 'repl') control codes do not seem to behave properly.

When I move cursor it doesn't get redrawn at a expected location. Instead all entered text get appended to the input. The same goes for backspace. My input does get interpreted, however, it is not displayed correctly.


Here's result of typing 'testtest', then pressing backspace. $TERMINFO value is set to 'eterm-color'

Thanks for any suggestions!

  • Off-topic: Is that nyan cat actually part of your Emacs setup, or did you just use it to censor sensitive info? Jul 16, 2016 at 2:55
  • Do you have an eterm-color terminfo entry installed? e.g. under /usr/share/terminfo/e/ or ~/.terminfo/e/ ?
    – phils
    Jul 16, 2016 at 4:13
  • @ScottWeldon I believe it is part of emacs. I use spacemacs, and there is a color layer with that nyan cat thing. Dec 28, 2017 at 2:42

1 Answer 1


This doesn't exactly solve the issue, but I've noticed that if you run tmux inside ansi-term (or byobu in my case, which is running tmux under the covers) it fixes the issue with the mongo shell. Not sure why that is.

Just resetting the value of TERM to something else (even "screen", which is what tmux sets it to) doesn't solve the problem, but actually running mongo from inside tmux works properly.

  • You can think of screen/tmux being much more capable terminal emulators than ansi-term to the applications running inside them while both still run acceptably well inside Emacs.
    – wasamasa
    Jul 15, 2016 at 23:10

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.