* bug#31605: 25.3; tramp-terminal-type too obscure @ 2018-05-26 22:14 Eli Barzilay 2018-05-29 11:19 ` Michael Albinus 0 siblings, 1 reply; 9+ messages in thread From: Eli Barzilay @ 2018-05-26 22:14 UTC (permalink / raw) To: 31605 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! ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-26 22:14 bug#31605: 25.3; tramp-terminal-type too obscure Eli Barzilay @ 2018-05-29 11:19 ` Michael Albinus 2018-05-29 16:03 ` Eli Barzilay 0 siblings, 1 reply; 9+ messages in thread From: Michael Albinus @ 2018-05-29 11:19 UTC (permalink / raw) To: Eli Barzilay; +Cc: 31605 Eli Barzilay <eli@barzilay.org> writes: Hi Eli, > 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. 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 remote environment variable ‘TERM’ for the shells it runs. Per default, it is ‘"dumb"’, but this could be changed. A dumb terminal is best suited to run the background sessions of TRAMP. However, running interactive remote shells might require a different setting. This could be achieved by tweaking the ‘TERM’ environment variable in ‘process-environment’. (let ((process-environment (cons "TERM=xterm-256color" process-environment))) (shell)) Determining a TRAMP session Sometimes, it is needed to identify whether a shell runs under TRAMP control. The setting of environment variable ‘TERM’ will help: if test "$TERM" = "dumb"; then ... fi Another possibility is to check the environment variable ‘INSIDE_EMACS’. Like for all subprocesses of Emacs, this is set to the version of the parent Emacs process, *Note (emacs)Interactive Shell::. TRAMP adds its own package version to this string, which could be used for further tests in an inferior shell. The string of that environment variable loooks always like echo $INSIDE_EMACS ⇒ 26.2,tramp:2.3.4 --8<---------------cut here---------------end--------------->8--- > ---- > > 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. > 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: --8<---------------cut here---------------start------------->8--- $ infocmp dumb # Reconstructed via infocmp from file: /lib/terminfo/d/dumb dumb|80-column dumb tty, am, cols#80, bel=^G, cr=\r, cud1=\n, ind=\n, --8<---------------cut here---------------end--------------->8--- This makes it much better suited to run background shells, than a TERM set to "tramp", or alike. Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-29 11:19 ` Michael Albinus @ 2018-05-29 16:03 ` Eli Barzilay 2018-05-29 16:26 ` Michael Albinus 0 siblings, 1 reply; 9+ messages in thread From: Eli Barzilay @ 2018-05-29 16:03 UTC (permalink / raw) To: michael.albinus; +Cc: 31605 On Tue, May 29, 2018 at 7:19 AM Michael Albinus <michael.albinus@gmx.de> 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! ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-29 16:03 ` Eli Barzilay @ 2018-05-29 16:26 ` Michael Albinus 2018-05-29 16:39 ` Eli Barzilay 0 siblings, 1 reply; 9+ messages in thread From: Michael Albinus @ 2018-05-29 16:26 UTC (permalink / raw) To: Eli Barzilay; +Cc: 31605 Eli Barzilay <eli@barzilay.org> writes: Hi Eli, > Thanks! However, I think that it would be better to mention that it is > fine to use a different value -- instead of discouraging them. It might work, yes. But I wouldn't recommend it. For most of the Tramp users, the default settings are OK. >> 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... ??? It is Tramp, which sets this variable in the remote shell environment. There's nothing to do for you. Or do I miss something? > 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. The majority of Tramp users does not apply "M-x shell" and friends. They are just using Tramp for remote file handling. And Tramp has always problems with whatever esacape seuences are around, that I call it an advantage when a dumb TERM simplifies my life. Speaking as maintainer. It is still possible that you reconfigure everything, and thanks again that you have told me that it needs better documentation. But I'm not conviced it will be better to change the defaults. Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-29 16:26 ` Michael Albinus @ 2018-05-29 16:39 ` Eli Barzilay 2018-05-29 17:46 ` Michael Albinus 0 siblings, 1 reply; 9+ messages in thread From: Eli Barzilay @ 2018-05-29 16:39 UTC (permalink / raw) To: michael.albinus; +Cc: 31605 On Tue, May 29, 2018 at 12:26 PM Michael Albinus <michael.albinus@gmx.de> wrote: > >> 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... > ??? It is Tramp, which sets this variable in the remote shell > environment. There's nothing to do for you. Or do I miss something? I was talking about using it to reconfigure a plain prompt: if tramp sets the environment variable, it probably does so after it established a connection, which is blocked with a "misbehaved" zsh prompt... > > 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. > The majority of Tramp users does not apply "M-x shell" and > friends. They are just using Tramp for remote file handling. I'm not talking about a remote shell, just the general running of a subshell inside Emacs. If *that* is not a popular thing to do then I'm apparently living in a bubble... Or maybe I'm weird in that I have the same shell configuration synced across all of the machines I'm using so my remote shell setup is the same as the local one. > And Tramp has always problems with whatever esacape seuences are > around, that I call it an advantage when a dumb TERM simplifies my > life. Speaking as maintainer. > It is still possible that you reconfigure everything, and thanks again > that you have told me that it needs better documentation. But I'm not > conviced it will be better to change the defaults. Oh, I *don't* suggest changing the default! (See the comment in the original bug: doing that will break existing shell configurations that detect "dumb".) I just think that it should be mentioned at least in the section that talks about the common zsh-hanging problem -- something like the small addition I did to the wiki page. -- ((x=>x(x))(x=>x(x))) Eli Barzilay: http://barzilay.org/ Maze is Life! ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-29 16:39 ` Eli Barzilay @ 2018-05-29 17:46 ` Michael Albinus 2018-05-29 17:57 ` Eli Barzilay 0 siblings, 1 reply; 9+ messages in thread From: Michael Albinus @ 2018-05-29 17:46 UTC (permalink / raw) To: Eli Barzilay; +Cc: 31605 Eli Barzilay <eli@barzilay.org> writes: Hi Eli, >> The majority of Tramp users does not apply "M-x shell" and >> friends. They are just using Tramp for remote file handling. > > I'm not talking about a remote shell, just the general running of a > subshell inside Emacs. If *that* is not a popular thing to do then I'm > apparently living in a bubble... No, you aren't. There are many Tramp users running a remote shell in Emacs. But this is not the majority of Tramp users ... >> It is still possible that you reconfigure everything, and thanks again >> that you have told me that it needs better documentation. But I'm not >> conviced it will be better to change the defaults. > > Oh, I *don't* suggest changing the default! (See the comment in the > original bug: doing that will break existing shell configurations that > detect "dumb".) I just think that it should be mentioned at least in > the section that talks about the common zsh-hanging problem -- something > like the small addition I did to the wiki page. I do not want to write an example which does not use the default. People tend to copy example lines, and I want to encourage them using the default. As compromise, I have rephrased the manual: --8<---------------cut here---------------start------------->8--- When using zsh on remote hosts, disable zsh line editor because zsh uses left-hand side and right-hand side prompts in parallel. Add the following line to ‘~/.zshrc’: [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return This uses the default value of ‘tramp-terminal-type’, ‘"dumb"’, as value of the ‘TERM’ environment variable. If you want to use another value for ‘TERM’, change ‘tramp-terminal-type’ accordingly. --8<---------------cut here---------------end--------------->8--- Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-29 17:46 ` Michael Albinus @ 2018-05-29 17:57 ` Eli Barzilay 2018-05-30 7:02 ` Michael Albinus 0 siblings, 1 reply; 9+ messages in thread From: Eli Barzilay @ 2018-05-29 17:57 UTC (permalink / raw) To: michael.albinus; +Cc: 31605 On Tue, May 29, 2018 at 1:46 PM Michael Albinus <michael.albinus@gmx.de> wrote: > Hi Eli, > > I'm not talking about a remote shell, just the general running of a > > subshell inside Emacs. If *that* is not a popular thing to do then > > I'm apparently living in a bubble... > No, you aren't. There are many Tramp users running a remote shell in > Emacs. But this is not the majority of Tramp users ... :) (It's a bit more: in my case it affects local shells also because I sync the same environment setup on all machines...) > I do not want to write an example which does not use the > default. People tend to copy example lines, [...] That's a good point. > As compromise, I have rephrased the manual: > --8<---------------cut here---------------start------------->8--- > When using zsh on remote hosts, disable zsh line editor > because zsh uses left-hand side and right-hand side prompts > in parallel. Add the following line to ‘~/.zshrc’: > [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return > This uses the default value of ‘tramp-terminal-type’, > ‘"dumb"’, as value of the ‘TERM’ environment variable. If > you want to use another value for ‘TERM’, change > ‘tramp-terminal-type’ accordingly. > --8<---------------cut here---------------end--------------->8--- Thanks! Minor tweak: If you want to use another value for ‘TERM’, change ‘tramp-terminal-type’ and this line accordingly. ^^^^^^^^^^^^^ Also, maybe a parenthetical comment along the lines of (This can be useful to keep your usual prompt in, e.g., `M-x shell'.) ? But just mentioning it is the main thing, so whatever you think is best. -- ((x=>x(x))(x=>x(x))) Eli Barzilay: http://barzilay.org/ Maze is Life! ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-29 17:57 ` Eli Barzilay @ 2018-05-30 7:02 ` Michael Albinus 2018-05-30 7:10 ` Eli Barzilay 0 siblings, 1 reply; 9+ messages in thread From: Michael Albinus @ 2018-05-30 7:02 UTC (permalink / raw) To: Eli Barzilay; +Cc: 31605-done Version: 26.2 Eli Barzilay <eli@barzilay.org> writes: Hi Eli, > Thanks! Minor tweak: > > If you want to use another value for ‘TERM’, change > ‘tramp-terminal-type’ and this line accordingly. > ^^^^^^^^^^^^^ Thanks, I've updated it. Closing the bug. Best regards, Michael. ^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#31605: 25.3; tramp-terminal-type too obscure 2018-05-30 7:02 ` Michael Albinus @ 2018-05-30 7:10 ` Eli Barzilay 0 siblings, 0 replies; 9+ messages in thread From: Eli Barzilay @ 2018-05-30 7:10 UTC (permalink / raw) To: michael.albinus; +Cc: 31605-done Thanks! On Wed, May 30, 2018 at 3:02 AM Michael Albinus <michael.albinus@gmx.de> wrote: > Version: 26.2 > Eli Barzilay <eli@barzilay.org> writes: > Hi Eli, > > Thanks! Minor tweak: > > > > If you want to use another value for ‘TERM’, change > > ‘tramp-terminal-type’ and this line accordingly. > > ^^^^^^^^^^^^^ > Thanks, I've updated it. Closing the bug. > Best regards, Michael. -- ((x=>x(x))(x=>x(x))) Eli Barzilay: http://barzilay.org/ Maze is Life! ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2018-05-30 7:10 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-05-26 22:14 bug#31605: 25.3; tramp-terminal-type too obscure Eli Barzilay 2018-05-29 11:19 ` Michael Albinus 2018-05-29 16:03 ` Eli Barzilay 2018-05-29 16:26 ` Michael Albinus 2018-05-29 16:39 ` Eli Barzilay 2018-05-29 17:46 ` Michael Albinus 2018-05-29 17:57 ` Eli Barzilay 2018-05-30 7:02 ` Michael Albinus 2018-05-30 7:10 ` Eli Barzilay
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.