GNU bug report logs - #61954
30.0.50; [PATCH] Simplify structured commands in Eshell

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sat, 4 Mar 2023 07:29:02 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 61954 in the body.
You can then email your comments to 61954 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#61954; Package emacs. (Sat, 04 Mar 2023 07:29:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Porter <jporterbugs <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 04 Mar 2023 07:29:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; [PATCH] Simplify structured commands in Eshell
Date: Fri, 3 Mar 2023 23:28:46 -0800
[Message part 1 (text/plain, inline)]
Structured commands are just Eshell flow control commands, like 'if' and 
'while'. These expected you to set 'eshell-test-body' and 
'eshell-command-body' when implementing them, and were very hard to get 
right (see bug#12571 for example).

Instead, let's improve Eshell's iterative command evaluation some more 
so that you can write the implementations for these commands like 
normal. I think this is beneficial for two main reasons: a) it should 
get us closer to replacing Eshell's iterative evaluation with the CPS 
machinery in generator.el (bug#37635)[1], and b) third-parties should 
have an easier time writing their own fancy Eshell commands using the 
command-rewriting hooks.

Given that we have fairly thorough regression tests in Eshell now, I'm 
pretty confident that these patches don't break anything.

[1] I think I mentioned it elsewhere, but I'm hoping to make sure that 
when we do switch to the CPS machinery (or maybe to threads), it's just 
a drop-in replacement. That way, if there are problems, it should be 
easy to revert to the classic iterative evaluation code. Maybe we could 
even provide a defcustom for it just in case.
[0001-Simplify-iteration-in-Eshell-for-loops.patch (text/plain, attachment)]
[0002-Simplify-how-Eshell-s-iterative-evaluation-handles-i.patch (text/plain, attachment)]
[0003-Simplify-usage-of-while-forms-in-Eshell-s-iterative-.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61954; Package emacs. (Mon, 06 Mar 2023 01:17:02 GMT) Full text and rfc822 format available.

Message #8 received at 61954 <at> debbugs.gnu.org (full text, mbox):

From: Sean Whitton <spwhitton <at> spwhitton.name>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 61954 <at> debbugs.gnu.org
Subject: Re: bug#61954: 30.0.50; [PATCH] Simplify structured commands in Eshell
Date: Sun, 05 Mar 2023 18:15:54 -0700
Hello,

On Fri 03 Mar 2023 at 11:28PM -08, Jim Porter wrote:

> Structured commands are just Eshell flow control commands, like 'if' and
> 'while'. These expected you to set 'eshell-test-body' and
> 'eshell-command-body' when implementing them, and were very hard to get right
> (see bug#12571 for example).
>
> Instead, let's improve Eshell's iterative command evaluation some more so that
> you can write the implementations for these commands like normal. I think this
> is beneficial for two main reasons: a) it should get us closer to replacing
> Eshell's iterative evaluation with the CPS machinery in generator.el
> (bug#37635)[1], and b) third-parties should have an easier time writing their
> own fancy Eshell commands using the command-rewriting hooks.

I think you have typo'd the bug number?

I would like to read about what the advantages of moving to CPS in
particular will be.  My understanding was that CPS is only rarely a good
idea.

-- 
Sean Whitton




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#61954; Package emacs. (Mon, 06 Mar 2023 02:12:01 GMT) Full text and rfc822 format available.

Message #11 received at 61954 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 61954 <at> debbugs.gnu.org
Subject: Re: bug#61954: 30.0.50; [PATCH] Simplify structured commands in Eshell
Date: Sun, 5 Mar 2023 18:11:44 -0800
On 3/5/2023 5:15 PM, Sean Whitton wrote:
> I think you have typo'd the bug number?

Sorry, bug#57635.

> I would like to read about what the advantages of moving to CPS in
> particular will be.  My understanding was that CPS is only rarely a good
> idea.

Well, that's what 'eshell-do-eval' is already; it's just incomplete 
(doesn't understand all of Elisp) and has a number of bugs. Migrating to 
generator.el's CPS machinery would mean we get the benefits of a 
more-complete implementation, with (hopefully) fewer bugs.

Whether CPS is a good idea in general is above my pay grade, but short 
of some major improvements to threads in Emacs, I don't see an 
alternative. Eshell needs *some* mechanism for deferring execution of 
its command forms. (As I recall, threads have issues around prompting 
the user, which is why Tramp doesn't yet use threads, and Eshell would 
have the same issues. Not only that, but if Eshell used threads, it 
would cause problems when Eshell code calls Tramp code.)




Reply sent to Jim Porter <jporterbugs <at> gmail.com>:
You have taken responsibility. (Fri, 17 Mar 2023 05:34:02 GMT) Full text and rfc822 format available.

Notification sent to Jim Porter <jporterbugs <at> gmail.com>:
bug acknowledged by developer. (Fri, 17 Mar 2023 05:34:02 GMT) Full text and rfc822 format available.

Message #16 received at 61954-done <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: 61954-done <at> debbugs.gnu.org
Subject: Re: bug#61954: 30.0.50; [PATCH] Simplify structured commands in Eshell
Date: Thu, 16 Mar 2023 22:33:09 -0700
On 3/3/2023 11:28 PM, Jim Porter wrote:
> Structured commands are just Eshell flow control commands, like 'if' and 
> 'while'. These expected you to set 'eshell-test-body' and 
> 'eshell-command-body' when implementing them, and were very hard to get 
> right (see bug#12571 for example).
> 
> Instead, let's improve Eshell's iterative command evaluation some more 
> so that you can write the implementations for these commands like 
> normal.

Since there haven't been any concerns about the patches themselves in 
the last two weeks-ish, merging this now as 1565dbcae3 and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Apr 2023 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 24 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.