all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Tramp shows no user/host completions (solved while writing)
Date: Sun, 27 Oct 2019 17:30:19 -0400	[thread overview]
Message-ID: <jwv1rux7v0e.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: 874kzuy5v3.fsf@gmx.de

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


        Stefan




  reply	other threads:[~2019-10-27 21:30 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-24 16:01 Tramp shows no user/host completions (solved while writing) Tassilo Horn
2019-10-24 16:47 ` Drew Adams
2019-10-24 19:40   ` Michael Albinus
2019-10-24 20:08     ` Drew Adams
2019-10-24 19:36 ` Michael Albinus
2019-10-24 19:45   ` Tassilo Horn
2019-10-25  5:00     ` Tassilo Horn
2019-10-25 14:38       ` Michael Albinus
2019-10-26 21:51         ` Tassilo Horn
2019-10-27  8:01           ` Michael Albinus
2019-10-27 21:30             ` Stefan Monnier [this message]
2019-10-28  6:57               ` Tassilo Horn
2019-10-28  7:44               ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv1rux7v0e.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.