all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Tramp shows no user/host completions (solved while writing)
@ 2019-10-24 16:01 Tassilo Horn
  2019-10-24 16:47 ` Drew Adams
  2019-10-24 19:36 ` Michael Albinus
  0 siblings, 2 replies; 13+ messages in thread
From: Tassilo Horn @ 2019-10-24 16:01 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

with "emacs -q", C-x C-f /ssh:<tab> showed many completions for host
names but with my custom emacs setup, it just says [no matches].  I've
debugged around for an hour, started to write this mail, and then
eventually found the culprit.

It seems like you absolutely must have the `basic' completion style in
`completion-styles' or the `file' entry in
`completion-category-overrides'.  No `basic', no Tramp username/hostname
completions.

Just in case someone runs into the same issue...

Bye,
Tassilo



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

* RE: Tramp shows no user/host completions (solved while writing)
  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 19:36 ` Michael Albinus
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2019-10-24 16:47 UTC (permalink / raw)
  To: Tassilo Horn, help-gnu-emacs

> It seems like you absolutely must have the `basic' completion style in
> `completion-styles' or the `file' entry in
> `completion-category-overrides'.  No `basic', no Tramp
> username/hostname
> completions.
> 
> Just in case someone runs into the same issue...

Thanks for broadcasting this info.

Sounds like a (design?) bug.  Users shouldn't
have to know about this gotcha.

Consider filing a bug report / enhancement
request: `M-x report-emacs-bug'.



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

* Re: Tramp shows no user/host completions (solved while writing)
  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:36 ` Michael Albinus
  2019-10-24 19:45   ` Tassilo Horn
  1 sibling, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2019-10-24 19:36 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Hi all,

Hi Tassilo,

> with "emacs -q", C-x C-f /ssh:<tab> showed many completions for host
> names but with my custom emacs setup, it just says [no matches].  I've
> debugged around for an hour, started to write this mail, and then
> eventually found the culprit.
>
> It seems like you absolutely must have the `basic' completion style in
> `completion-styles' or the `file' entry in
> `completion-category-overrides'.  No `basic', no Tramp username/hostname
> completions.
>
> Just in case someone runs into the same issue...

I cannot reproduce the problem. With a recent Emacs 27.0.50, I run

- emacs -Q --eval "(setq completion-styles '(partial-completion emacs22) completion-category-overrides nil)"

- C-x C-f /ssh: TAB

It returns completion /ssh: and /sshx:

- Moving point after the colon, inserting f TAB

It returns all hostnames starting with f. You could apply another letter
but f, of course.

> Bye,
> Tassilo

Best regards, Michael.



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-24 16:47 ` Drew Adams
@ 2019-10-24 19:40   ` Michael Albinus
  2019-10-24 20:08     ` Drew Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2019-10-24 19:40 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs, Tassilo Horn

Drew Adams <drew.adams@oracle.com> writes:

Hi Drew,

>> It seems like you absolutely must have the `basic' completion style in
>> `completion-styles' or the `file' entry in
>> `completion-category-overrides'.  No `basic', no Tramp
>> username/hostname
>> completions.
>>
>> Just in case someone runs into the same issue...
>
> Thanks for broadcasting this info.
>
> Sounds like a (design?) bug.  Users shouldn't
> have to know about this gotcha.

I don't know whether this is a design bug. Setting those user options
require knowledge.

If you set, for example, completion-styles to nil, there won't be any
completion at all (given you've started "emacs -Q"). Sounds consistent.

Best regards, Michael.



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-24 19:36 ` Michael Albinus
@ 2019-10-24 19:45   ` Tassilo Horn
  2019-10-25  5:00     ` Tassilo Horn
  0 siblings, 1 reply; 13+ messages in thread
From: Tassilo Horn @ 2019-10-24 19:45 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

On October 24, 2019 9:36:17 PM Michael Albinus <michael.albinus@gmx.de> wrote:

> I cannot reproduce the problem. With a recent Emacs 27.0.50, I run
>
> - emacs -Q --eval "(setq completion-styles '(partial-completion emacs22) 
> completion-category-overrides nil)"

I'm not on my computer, but could you check with '(partial-completion 
substring initials)? I think that was my original setting.

Bye,
Tassilo





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

* RE: Tramp shows no user/host completions (solved while writing)
  2019-10-24 19:40   ` Michael Albinus
@ 2019-10-24 20:08     ` Drew Adams
  0 siblings, 0 replies; 13+ messages in thread
From: Drew Adams @ 2019-10-24 20:08 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs, Tassilo Horn

Hi Michael,

> >> It seems like you absolutely must have the `basic' completion style
> in
> >> `completion-styles' or the `file' entry in
> >> `completion-category-overrides'.  No `basic', no Tramp
> >> username/hostname
> >> completions.
> >>
> >> Just in case someone runs into the same issue...
> >
> > Thanks for broadcasting this info.
> >
> > Sounds like a (design?) bug.  Users shouldn't
> > have to know about this gotcha.
> 
> I don't know whether this is a design bug. Setting those user options
> require knowledge.
> 
> If you set, for example, completion-styles to nil, there won't be any
> completion at all (given you've started "emacs -Q"). Sounds consistent.

I meant only that IF it's true that

>> you absolutely must have the`basic' completion
>> style ... or the `file' entry in
>> `completion-category-overrides'

in order for "Tramp username/hostname completions"
to work THEN that fact should maybe be addressed
somehow: fix it if a bug; document it if by design.

But it sounds, from your other mail, like the IF
condition doesn't hold.  Sorry for the noise, in
that case.



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-24 19:45   ` Tassilo Horn
@ 2019-10-25  5:00     ` Tassilo Horn
  2019-10-25 14:38       ` Michael Albinus
  0 siblings, 1 reply; 13+ messages in thread
From: Tassilo Horn @ 2019-10-25  5:00 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

Hi Michael,

>> I cannot reproduce the problem. With a recent Emacs 27.0.50, I run
>>
>> - emacs -Q --eval "(setq completion-styles '(partial-completion emacs22)
>> completion-category-overrides nil)"
>
> I'm not on my computer, but could you check with '(partial-completion
> substring initials)? I think that was my original setting.

Now I've had the time to test.  With

  emacs -Q --eval "(setq completion-styles '(partial-completion substring initials flex) completion-category-overrides nil)"

I also don't get user/hostname completion.  So my statement must be
corrected to "you must use the basic or emacs22 (or possibly emacs21)
completion style" (which are essentially the basic styles of these
respective emacs versions).

Cheers,
Tassilo



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-25  5:00     ` Tassilo Horn
@ 2019-10-25 14:38       ` Michael Albinus
  2019-10-26 21:51         ` Tassilo Horn
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2019-10-25 14:38 UTC (permalink / raw)
  To: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

> Hi Michael,

Hi Tassilo,

> Now I've had the time to test.  With
>
>   emacs -Q --eval "(setq completion-styles '(partial-completion
> substring initials flex) completion-category-overrides nil)"
>
> I also don't get user/hostname completion.  So my statement must be
> corrected to "you must use the basic or emacs22 (or possibly emacs21)
> completion style" (which are essentially the basic styles of these
> respective emacs versions).

Indeed. When I complete "/ssh:f TAB" with one of `emacs21', `emacs22' or
`basic' in `completion-styles', I see the call

(file-name-all-completions "ssh:f" "/")

which performs host name completion in Tramp. For the other completion
styles, there is just

(file-name-all-completions "ssh" "/") ;; for `partial-completion'

or

(file-name-all-completions "" "/") ;; for `substring' and `flex'

or even no call for `initials'. So I have added the following sentence
to the Tramp manual:

--8<---------------cut here---------------start------------->8---
User name and host name completion is activated only, if file name
completion has one of the styles ‘basic’, ‘emacs21’, or ‘emacs22’.
*Note (emacs)Completion Styles::.
--8<---------------cut here---------------end--------------->8---

> Cheers,
> Tassilo

Best regards, Michael.



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-25 14:38       ` Michael Albinus
@ 2019-10-26 21:51         ` Tassilo Horn
  2019-10-27  8:01           ` Michael Albinus
  0 siblings, 1 reply; 13+ messages in thread
From: Tassilo Horn @ 2019-10-26 21:51 UTC (permalink / raw)
  To: Michael Albinus; +Cc: help-gnu-emacs

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

> Indeed. When I complete "/ssh:f TAB" with one of `emacs21', `emacs22'
> or `basic' in `completion-styles', I see the call
>
> (file-name-all-completions "ssh:f" "/")
>
> which performs host name completion in Tramp. For the other completion
> styles, there is just
>
> (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?

At least from a user perspective, it seems odd that more powerful
completion styles restrict the completion candidates, though I do
understand the technical details that lead to the observed results.

> So I have added the following sentence to the Tramp manual:
>
> User name and host name completion is activated only, if file name
> completion has one of the styles ‘basic’, ‘emacs21’, or ‘emacs22’.
> *Note (emacs)Completion Styles::.

Good.  (But it would be better if it wasn't needed.)

Bye,
Tassilo



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-26 21:51         ` Tassilo Horn
@ 2019-10-27  8:01           ` Michael Albinus
  2019-10-27 21:30             ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Albinus @ 2019-10-27  8:01 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: help-gnu-emacs

Tassilo Horn <tsdh@gnu.org> writes:

Hi Tassilo,

>> Indeed. When I complete "/ssh:f TAB" with one of `emacs21', `emacs22'
>> or `basic' in `completion-styles', I see the call
>>
>> (file-name-all-completions "ssh:f" "/")
>>
>> which performs host name completion in Tramp. For the other completion
>> styles, there is just
>>
>> (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?

I'm not sure. But I'm not an expert in completion styles.

> At least from a user perspective, it seems odd that more powerful
> completion styles restrict the completion candidates, though I do
> understand the technical details that lead to the observed results.

I don't understand every completion style as complete. More
sophisticated ones, like `flex', *add* completion options. That's why
they are best combined with something like `basic'.

That's not how it is documented. If my assumption is correct, the
documentation shall be adapted. Otherwise, it might be a bug, indeed.

But again, this is out of my knowledge.

> Bye,
> Tassilo

Best regards, Michael.



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-27  8:01           ` Michael Albinus
@ 2019-10-27 21:30             ` Stefan Monnier
  2019-10-28  6:57               ` Tassilo Horn
  2019-10-28  7:44               ` Michael Albinus
  0 siblings, 2 replies; 13+ messages in thread
From: Stefan Monnier @ 2019-10-27 21:30 UTC (permalink / raw)
  To: help-gnu-emacs

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




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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-27 21:30             ` Stefan Monnier
@ 2019-10-28  6:57               ` Tassilo Horn
  2019-10-28  7:44               ` Michael Albinus
  1 sibling, 0 replies; 13+ messages in thread
From: Tassilo Horn @ 2019-10-28  6:57 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

> It's clearly not the desired outcome.
>
> [...]

Thanks for the very detailled explanation.  I've reported bug#37954 for
this problem and linked your message from there.

Bye,
Tassilo



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

* Re: Tramp shows no user/host completions (solved while writing)
  2019-10-27 21:30             ` Stefan Monnier
  2019-10-28  6:57               ` Tassilo Horn
@ 2019-10-28  7:44               ` Michael Albinus
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Albinus @ 2019-10-28  7:44 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> (or ideally, to add hooks that let Tramp explain it to the generic
> code).

I'm open to all proposals. Such hooks shouldn't be Tramp specific,
there's for example url-handler-mode.

>         Stefan

Best regards, Michael.



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

end of thread, other threads:[~2019-10-28  7:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2019-10-28  6:57               ` Tassilo Horn
2019-10-28  7:44               ` Michael Albinus

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.