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

From: Eli Barzilay <[email-masked]>
Date: Tue, 29 May 2018 12:03:53 -0400

On Tue, May 29, 2018 at 7:19 AM Michael Albinus <[email-masked]>
wrote:

> I have added the following in the Tramp manual, section "5.16 Remote
> shell setup hints":

> --8<---------------cut here---------------start------------->8---

> ‘tramp-terminal-type’

>       TRAMP uses the user option ‘tramp-terminal-type’ to set the
>       [...]

Thanks!  However, I think that it would be better to mention that it is
fine to use a different value -- instead of discouraging them.

>       Another possibility is to check the environment variable
>       ‘INSIDE_EMACS’.  [...]

This doesn't help for the common case of ssh.  (In fact, this was what I
originally though about using, but configuring ssh/sshd to pass
INSIDE_EMACS is a PITA to manage.)  I'm not saying that it shouldn't be
mentioned, just that it's not too helpful...

> > ----
> >
> > Using it, a much better solution is to (setq tramp-terminal-type
> > "tramp"), and in my .zshrc:
> >
> >     [[ $TERM == "tramp" ]] && unsetopt zle && PS1='$ ' && return

> Since I'm not an zsh user, I'm dependent on recommendations. So I have
> taken over your example, except still using "dumb" as default.

Thanks -- you can verify this with the wiki page too at:

     https://www.emacswiki.org/emacs/TrampMode

where I added the "tramp" solution.

> > 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.

> This setting is not used only for interactive shells, but also for the
> background processes. "dumb" has the advantage to own an entry in
> terminfo: [...]

> This makes it much better suited to run background shells, than a TERM
> set to "tramp", or alike.

But this is exactly the problem: "dumb" is used in many contexts,
including in `M-x shell`.  This means that if I follow what you're
recommending, I end up with a crippled `M-x shell` experience since I
lose my useful prompt there.  OTOH, I can't imagine that anything that
tramp uses would rely on terminfo, which is why I suggested the above.

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