Subject: bug#31605: 25.3; tramp-terminal-type too obscure

From: Eli Barzilay <[email-masked]>
Date: Sat, 26 May 2018 18:14:49 -0400

This is mostly a documentation issue for tramp's info file.  The
problem is that `tramp-terminal-type` is described almost as an
afterthought in a section that talks about `tset` of all things...

It would be good to describe it better, and also mention it in the
section about zsh, since it's probably a very common problem there
with sophisticated prompts.

----

The thing is that the usual recommendation (included in the info too)
is:

    [ $TERM = "dumb" ] && unsetopt zle && PS1='$ '

For *years* I have not used tramp because I couldn't find a way to
make things work.  I ran into the zsh problem and coudln't find a
simple way that makes things just work: the above suffers from
affecting *all* dumb terminals, including running a shell inside of
Emacs too -- and while I don't use a right-prompt in Emacs, I don't
want to give up my useful prompt in the environment I most frequently
run my shells in!  It finally dawned on me that instead of doing the
above, I can hack tramp: find whatever function runs the command and
advice it somehow to see a different TERM setting -- but as I was
looking into doing that, I was surprised to find that
`tramp-terminal-type` already exists!  Using it, a much better
solution is to (setq tramp-terminal-type "tramp"), and in my .zshrc:

    [[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && return

(Side note: since it's in zsh, it's better to use [[...]], and also
the wiki suggestion adding a `return` is useful since `.zshrc` is
intended for interactive configuration.)

In fact, I'd argue that the *default* value is better set as "tramp".
"dumb" is very overuse to provide some kind of interactivity that
tramp doesn't need anyway, so having a terminfo-unknown name like
"tramp" could only improve things for tramp uses.  But that will
likely break too many existing configurations (like ones that do the
above recommended zsh hack...), so maybe recommend it instead.

-- 
                   ((x=>x(x))(x=>x(x)))                  Eli Barzilay:
                   http://barzilay.org/                  Maze is Life!