From dfb422677182217889f02b7bcc05d12eedd70976 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Thu, 27 Mar 2025 17:48:20 +0100 Subject: [PATCH] Handle better changed default-directory in shell-command * lisp/simple.el (shell-command): Kill buffer-local values of `shell-file-name' and `shell-command-switch', there could be left connection-local values. (Bug#76888) (cherry picked from commit 37b8acf3781a65d397a946f621893b07a0960de0) --- lisp/simple.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lisp/simple.el b/lisp/simple.el index 621446b929c..10eeba4ba45 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -4604,6 +4604,9 @@ impose the use of a shell (with its need to quote arguments)." (with-current-buffer buffer (shell-command-save-pos-or-erase) (setq default-directory directory) + ;; There could be left connection-local values. (Bug#76888) + (kill-local-variable 'shell-file-name) + (kill-local-variable 'shell-command-switch) (require 'shell) (let ((process-environment (append -- 2.39.5