tramp-devel
[Top][All Lists]
Advanced

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

Re: Custom multi-hop methods?


From: Kai Großjohann
Subject: Re: Custom multi-hop methods?
Date: Fri, 04 Oct 2002 22:49:11 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i686-pc-linux-gnu)

"Dan L. Pierson" <address@hidden> writes:

> --On Friday, October 04, 2002 10:13:38 PM +0200 Kai Großjohann
>   <address@hidden> wrote:
>
>> "Dan L. Pierson" <address@hidden> writes:
>>
>>> Is there any easy way to create a custom multi-hop method?
>>
>> Yes, that's not so difficult, given a little bit of Lisp knowledge.
>> But it's not what you want :-)
>
> Lisp knowledge I have, time to understand the rather impressive Tramp
> implementation is a bit harder to come by :-)

Impressive?  Really?  It all seemed so straight-forward...

(There is some cruft related to dealing with strangenesses in some
Unix systems.  For example, it is difficult to find a command to
check if a file exists.  But that's not complicated Lisp, it's more
complicated Unix shell usage...)

>> Right.  Filename abbreviations is a topic which seems to come up
>> regularly.  I thought that environment variables are good enough and
>> therefore I didn't build any of this into Tramp.  For instance, you
>> can do
>>
>> (setenv "xx" "/multi:ssh:address@hidden:sudo:address@hidden:")
>>
>> And then you can type
>>
>> C-x C-f $xx/path/to/file RET
>>
>> How does it sound?
>
> The problem with this is that I'll need a separate env var for each
> remote machine...  (The only substitutable parameters in my example
> were 'foo.bar' and '/path/to/file'.  Of course everyone else probably
> wants a different set.)

Ah, I misunderstood.  Hm.  One possibility is to write a regular
connection function which behaves like the multi-connection function
with specific parameters.  If you add a method which uses
dan-tramp-open-connection-sshsudo as the connection function, then
dan-tramp-open-connection-sshsudo will be called with the host name
as one argument, and you could have it call the multi-connection
function with appropriate args.

For multi-connection functions, the METHOD, USER, HOST args are
actually vectors, each element is for one hop.  So the METHOD vector
you need is always ["ssh" "sudo"], the USER vector might be (vector
user "root") {ie, use the given user name for the first hop and root
for the second hop}, the HOST vector might be (vector host host) {ie,
use the same host name twice}.

Does this make sense?  I'm not sure if I told you things that are
easy to glean from the source or whether I actually told you the
right background info that's difficult to see...

>> I've been persuaded that this is no real solution, so within the next
>> few decades (heh) you can expect an abbrev mechanism.  But until
>> then, maybe this is a workable kludge.
>
> I may have to live with multiple env vars.  I took a quick look through
> the Tramp sources before my first message and it did look like a new
> mechanism (can you say macros?) is required.  I may look again if any
> copious spare time comes up :-)

Yours is indeed the first request of this kind, I now understand.  Hm.
Of course, methods are general and thus support what you want, but the
support _is_ kind of weak.  But I have no bright idea at the moment on
what would be the right way to approach things in your case.

kai
-- 
~/.signature is: umop ap!sdn    (Frank Nobis)




reply via email to

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