unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* [TRAMP] Setting remote prompt
@ 2018-04-24  7:58 Loris Bennett
  2018-04-24  8:14 ` Michael Albinus
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Loris Bennett @ 2018-04-24  7:58 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

When logged in on a remote machine I have the following prompt:

  [09:15:09] loris@pi (1000) ~
  $ echo $PS1
  \[\033]2;\u@\h\a\]\[\e[35m\][\t] \[\e[31m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$

When I access a file on the remote machine via TRAMP and then do 'M-x
shell', I get:

  ^[]2;loris@pi^G[09:42:03] loris@pi (30) ~
  $ echo $PS1
  \[\033]2;\u@\h\a\]\[\e[35m\][\t] \[\e[31m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$

where ^[ and ^G are the non-printable characters  and \a respectively.

I see that here:

  https://www.gnu.org/software/tramp/#Remote-shell-setup

the way to reset the prompt via ~/.emacs_SHELLNAME is described.

However, I was wondering if there is just a simple way to prevent TRAMP
from adding a default prompt to the front of the existing prompt (if,
indeed, that is what is happening).

Does anyone one have any advice?

Cheers,

Loris

-- 
This signature is currently under construction.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
  2018-04-24  7:58 [TRAMP] Setting remote prompt Loris Bennett
@ 2018-04-24  8:14 ` Michael Albinus
  2018-04-24  8:15 ` Loris Bennett
       [not found] ` <mailman.12922.1524557662.27995.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 8+ messages in thread
From: Michael Albinus @ 2018-04-24  8:14 UTC (permalink / raw)
  To: Loris Bennett; +Cc: help-gnu-emacs

"Loris Bennett" <loris.bennett@fu-berlin.de> writes:

> Hi,

Hi Loris,

> However, I was wondering if there is just a simple way to prevent TRAMP
> from adding a default prompt to the front of the existing prompt (if,
> indeed, that is what is happening).
>
> Does anyone one have any advice?

I'm not aware that Tramp sets this prompt as you have shown. Maybe you
run your test with tramp-verbose being 6, and check Tramp's debug
buffer. Tramp sets PS1, but not the way it happens to you.

> Cheers,
>
> Loris

Best regards, Michael.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
  2018-04-24  7:58 [TRAMP] Setting remote prompt Loris Bennett
  2018-04-24  8:14 ` Michael Albinus
@ 2018-04-24  8:15 ` Loris Bennett
  2018-04-24  8:56   ` Yuri Khan
       [not found]   ` <mailman.12925.1524560224.27995.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.12922.1524557662.27995.help-gnu-emacs@gnu.org>
  2 siblings, 2 replies; 8+ messages in thread
From: Loris Bennett @ 2018-04-24  8:15 UTC (permalink / raw)
  To: help-gnu-emacs

"Loris Bennett" <loris.bennett@fu-berlin.de> writes:

> Hi,
>
> When logged in on a remote machine I have the following prompt:
>
>   [09:15:09] loris@pi (1000) ~
>   $ echo $PS1
>   \[\033]2;\u@\h\a\]\[\e[35m\][\t] \[\e[31m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$
>
> When I access a file on the remote machine via TRAMP and then do 'M-x
> shell', I get:
>
>   ^[]2;loris@pi^G[09:42:03] loris@pi (30) ~
>   $ echo $PS1
>   \[\033]2;\u@\h\a\]\[\e[35m\][\t] \[\e[31m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$
>
> where ^[ and ^G are the non-printable characters  and \a respectively.
>
> I see that here:
>
>   https://www.gnu.org/software/tramp/#Remote-shell-setup
>
> the way to reset the prompt via ~/.emacs_SHELLNAME is described.
>
> However, I was wondering if there is just a simple way to prevent TRAMP
> from adding a default prompt to the front of the existing prompt (if,
> indeed, that is what is happening).
>
> Does anyone one have any advice?

Looking again I see that PS1 isn't changed, so the difference is
probably due to the way the prompt is interpreted by the terminal.

First I need to work out what the first instance of '\u@\h' is there
for, as it's been a few years since I set it up.

-- 
This signature is currently under construction.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
  2018-04-24  8:15 ` Loris Bennett
@ 2018-04-24  8:56   ` Yuri Khan
       [not found]   ` <mailman.12925.1524560224.27995.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Yuri Khan @ 2018-04-24  8:56 UTC (permalink / raw)
  To: Loris Bennett; +Cc: help-gnu-emacs

On Tue, Apr 24, 2018 at 3:15 PM, Loris Bennett
<loris.bennett@fu-berlin.de> wrote:
> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>   $ echo $PS1
>>   \[\033]2;\u@\h\a\]\[\e[35m\][\t] \[\e[31m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$
>
> First I need to work out what the first instance of '\u@\h' is there
> for, as it's been a few years since I set it up.

OSC 2;\u@\h BEL

In xterm and its derivatives, this sets your window title to the
current user@host.



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
       [not found] ` <mailman.12922.1524557662.27995.help-gnu-emacs@gnu.org>
@ 2018-04-24  9:29   ` Loris Bennett
  2018-04-24 10:35     ` Ben Bacarisse
  0 siblings, 1 reply; 8+ messages in thread
From: Loris Bennett @ 2018-04-24  9:29 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Michael,

Michael Albinus <michael.albinus@gmx.de> writes:

> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>
>> Hi,
>
> Hi Loris,
>
>> However, I was wondering if there is just a simple way to prevent TRAMP
>> from adding a default prompt to the front of the existing prompt (if,
>> indeed, that is what is happening).
>>
>> Does anyone one have any advice?
>
> I'm not aware that Tramp sets this prompt as you have shown. Maybe you
> run your test with tramp-verbose being 6, and check Tramp's debug
> buffer. Tramp sets PS1, but not the way it happens to you.

Yes, you are right.  The problem is that I have PROMPT_COMMAND set to a
function that exports PS1.  I had fixed the problem but not propagated
the solution to all other machines.  The correct prompt looks like this:

  \[\e[35m\][\t] \[\e[32m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$

The extraneous symbols were coming from the following fragment

  \[\033]2;\u@\h\a\]

which seems to be some sort of attempt to use the text attribute "dim"
(2;), which is ignored or not displayed for most of my terminals, but
produces

  ^[]2;loris@pi^G

when the shell is run with Emacs.

Sorry for the noise.

Cheers,

Loris

-- 
This signature is currently under construction.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
       [not found]   ` <mailman.12925.1524560224.27995.help-gnu-emacs@gnu.org>
@ 2018-04-24  9:50     ` Loris Bennett
  0 siblings, 0 replies; 8+ messages in thread
From: Loris Bennett @ 2018-04-24  9:50 UTC (permalink / raw)
  To: help-gnu-emacs

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Tue, Apr 24, 2018 at 3:15 PM, Loris Bennett
> <loris.bennett@fu-berlin.de> wrote:
>> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
>>>   $ echo $PS1
>>>   \[\033]2;\u@\h\a\]\[\e[35m\][\t] \[\e[31m\]\u@\h \[\e[36m\](\!) \[\e[33m\]\w\[\e[34m\]\[\033[0m\]\n$
>>
>> First I need to work out what the first instance of '\u@\h' is there
>> for, as it's been a few years since I set it up.
>
> OSC 2;\u@\h BEL
>
> In xterm and its derivatives, this sets your window title to the
> current user@host.

Yes, you are right.  So it wasn't the text that was dim, it was me :-)

So I guess I should be adding that bit conditionally depending on the
type of terminal. 

Cheers,

Loris

-- 
This signature is currently under construction.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
  2018-04-24  9:29   ` Loris Bennett
@ 2018-04-24 10:35     ` Ben Bacarisse
  2018-04-24 10:35       ` Ben Bacarisse
  0 siblings, 1 reply; 8+ messages in thread
From: Ben Bacarisse @ 2018-04-24 10:35 UTC (permalink / raw)
  To: help-gnu-emacs

"Loris Bennett" <loris.bennett@fu-berlin.de> writes:
<snip>
> The extraneous symbols were coming from the following fragment
>
>   \[\033]2;\u@\h\a\]
>
> which seems to be some sort of attempt to use the text attribute "dim"
> (2;), which is ignored or not displayed for most of my terminals, but
> produces

No.  Leaving the enclosing []s aside, the sequence is

  ESC ] 2; <string> BEL

with \033 being ESC and \a being BEL.  This sequence is used to set the
window title.

-- 
Ben.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [TRAMP] Setting remote prompt
  2018-04-24 10:35     ` Ben Bacarisse
@ 2018-04-24 10:35       ` Ben Bacarisse
  0 siblings, 0 replies; 8+ messages in thread
From: Ben Bacarisse @ 2018-04-24 10:35 UTC (permalink / raw)
  To: help-gnu-emacs

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:

> "Loris Bennett" <loris.bennett@fu-berlin.de> writes:
> <snip>
>> The extraneous symbols were coming from the following fragment
>>
>>   \[\033]2;\u@\h\a\]
>>
>> which seems to be some sort of attempt to use the text attribute "dim"
>> (2;), which is ignored or not displayed for most of my terminals, but
>> produces
>
> No.  Leaving the enclosing []s aside, the sequence is
>
>   ESC ] 2; <string> BEL
>
> with \033 being ESC and \a being BEL.  This sequence is used to set the
> window title.

Sorry, I see you corrected this.  Should have finished the thread before
replying!

-- 
Ben.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-24 10:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-24  7:58 [TRAMP] Setting remote prompt Loris Bennett
2018-04-24  8:14 ` Michael Albinus
2018-04-24  8:15 ` Loris Bennett
2018-04-24  8:56   ` Yuri Khan
     [not found]   ` <mailman.12925.1524560224.27995.help-gnu-emacs@gnu.org>
2018-04-24  9:50     ` Loris Bennett
     [not found] ` <mailman.12922.1524557662.27995.help-gnu-emacs@gnu.org>
2018-04-24  9:29   ` Loris Bennett
2018-04-24 10:35     ` Ben Bacarisse
2018-04-24 10:35       ` Ben Bacarisse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).