Subject: Re: bug#63359: 30.0.50; Lack of ssh hosts completion in Tramp using Fido mode

From: Michael Albinus <[email-masked]>
Date: Mon, 08 May 2023 13:08:10 +0200

Bartosz Kaczyński <[email-masked]> writes:

> Hi,

Hi Bartosz,

> I would like to report an issue with the lack of SSH hostname
> suggestions when connecting via Tramp using the Fido mode. Previously, I
> used the exact same configuration in the Icomplete mode and the
> completion worked, meaning I could do C-x C-f, start typing /ssh: <tab>,
> and it would suggest a list of hosts defined in the configuration file.
>
> I keep my connection in following structure:
>
> tree ~/.ssh/conf.d/
> .ssh/conf.d/
> ├── lab
> ├── personal
> ├── companyX
> └── companyY
>
> and following line in ~/.ssh/config:
>
> Include conf.d/*
>
> My fido-mode configuration:
>
> (use-package icomplete
>   :config
>   (fido-mode t)
>   (fido-vertical-mode t))  

I cannot say why/how it worked for you in the past. But the Tramp manual
discusses this case:

--8<---------------cut here---------------start------------->8---

4.18.1 Using ssh config include for host name completion
--------------------------------------------------------

OpenSSH configuration files can use an ‘Include’ option for further
configuration files.  Default TRAMP host name completion ignores this
option.  However, you can configure this yourself.

   Given, your ‘~/.ssh/config’ file contains the following option:

     Include ~/.ssh/conf.d/*

   The following code snippet in your ‘.emacs’ uses all files in that
directory for host name completion:

     (tramp-set-completion-function
      "ssh" (append (tramp-get-completion-function "ssh")
                    (mapcar (lambda (file) `(tramp-parse-sconfig ,file))
                            (directory-files
                             "~/.ssh/conf.d/"
                             'full directory-files-no-dot-files-regexp))))

   This code snippet does it for the ‘ssh’ method.  If you replace
"ssh" by "scp", it does it also for that method (or any other method
you like).
--8<---------------cut here---------------end--------------->8---

Have you tried this recipe?

> Thank you in advance for your help!
> bartk

Best regards, Michael.