unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Jim Porter <jporterbugs@gmail.com>, emacs-devel@gnu.org
Subject: Re: Eshell's external pipe module interferes with other argument parsing hooks
Date: Thu, 31 Mar 2022 14:56:56 -0700	[thread overview]
Message-ID: <877d89iy53.fsf@melete.silentflame.com> (raw)
In-Reply-To: <fb254634-3ef6-99d8-c072-ad884f99ebe8@gmail.com>

[switching debbugs -> emacs-devel for this subthread]

Hello,

On Thu 31 Mar 2022 at 01:58PM -07, Jim Porter wrote:

> Another possibility would be to keep the current behavior (or close to
> it), but to reconstruct the command to pass to `sh' during Eshell's
> rewrite phase. I'm not quite sure if that would actually work, but if it
> did, it would allow other argument parsers to run normally without
> extpipe needing to know what parsers to try. Perhaps if we kept around
> the substring that each argument parser consumed, it would be possible
> to reconstruct the relevant bits for extpipe's purposes?

Well, in your case (2), you don't want the other parsers to get a chance
to run -- that's the whole point.

> More generally though, maybe there are really two different use cases?
>
> 1) Eshell's built-in pipelines are slow because they go through Emacs
> buffers.
>
> 2) It would be convenient to invoke a whole command (or some large part
> of a command) using `sh' syntax.

These are both things that extpipe is meant to make easy, though I'm not
sure how separate they are -- often I want both.

> For (1), Eshell could opportunistically use external pipelines without
> any special syntax. It should be possible to tell just by looking at the
> parsed command form if "foo | bar" connects two external processes on
> the same host, and then perform the appropriate rewrite to connect the
> processes efficiently (e.g. using `sh -c'). This would happen after
> expansion of variables/subcommands, so to the user it would work just
> like any other Eshell command, but it would be faster.

This could just be added to Eshell right now, right?  Definitely useful.

> For (2), we'd need a convenient syntax for forwarding some command
> string to `sh'. Something like your proposed !! or || syntax, or maybe
> something to wrap around part of a command?

Yeah, extpipe's syntax covers most such cases but not quite all of them.

> (Or maybe an even something like an interactive `eshell-externalize'
> function that replaces the selected region with the correct `sh'
> invocation?)

I had something like this previously.  The problem is it makes editing
and re-running the command a fair bit more fiddly.

> And finally, sorry for bringing up these issues months after
> bug#46351.  At the time, I didn't really understand the internals of
> Eshell, so I didn't have anything of substance to say then. Since then
> I've delved a bit *too* deep into Eshell's internals while trying to
> prove to myself that my implementation of Lisp function pipelines is
> sufficiently-flexible. :)

No problem, but could I request that you spend a little more time
editing your messages for length?  And perhaps consider separating out
discussion of significant future possible enhancements from fixing bugs
with the existing code into separate bugs or ML threads, as I've done
with this message.  Thanks in advance :)

-- 
Sean Whitton



       reply	other threads:[~2022-03-31 21:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <70677cd2-f741-16d1-b38f-c39b507cc95e@gmail.com>
     [not found] ` <871qyij7vx.fsf@melete.silentflame.com>
     [not found]   ` <fb254634-3ef6-99d8-c072-ad884f99ebe8@gmail.com>
2022-03-31 21:56     ` Sean Whitton [this message]
2022-03-31 23:11       ` Eshell's external pipe module interferes with other argument parsing hooks Jim Porter
2022-04-16 21:04         ` Sean Whitton
2022-05-23  4:34         ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877d89iy53.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=emacs-devel@gnu.org \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).