[Top][All Lists]

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

Re: Tramp shows no user/host completions (solved while writing)

From: Stefan Monnier
Subject: Re: Tramp shows no user/host completions (solved while writing)
Date: Sun, 27 Oct 2019 17:30:19 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>>> (file-name-all-completions "ssh" "/") ;; for `partial-completion'
>>> or
>>> (file-name-all-completions "" "/") ;; for `substring' and `flex'
>>> or even no call for `initials'.
>> Would you consider that a bug?

It's clearly not the desired outcome.

Here's why this happens for example in the case of partial-completion:
when partially-completing "/ssh:f" the style would like to accept
anything of the form "/ssh<blabla>:f<blabla>" (or in glob-style:
"/ssh*:f*", which incidentally partial-complete also accepts as input).

Since the underlying completion functions only work for prefix
completion, the way this is implemented is to get all the prefix
completions of "/ssh" and then filter those that match "/ssh*:f*".

Now for Tramp, it's virtually impossible to really list all the possible
completions of "/ssh" such that the subsequent filtering works as
intended.  We could try and handle a few "typical" cases, but for
example "/ssh:otheruser@otherhos" will be difficult because we'd have to
make the prefix completion of "/ssh" return all the possible
"/ssh:<someuser>@<somehost>" for that (remember: Tramp's completion code
isn't told that "otheruser@otherhos" has already been typed in).

Another approach would be to try and handle "/ssh:f" more like "/ssh/f":
i.e. first ask the backend to find the completions for "/ssh*:" and then
with each of the results ask the backend again to find the subsequent
completions (i.e. prefix completions for "/ssh:f", "/sshx:f", ...).
This is definitely possible by modifying completion-file-name-table,
more specifically the `boundaries` part of it, to make it aware of
Tramp's syntax (or ideally, to add hooks that let Tramp explain it to
the generic code).


reply via email to

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