emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC] Explicity-remote commands in Eshell


From: Jim Porter
Subject: [RFC] Explicity-remote commands in Eshell
Date: Sun, 5 Mar 2023 18:35:43 -0800

One of the nice features of Eshell is that since it's aware of Tramp, connecting to a different machine (or changing users on a machine) is just a matter of cd'ing into a remote directory:

  cd /ssh:user@somewhere:~/some/dir

In addition, Eshell routes data in pipelines through buffers. In principle, this means it should be easy to build cross-host pipelines in Eshell, where the output of a command on host A is piped into the input of a command on host B. However, it's not easy to spell this in Eshell; the best I can come up with is to use a subshell like this:

  {cd /ssh:user@somewhere: && remote-command} | local-command

Instead, I think we could make this easier:

  /ssh:user@somewhere:remote-command | local-command

What do people think of the above syntax? It's a little bit different from the usual Tramp syntax, since the local part shouldn't be expanded using 'expand-file-name'; it's an executable somewhere on the remote $PATH. I can't think of any problems with supporting this syntax in Eshell[1], but I'm interested to hear others' thoughts.

Attached is a patch demonstrating this. The only non-Eshell change I had to make was to enhance 'file-remote-p' so that I can tell Tramp not to call 'expand-file-name'.

As a footnote: you might wonder how to execute a program on your local host when the current Eshell directory is remote. In my patch, I chose to do this via quoted file names:

  /:local-command

[1] Tramp shouldn't need to know about this syntax in other places. It can just be something Eshell understands.

Attachment: 0001-Add-support-for-explicitly-remote-commands-in-Eshell.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]