Subject: bug#60505: 29.0.60; Fido Mode and Tramp Completion

From: Stefan Monnier <[email-masked]>
Date: Fri, 03 Feb 2023 13:43:07 -0500

> +(defun tramp-completion-handle-expand-file-name (filename &optional directory)
> +  "Like `expand-file-name' for partial Tramp files."
> +  (if (file-name-absolute-p filename)
> +      filename
> +    (concat (or directory default-directory "/") filename)))

Hmm... shouldn't a "/" may need to be added if `directory` or
`default-directory` doesn't end with one (except in cases like `/ssh:`)?

Then again, maybe not.  I don't understand enough of the details of when
`tramp-completion-file-name-handler` is used (IOW what is meant exactly by
"partial Tramp file name").

IIUC the `tramp-completion-file-name*` thingies operate only for
"partial Tramp file name" (so the "completion" part of their name is
technically a misnomer, tho they make sense in practice since this part
of the code is only really important during completion), i.e. file names
that should be handled by Tramp but that are incomplete because they end
before getting to specifying the desired directory/file at the remote
end (or even specifying the remote host's name).

I didn't remember this part of the design, but it sounds good and does
make changes to that part (like the proposed patch) "safer", so it's
probably OK to try it on `master`.

I wonder how this patch interacts with `locate-dominating-file`.

        Stefan