In an attempt to go around an annoying aspect of tmux, I have the following code in my .bashrc file:
alias emcs="command emacs"
# Fix emacs in tmux
emacs () {
if [ $TERM != "xterm" ]
then
TERM=xterm emacs "$@"
else
emacs "$@"
fi
return;
}
The alias is simply for easier access to the original emacs command.
The function is supposed to replace emacs . . .
with TERM-xterm emacs . . .
, regardless of the arguments listed afterward.
My problem is that when I run emacs
, it hangs on the command line. If I change the function to "emaacs" or anything other than "emacs" then it works flawlessly. Why is it hanging when I'm using the actual name of the command, and what can I do to make it work?
(If you are wondering why I am doing this, it's because tmux changes the terminal to screen, which for some reason changes the emacs colors where comments and variable names are the same color.)
command emacs
in there.emacs() { TERM=xterm command emacs "$@"; }
oralias emacs='TERM=xterm command emacs'
-- actually aliases do not recursively call themselves, so you can get away withalias emacs='TERM=xterm emacs'