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

From: Stefan Kangas <[email-masked]>
Date: Fri, 22 Oct 2021 20:03:04 -0700

Hi Michael,

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

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.
>
> While I'm happy with C-x C-f for opening dired buffers, also on remote
> hosts, having `ido-read-directory-name' complete known hosts would make
> this function more useful for other purposes.  For example, I have the
> following function:
>
> (defun named-shell (name directory)
>   "Open a named shell. NAME is the base name of the shell buffer,
> and DIRECTORY is the directory to open the shell in."
>   (interactive "MName: \nDDirectory: ")
>   (switch-to-buffer (concat "*" name "*"))
>   (cd directory)
>   (shell (current-buffer)))
>
> I introduced it primarily to be able to quickly open inferior remote
> shells.  However, when I'm queried for the directory to open the shell
> in, I still have to type in the host name in full.
>
>
> In GNU Emacs 24.0.94.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.20.1)
>  of 2012-02-28 on pandora
> Windowing system distributor `The X.Org Foundation', version 11.0.10707000