I use bash and, therefore, I have a rich .bashrc file that I share
among the few machines I work in. This rc file takes care of
identifying the machine and setting my environment accordingly.
I'm trying to figure out whether is possible in tramp or not to always
source my .bashrc file before attempting any command in the remote
machine. Is that possible at all?
I read the 'Remote shell setup hints' section in the manual, but it
does not seem to work for me. I have a .bash_profile file that sources
my .bashrc and I have no .profile in my home.
Any hints on this?
thanks,
Rodrigo
tramp 2.1.15
emacs 23.0.60
/bin:/usr/bin:/usr/sbin:/usr/local/bin
That is, all seems to be working as described in the manual. I just
need to find out why is that my PATH is ovrwritten by the content
shown above.
sorry for the noise,
Rodrigo
> ooops, I'm just realizing that my environment (.bashrc) is actually
> sourced. What happens is that PATH is set to something unexpected
> which I suppose is a tramp default somehow:
>
> /bin:/usr/bin:/usr/sbin:/usr/local/bin
>
> That is, all seems to be working as described in the manual. I just
> need to find out why is that my PATH is ovrwritten by the content
> shown above.
Please check the Tramp manual, (info "(tramp)Remote Programs")
> sorry for the noise,
> Rodrigo
Best regards, Michael.
Hi Michael,
reading the manual does not seem to help me. Looking into tramp.el the
problem (my problem) seems to be that tramp does not respect whatever
my PATH is set to during the login process (in my case
within .bash_profile).
Perhaps there is in the lisp code of tramp-get-remote-path (used by
tramp-set-remote-path to actually set the path) something that I'm not
understanding. Too much lisp there for me.
On the other hand, if in tramp-set-remote-path I replace
"PATH=%s; export PATH"
by
"PATH=${PATH}:%s; export PATH"
then things start to work the way I want it! My PATH (crafted within
my .bash_profile) is now preserved and now I can actually compile.
Is there something I missed about how to configure tramp or does tramp
simply not work the way I want it?
thanks,
Rodrigo
> Hi Michael,
Hi Rodrigo,
> reading the manual does not seem to help me. Looking into tramp.el the
> problem (my problem) seems to be that tramp does not respect whatever
> my PATH is set to during the login process (in my case
> within .bash_profile).
>
> Perhaps there is in the lisp code of tramp-get-remote-path (used by
> tramp-set-remote-path to actually set the path) something that I'm not
> understanding. Too much lisp there for me.
Tramp has the variable tramp-remote-path. You can add there your
preferred paths, like
(add-to-list 'tramp-remote-path "/my/path" 'append)
> On the other hand, if in tramp-set-remote-path I replace
>
> "PATH=%s; export PATH"
>
> by
>
> "PATH=${PATH}:%s; export PATH"
>
> then things start to work the way I want it! My PATH (crafted within
> my .bash_profile) is now preserved and now I can actually compile.
Maybe the following works (not tested):
(add-to-list 'tramp-remote-path "${PATH}")
> thanks,
> Rodrigo
Best regards, Michael.
this is not convenient because different machines have different
paths. The logic for setting up those paths (based on the machine
name) is part of my remote bash_profile. Repeating that logic in my
local emacs configuration its simply not good.
> Maybe the following works (not tested):
>
> (add-to-list 'tramp-remote-path "${PATH}")
This does not work because in tramp-get-remote-path the function delq
removes "${PATH}" from remote-path.
Rodrigo
> On Mar 3, 11:36 am, Michael Albinus <michael.albi...@gmx.de> wrote:
>> Tramp has the variable tramp-remote-path. You can add there your
>> preferred paths, like
>>
>> (add-to-list 'tramp-remote-path "/my/path" 'append)
>
> this is not convenient because different machines have different
> paths. The logic for setting up those paths (based on the machine
> name) is part of my remote bash_profile. Repeating that logic in my
> local emacs configuration its simply not good.
That's right. Tramp is not designed for that case. Maybe I shall
extend it this way ...
>> Maybe the following works (not tested):
>>
>> (add-to-list 'tramp-remote-path "${PATH}")
>
> This does not work because in tramp-get-remote-path the function delq
> removes "${PATH}" from remote-path.
I don't understand. Do you mean this line:
(setq remote-path (delq 'tramp-default-remote-path remote-path)))
This deletes the *symbol* `tramp-default-remote-path', and nothing else.
> Rodrigo
Best regards, Michael.
I mean the code after the comment ";; Remove non-existing
directories.".
In general I find a bit too intrusive from tramp to go and do
something with my PATH in the remote machine. I would like the call to
tramp-set-remote-pat in tramp-open-connection-setup-interactive-shell
to be a choice left to the user. What do you think of the attached
patch?
Rodrigo
*** tramp.el.orig 2009-03-05 09:40:40.000000000 -0500
--- tramp.el 2009-03-05 08:48:53.000000000 -0500
***************
*** 871,876 ****
--- 871,881 ----
(tramp-set-completion-function
"fcp" tramp-completion-function-alist-ssh)))
+ (defcustom tramp-override-remote-path t
+ "To guess or not to guess a 'good' remote PATH."
+ :group 'tramp
+ :type 'boolean)
+
(defconst tramp-echo-mark-marker "_echo"
"String marker to surround echoed commands.")
***************
*** 6048,6054 ****
500 0))))
;; Set remote PATH variable.
! (tramp-set-remote-path vec)
;; Search for a good shell before searching for a command which
;; checks if a file exists. This is done because Tramp wants to
use
--- 6053,6060 ----
500 0))))
;; Set remote PATH variable.
! (if (eq tramp-override-remote-path t)
! (tramp-set-remote-path vec))
;; Search for a good shell before searching for a command which
;; checks if a file exists. This is done because Tramp wants to
use
> In general I find a bit too intrusive from tramp to go and do
> something with my PATH in the remote machine. I would like the call to
> tramp-set-remote-pat in tramp-open-connection-setup-interactive-shell
> to be a choice left to the user. What do you think of the attached
> patch?
I have committed a patch in Tramp CVS with a similar intention. If you
apply
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
after loading Tramp, your $PATH settings shall be preserved.
> Rodrigo
Best regards, Michael.