From 6d84d62ceb771b5132d051e34f458f7110a83808 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Mon, 28 Feb 2022 09:31:22 -0800 Subject: [PATCH 2/2] Partially revert b03f74e0f2a578b1580e8b1c368665850ee7f808 That commit regressed '$' forms in Eshell, due to a limitation/bug in how 'eshell-do-eval' works. * lisp/eshell/esh-var.el (eshell-parse-variable-ref): Quote a lambda. * test/lisp/eshell/eshell-tests.el (eshell-test/interp-temp-cmd): New test. --- lisp/eshell/esh-var.el | 8 ++++++-- test/lisp/eshell/eshell-tests.el | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index cfefe15c9c..ee3ffbc647 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el @@ -466,8 +466,12 @@ eshell-parse-variable-ref (eshell-as-subcommand ,(eshell-parse-command cmd)) (ignore (nconc eshell-this-command-hook - (list (lambda () - (delete-file ,temp))))) + ;; Quote this lambda; it will be evaluated + ;; by `eshell-do-eval', which requires very + ;; particular forms in order to work + ;; properly. See bug#54190. + (list (function (lambda () + (delete-file ,temp)))))) (quote ,temp))) (goto-char (1+ end))))))) ((eq (char-after) ?\() diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el index d6ee1bdb17..eff4edd62c 100644 --- a/test/lisp/eshell/eshell-tests.el +++ b/test/lisp/eshell/eshell-tests.el @@ -93,6 +93,10 @@ eshell-test/interp-lisp "Interpolate Lisp form evaluation" (should (equal (eshell-test-command-result "+ $(+ 1 2) 3") 6))) +(ert-deftest eshell-test/interp-temp-cmd () + "Interpolate command result redirected to temp file" + (should (equal (eshell-test-command-result "cat $") "hi"))) + (ert-deftest eshell-test/interp-concat () "Interpolate and concat command" (should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36))) -- 2.25.1