I'm using multi-term right now in GUI cocoa emacs on OSX, and it works great in general. However, I'm running into a bit of an issue with my TERM variable. I generally set it to xterm-256color for iterm, but that causes odd behavior with terminal apps like htop in emacs multi-term. However, htop and other terminal apps work perfectly in multi-term when TERM is set to eterm-color.

As a result, I'm wondering if there is any way for me to have xterm-256color as the default coded in my .bash_profile, but have emacs automatically run TERM=eterm-color or a similar command when starting a new multi-term?

2 Answers 2


Terminals run inside of emacs set an environment variable, INSIDE_EMACS, so you can test that inside of your .bash_profile or .bashrc to set the TERM to something else.

(BTW on my system, multi-term seems to be setting TERM to eterm-color automatically…)

  • hmm, interesting. I did read that multi-term automatically sets TERM to eterm-color but it isn't working for me. I'll use the INSIDE_EMACS variable instead, thanks!
    – user12502
    Jun 28, 2016 at 5:04

Expanding on @amitp's answer above, here's what I did in my .zshenv file to set my $EDITOR env variable:

if [[ -v INSIDE_EMACS ]]; then
    export EDITOR="emacsclient"
    # Regular shell
    export EDITOR="emacsclient -t"

Your Answer

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