Subject: bug#57635: 29.0.50; Look into using generator.el's CPS machinery to replace 'eshell-do-eval'

From: Jim Porter <[email-masked]>
Date: Thu, 15 Dec 2022 17:10:35 -0800

On 9/7/2022 5:45 AM, Stefan Monnier via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
>> In order to make long-running Eshell commands behave more-nicely, Eshell
>> uses iterative evaluation of many commands so that it can return control
>> back to the rest of Emacs. This has a lot of similarity to how
>> generator.el works.
> 
> 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).

Maybe an even better solution would be to use Emacs threads. This should 
do everything that Eshell needs, plus hopefully add the ability to add 
some basic job control as well. (Well, one day...)

I hacked something up that seems to work for simple cases, and it 
shouldn't be *too* hard to get it working more generally. This will be a 
big change for Eshell, so it might make sense to create a feature branch 
when I have a little more to show. However, I can already see how this 
will eliminate the need for a number of workarounds in Eshell's command 
invocation logic.