[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange prompt in tramp remote shell

From: Christian Millour (AB TELA)
Subject: Re: Strange prompt in tramp remote shell
Date: Wed, 03 Nov 2010 16:49:24 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv: Gecko/20101027 Thunderbird/3.1.6

Le 03/11/2010 14:34, Michael Albinus a écrit :
"Christian Millour (AB TELA)"<address@hidden>  writes:
I don't know whether this is a tramp issue or a shell(.el) issue, but I
am getting a strange prompt when running a remote shell using plink from
ntemacs on Win7 to a remote linux host. It looks like the prompt is set
to the value of tamp-end-of-output as defvar'd in tramp.el.
Yes, it is Tramp. It redefines the prompt immediately after opening a
remote shell, in order to use robust regexs for parsing. In the logic of
connecting, there is no simple way to change this.

Well, for connecting (at least in simple cases, like single-hop and no [remote] sudo) there is the option of using rlogin-mode with rlogin-program set to "plink", and this preserves the remote prompt (sort of... actually I can't find a way to turn echo off). This is compatible with tramp and I have actually been using it for quite some time before realizing it was possible to start a shell from tramp itself. By "compatible with tramp" I mean that when you are in the remote shell you can C-x C-f a remote file and this is where tramp kicks in. Directory tracking is rather more robust in rlogin-mode (absolute remote pathnames are better supported with cd/push/popd/dirs, with less need to resynchronize with M-x cd). That might be wasteful though, as I guess that you need separate ssh/plink sessions for shell and transfers, whereas with a tramp shell the session is shared ?

Old habits die hard and it would be nice (for me at least) if it were possible to get the tramp remote shell *before* opening any remote file. Because this is the way I naturally operate : remote log in, do shell stuff, maybe navigate to the directory I want, and maybe C-x C-f a file there. With tramp I need to open a file even if all I need is the remote login. This means I generally open the remote home dir in dired, and end up not using it. Oh well. I can live with this :-)
One workaround for not having to reset the prompt manually for each
session is to (setenv "ESHELL" "bash") in the .emacs and create a
.emacs_bash containing

# reset the prompt for remote tramp shells
if [ "${INSIDE_EMACS/*tramp*/tramp}" == "tramp" ]; then PS1="address@hidden \w]$

I wonder is there might be a cleaner way.
That looks like a reasonable handling of the problem. The variable
$INSIDE_EMACS is set exactly for the purpose to give the user a chance
to react on Tramp specifics. And you do.

If you do not object, I will add your recipe to Tramp's FAQ.

Please feel free to do so, but note that if you access various boxen with different shells the (setenv "ESHELL" ...) is unwieldy.

Thanks again, and best regards,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]