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

From: Bartosz Kaczyński <[email-masked]>
Date: Tue, 09 May 2023 04:00:48 +0000

Michael Albinus <[email-masked]> writes:

> Hi Bartosz,
Hi Michael,

thank you for your reply!

>
> I cannot say why/how it worked for you in the past. But the Tramp manual
> discusses this case:
>
>
> 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).
>
> Have you tried this recipe?
>

Yes, I have. Here is my TRAMP configuration:

(use-package tramp
  :config
    ---snip---
  (with-eval-after-load 'tramp
    (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))))
    (tramp-set-completion-function
     "scp" (append (tramp-get-completion-function "scp")
                   (mapcar (lambda (file) `(tramp-parse-sconfig ,file))
                           (directory-files
                            "~/.ssh/conf.d/"
                            'full directory-files-no-dot-files-regexp)))))
    ---snip---
)

And I confirm this solution works for Icomplete but for some reasons it
doesn't work for Fido.

Regards, bartk