Subject: Re: bug#5334: 23.1.91; Term mode prints "0; user@host:~" before each prompt of an interactive SSH session

From: Scott Bell <[email-masked]>
Date: Fri, 08 Jan 2010 12:25:17 -0700

On 2010-01-08, at 12:13 PM, Dan Nicolaescu wrote:

> Scott Bell <[email-masked]> writes:
> 
>> On 2010-01-07, at 2:37 PM, Dan Nicolaescu wrote:
>> 
>>> Scott Bell <[email-masked]> writes:
>>> 
>>>> Under GNU Emacs 23.1.91.1 (x86_64-apple-darwin10.2.0, 
>>>> NS apple-appkit-1038.25), Mac OS X 10.6.2, Term mode
>>>> prints the following prompt during an interactive SSH
>>>> session ('ssh host'):
>>>> 
>>>> 0;user@host:~(host:~)$ 
>>>> 
>>>> when PS1 is set to '(\h:\W)\$ ' on the remote host. 
>>>> 
>>>> The string '0;user@host:~' is not displayed when using
>>>> another terminal emulator.	
>>> 
>>> You probably set  PROMPT_COMMAND to something that term.el does not
>>> understand.
>> 
>> That's correct. It looks like PROMPT_COMMAND on the 
>> remote machine is trying to set the title string.
> 
> Does the PROMPT_COMMAND setting come from your .bashrc?
> If yes, then:
> 1. never use it it's overkill, set PS1 to do the same thing instead.
> 2. when setting it, you need to set it conditionally, only when TERM==xterm

It comes from the system bash initialization, I've now 
added PROMPT_COMMAND='' in my .bashrc on the remote 
machine.

>> Should term.el support this escape sequence? If not,
>> should it recognize it but take no action (and also
>> not print undesired output)? This seems like a fairly
>> common feature, but I could be wrong.
> 
> That sequence should only be used for xterm.
> It's been reported that this used to work in term.el in emacs-23.1, no
> idea why it does not work now. I don't have any plans to figure out why
> it does not work anymore, or to do anything about it.

That's certainly fine by me.