Subject: Re: bug#10911: 24.0.94; `ido-read-directory-name' should offer known hosts for completion

From: Michael Albinus <[email-masked]>
Date: Wed, 27 Oct 2021 17:27:34 +0200

Stefan Kangas <[email-masked]> writes:

> Hi Michael,

Hi,

> Could you perhaps take a look at the below bug?  It seems to relate to
> completions when using Tramp.

Somehow, I did miss the bug. I don't read all bug reports, and likely
the subject line was too long in order to get my attention with the
words "known hosts". So be it just now.

> Oleksandr Manzyuk <[email-masked]> writes:
>
>> This is a feature request rather than a bug.  `ido-read-directory-name'
>> doesn't offer known hosts for completion, unlike `ido-read-file-name'.
>> Here is what I mean by that.  I'm assuming that `ido-mode' is on.
>> Please forgive me if I belabor the point.
>>
>> When I type C-x C-f // and hit TAB, I obtain an *Ido Completions* buffer
>> containing not only local directory names (bin/, boot/, dev/ etc.), but
>> also known hosts, which is very convenient in conjunction with TRAMP.  I
>> can type C-x C-f // g o RET, which expands into /golconda.cs.nuim.ie:,
>> and if I already have a remote shell running on that host, I can see a
>> list of files and directories there.  If there is no remote shell yet, I
>> can simply hit RET, and it will be opened using TRAMP.  Of course, I can
>> open a dired buffer visiting a remote directory this way, but it should
>> also be equally convenient to do that with `ido-dired'.  While it is
>> possible, it is also less convenient: I have to type C-x d //, type the
>> host name followed by colon *in full and without completion*.
>>
>> Summarizing, there is a discrepancy in how `ido-read-directory-name' and
>> `ido-read-file-name' generate completions, and I don't see why this
>> should be the case.

Well, time has passed, and Tramp has changed. Meanwhile, a method name
is mandatory.

I've tried with recent master (Emacs 29.0.50). If I call

emacs -Q -L ~/src/tramp/lisp/ -l tramp -f ido-mode

I can type "C-x d /ss TAB", and the method "ssh" is not offered. So I
continue with "h: TAB", and again, the host name is not offered.

If I read a file name, via "C-x C-f /ss TAB", it completes to "/ssh:"
(and the similar methods). Typing ": TAB" gives me host name
completion. So the situation is similar to what the OP has reported.

However, I don't know ido.el pretty good, so some body else, who knows
this beast, might continue with analysis. If there are questions from
Tramp, don't hesitate to ask.

Best regards, Michael.