]> git.eshelyaron.com Git - emacs.git/commitdiff
Partially revert b03f74e0f2a578b1580e8b1c368665850ee7f808
authorJim Porter <jporterbugs@gmail.com>
Mon, 28 Feb 2022 17:31:22 +0000 (09:31 -0800)
committerEli Zaretskii <eliz@gnu.org>
Tue, 1 Mar 2022 13:01:16 +0000 (15:01 +0200)
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
test/lisp/eshell/eshell-tests.el

index 145a522516d6d3df1aa7dfb261f85cda4ccd6104..081938b4e4a6275f1fceef858eb311a1d48be542 100644 (file)
@@ -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) ?\()
index a9b1e2ab4e8f375df2bfa78d9ab0d7b8022ce18d..fe4fba294fd7ce292ae9152ebed32ef26d0d800f 100644 (file)
@@ -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)))