Subject: Re: bug#54190: 29.0.50; [PATCH] Incorrect/missing documentation for some Eshell "$" syntaxes

From: Stefan Monnier <[email-masked]>
Date: Mon, 28 Feb 2022 08:18:26 -0500

Lars Ingebrigtsen [2022-02-28 10:38:31] wrote:
> Jim Porter <[email-masked]> writes:
>> Ok, the breaking commit is b03f74e0f2a578b1580e8b1c368665850ee7f808
>> ("Don't quote lambdas in several places"). Reverting the change in
>> that commit in lisp/eshell/esh-var.el fixes things, although I'm not
>> sure why yet. I believe that code gets evaluated by `eshell-do-eval',
>> which evaluates things in a very particular way in order to support
>> deferring evaluation at various points. Once I'm sure I understand why
>> this is breaking, I'll post a patch to fix the bustage.
>
> It's this bit?  Hm...
>
> diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
> index 96838d4132..7388279f15 100644
> --- a/lisp/eshell/esh-var.el
> +++ b/lisp/eshell/esh-var.el
> @@ -463,8 +463,8 @@ eshell-parse-variable-ref
>                     (eshell-as-subcommand ,(eshell-parse-command cmd))
>                     (ignore
>                      (nconc eshell-this-command-hook
> -                           (list (function (lambda ()
> -                                              (delete-file ,temp))))))
> +                           (list (lambda ()
> +                                   (delete-file ,temp)))))
>                     (quote ,temp)))
>              (goto-char (1+ end)))))))
>     ((eq (char-after) ?\()
>
>
> Trying to follow the logic of how this is eventually evaluated isn't,
> er, obvious, but I'm not sure how that change could break anything,
> either.  Perhaps Stefan has a comment; added to the CCs.

Looks like a bug somewhere in the `eshell-do-eval` machinery, yes.
Until we find the problem (or rewrite `eshell-do-eval` on top of the CPS
converter of `generator.el`), I think reverting this change (and adding
a comment pointing to this bug) sounds like a great plan.

        Stefan