From: Jim Porter <jporterbugs@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 57635@debbugs.gnu.org
Subject: bug#57635: 29.0.50; Look into using generator.el's CPS machinery to replace 'eshell-do-eval'
Date: Sun, 11 Sep 2022 18:01:04 -0700 [thread overview]
Message-ID: <302b247c-2269-78ca-07e2-ad6c6f93fe1d@gmail.com> (raw)
In-Reply-To: <jwv8rmvnym0.fsf-monnier+emacs@gnu.org>
On 9/7/2022 5:45 AM, Stefan Monnier via Bug reports for GNU Emacs, the
Swiss army knife of text editors wrote:
> Indeed, the idea would be to replace the commands that launch processes
> with "yields" to an external loop (that just launches the next process
> and then calls the generator again).
That part should be fairly straightforward; there's already
'eshell-eval-command' and friends ('eshell-resume-command',
'eshell-resume-eval', and 'eshell-do-eval'), which work pretty much like
this already. Looking through this, I see a few main differences between
how Eshell does things and how generator.el does things:
----------------------------------------
1) Eshell uses (throw 'eshell-defer) to yield
This is probably easy to fix, since it's only used in a couple places,
and it looks like it's purely an implementation detail.
2) Eshell doesn't have anything like 'iter-defun'
Eshell just evaluates a Lisp form directly (you can see this by tracing
'eshell-eval-command' and then running some external process in Eshell).
I'm not sure how hard it would be to get generator.el to be ok with this.
3) Eshell allows replacing a form by throwing 'eshell-replace-command'
This is the trickiest part (to me, anyway). It's typically used by
Eshell built-in commands when they want to give up and run an external
process, though it can be used for a bunch of other things. I'm not sure
what the best way to handle this via generator.el would be. Is there any
straightforward way to do this?
----------------------------------------
If anyone has ideas, I'm all ears. This is pretty far down into the
weeds of Lisp metaprogramming, so I'm just making some educated guesses
here. I think doing this would be a big improvement for Eshell though,
since I've already bumped up against a few cases that really look like
they're just bugs in 'eshell-do-eval'. Moving to generator.el would
hopefully fix those and make Eshell easier to maintain/improve.
next prev parent reply other threads:[~2022-09-12 1:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-07 3:58 bug#57635: 29.0.50; Look into using generator.el's CPS machinery to replace 'eshell-do-eval' Jim Porter
2022-09-07 12:45 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-12 1:01 ` Jim Porter [this message]
2022-12-16 1:10 ` 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=302b247c-2269-78ca-07e2-ad6c6f93fe1d@gmail.com \
--to=jporterbugs@gmail.com \
--cc=57635@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/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).