From 62e4316bad6645ff12ef7587735b9e1c5e74fe21 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Sat, 20 Aug 2022 10:48:32 -0700 Subject: [PATCH] Kill the buffer associated with a temp file when using '$' in Eshell * lisp/eshell/esh-var.el (eshell-parse-variable-ref): Kill the temp file's buffer when we're done. --- lisp/eshell/esh-var.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el index 2f6614b5d7..a9df172e88 100644 --- a/lisp/eshell/esh-var.el +++ b/lisp/eshell/esh-var.el @@ -490,8 +490,11 @@ eshell-parse-variable-ref ;; by `eshell-do-eval', which requires very ;; particular forms in order to work ;; properly. See bug#54190. - (list (function (lambda () - (delete-file ,temp)))))) + (list (function + (lambda () + (delete-file ,temp) + (when-let ((buffer (get-file-buffer ,temp))) + (kill-buffer buffer))))))) (eshell-apply-indices ,temp indices ,eshell-current-quoted))) (goto-char (1+ end))))))) ((eq (char-after) ?\() -- 2.25.1