[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 9e257aecc9 1/3: Partially revert b03f74e0f2a578b1580e8b1c368665
From: |
Eli Zaretskii |
Subject: |
emacs-28 9e257aecc9 1/3: Partially revert b03f74e0f2a578b1580e8b1c368665850ee7f808 |
Date: |
Tue, 1 Mar 2022 08:09:20 -0500 (EST) |
branch: emacs-28
commit 9e257aecc9a3456fb3d66596862d44030f7d76c8
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>
Partially revert b03f74e0f2a578b1580e8b1c368665850ee7f808
That commit regressed '$<command>' forms in Eshell, due to a
limitation/bug in how 'eshell-do-eval' works. This fixes
bug#54190.
* 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 145a522516..081938b4e4 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -460,8 +460,12 @@ Possible options are:
(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 a9b1e2ab4e..fe4fba294f 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -130,6 +130,10 @@ e.g. \"{(+ 1 2)} 3\" => 3"
"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 $<echo hi>") "hi")))
+
(ert-deftest eshell-test/interp-concat ()
"Interpolate and concat command"
(should (equal (eshell-test-command-result "+ ${+ 1 2}3 3") 36)))