unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* tramp (2.0.51); tramp and file-name-all-completions
@ 2005-10-15 21:42 Kim F. Storm
  2005-10-16 17:36 ` Richard M. Stallman
  0 siblings, 1 reply; 4+ messages in thread
From: Kim F. Storm @ 2005-10-15 21:42 UTC (permalink / raw)
  Cc: emacs-devel


I'm trying to make ido work sensibly with tramp syntax -- but
getting a grip on file-name-all-completions is really a nightmare.

Ido uses file-name-all-completions to get a list of all possible
completions of "the next component" to be entered by the user.

Now, consider these tramp file name:

     /method:user@host:/file
     /user@host:/file
     /host:/file

Ideally, ido would like to call file-name-all-completions like this:

         (file-name-all-completions "/method:" "")
         (file-name-all-completions "/method:user@" "")
         (file-name-all-completions "/method:user@host:" "")
         (file-name-all-completions "/method:user@host:/file" "")

         (file-name-all-completions "/user@" "")
         (file-name-all-completions "/user@host:" "")

         (file-name-all-completions "/host:" "")

However, this does not always work -- look at these examples:

========

(file-name-all-completions "/telnet:" "")
=> OK

========

(file-name-all-completions "/telnet:kfs@" "")
=> ERROR: "Not a tramp file name: "

The desired result can be obtained with this call
(remove leading / of first arg, add / to second arg):

(file-name-all-completions "telnet:kfs@" "/")
=> OK

========

(file-name-all-completions "/telnet:kfs@localhost:" "")
=> ERROR: "Not a tramp file name: "

The desired result can be obtained with this call
(swap the two args):

(file-name-all-completions "" "/telnet:kfs@localhost:")
=> OK

========

(file-name-all-completions "/telnet:kfs@localhost:/tmp" "")
=> ERROR: "Not a tramp file name: "

The desired result can be obtained with this call
(swap the two args):

(file-name-all-completions "" "/telnet:kfs@localhost:/tmp")
=> OK

========

Now, one would suppose that swapping the two args would work for
the first two forms above, but not so:

(file-name-all-completions "" "/telnet:")
=> ERROR: Login failed

(file-name-all-completions "/telnet:kfs@" "")
=> ERROR: Login failed



========

(file-name-all-completions "/kfs@" "")
=> OK

========

(file-name-all-completions "/kfs@localhost:" "")
=> ERROR: "Not a tramp file name: "

Swapping the args works here too:

(file-name-all-completions "" "/kfs@localhost:")
=> OK

========

(file-name-all-completions "/localhost:" "")
=> ERROR: "Not a tramp file name: "

Again swapping the args will work:

(file-name-all-completions "" "/localhost:")
=> OK

========

I have made ido adapt to all these strange rules, but it is not very
nice -- and I have to know whether /xxx: is a method or a host, since:

(file-name-all-completions "/telnet:" "")
=> OK

(file-name-all-completions "/localhost:" "")
=> FAILS

(file-name-all-completions "" "/telnet:")
=> FAILS

(file-name-all-completions "" "/localhost:")
=> OK


========

SIGH!!

Emacs  : GNU Emacs 22.0.50.54 (i686-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2005-10-14 on kfs-l.imdomain.dk
Package: tramp (2.0.51)


--
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

* Re: tramp (2.0.51); tramp and file-name-all-completions
  2005-10-15 21:42 tramp (2.0.51); tramp and file-name-all-completions Kim F. Storm
@ 2005-10-16 17:36 ` Richard M. Stallman
  2005-10-16 19:56   ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Richard M. Stallman @ 2005-10-16 17:36 UTC (permalink / raw)
  Cc: tramp-devel, emacs-devel

I would say these problems are all bugs in tramp.
file-name-all-completions has a simple spec,
and in principle it ought to work "right" for all meaningful args.

If there are some cases where it is just hopeless to ask tramp
to do completion correctly, we could decide on some return value
that means "unable to do the job right".

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

* Re: tramp (2.0.51); tramp and file-name-all-completions
  2005-10-16 17:36 ` Richard M. Stallman
@ 2005-10-16 19:56   ` Michael Albinus
  2005-10-16 21:43     ` Kim F. Storm
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2005-10-16 19:56 UTC (permalink / raw)
  Cc: tramp-devel, emacs-devel, Kim F. Storm

"Richard M. Stallman" <rms@gnu.org> writes:

> I would say these problems are all bugs in tramp.

Yes.

> file-name-all-completions has a simple spec,
> and in principle it ought to work "right" for all meaningful args.

The problem is the syntactical ambiguity of Tramp file
names. (file-name-all-completions "" "/telnet:") can mean completion
of user and host names for method "telnet", or completion of file
names for method "ssh" on host "telnet".

When I wrote completion code for Tramp 3 years ago, I've introduced a
somehow obscure heuristic determining what is meant. This works more or
less the usual cases, but it breaks ido.

I've dropped a comment in the TODO "must be changed when we know it
better". It seems to be the time now.

> If there are some cases where it is just hopeless to ask tramp
> to do completion correctly, we could decide on some return value
> that means "unable to do the job right".

I don't think so. It is not a tragedy when file-name-all-completions
does not return the most complete list. Given the example above,
something like ("telnet:127.0.0.1:" "telnet:localhost.local:") would
be sufficient, even if there is a host called "telnet". Only when
completion of the method returns nil, one might try file name
completion.

I'm sitting already the whole day on this problem.

Best regards, Michael.

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

* Re: tramp (2.0.51); tramp and file-name-all-completions
  2005-10-16 19:56   ` Michael Albinus
@ 2005-10-16 21:43     ` Kim F. Storm
  0 siblings, 0 replies; 4+ messages in thread
From: Kim F. Storm @ 2005-10-16 21:43 UTC (permalink / raw)
  Cc: tramp-devel, rms, emacs-devel

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

> When I wrote completion code for Tramp 3 years ago, I've introduced a
> somehow obscure heuristic determining what is meant. This works more or
> less the usual cases, but it breaks ido.

Please note that I have managed to work around most problems in ido
(as explained in the bug report), so fixing this is not urgent for me.

However, if you can make tramp do the right things for all cases the
cases I listed, I'd definitely prefer to remove my hacks in ido.

> I'm sitting already the whole day on this problem.

I appreciate your efforts.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

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

end of thread, other threads:[~2005-10-16 21:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-15 21:42 tramp (2.0.51); tramp and file-name-all-completions Kim F. Storm
2005-10-16 17:36 ` Richard M. Stallman
2005-10-16 19:56   ` Michael Albinus
2005-10-16 21:43     ` Kim F. Storm

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).