Subject: bug#65356: 30.0.50; [wishlist] Support Tramp method, user name and host name completion in eshell

From: Michael Albinus <[email-masked]>
Date: Fri, 18 Aug 2023 08:45:26 +0200

Jim Porter <[email-masked]> writes:

Hi Jim,

> X-Debbugs-Cc: [email-masked]

Well, this works only if you *submit* a new bug. If you *reply*, just
use Cc. I've added Stefan in this reply.

>> In eshell, this feature does not exist. I would like if I could type
>> "cd /ss TAB" and could see the same offering of "ssh:", "sshfs:" and
>> "sshx:". Same for user name and host name.
>>
>> The appended patch does this for me. I have no idea how good it fits
>> into the eshell machinery, for example whether there are problems with
>> the em-elecslash.el module. Comments welcome!
>
> Thanks. This would be a useful feature indeed. I have a couple of main
> concerns, which I'm not quite sure what to do about at the moment:
>
> 1) Should this go in the Eshell Tramp extension module? Currently,
> that module is there to add built-in versions of su/sudo/doas, as an
> alternative to the "standard" Eshell way of connecting to a remote
> host: "cd /ssh:user@host:~". Therefore, I think we'd want
> tab-completion of Tramp file names even (or especially!) when the
> Tramp extension module is disabled (which is the default).

I have no preference where it shall be in eshell. I've used em-tramp.el
during my work, because it is the least invasive place: it requires
already Tramp. You might have seen, that the new function uses two Tramp
variables.

> 2) I'm not sure 'pcomplete-try-first-hook' is the right way to enable
> this. Pcomplete has quite a few ways of performing completions, and it
> already knows when it should specifically complete file names (as
> opposed to "--options" for example). Maybe we should enhance Pcomplete
> itself so that you can opt into completion of remote file names too?
> Then when you tab-complete in Eshell, it would just work in all the
> contexts where you can normally complete a file name. I Cc'ed Stefan
> since he might have some thoughts on the Pcomplete machinery here.

When I've started to implement this, I was a n00b wrt pcomplete. Well,
I'm still a n00b, all what I have done is stealing code from somewhere
else, shamelessly.

It would be great if this completion function applies only to possible
*Lisp* file names. Roughly said, to arguments of commands not being
external, and not in a pipe. If this could be arranged I'd appreciate
it. So I count on you and Stefan :-)

Best regards, Michael.