From cbfce827ace4c410a2eed50c8d8c763721925b7e Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Fri, 4 Dec 2020 11:06:48 +0100 Subject: [PATCH] Make shell-command use comint settings * lisp/simple.el (shell-command): Use the term environment from comint, so that comint settings are used for commands like `async-shell-command', too (bug#45034). Copyright-paperwork-exempt: yes --- lisp/simple.el | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 7d0c229cad0..4356e40d4fd 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3786,6 +3786,7 @@ a shell (with its need to quote arguments)." (shell-command command output-buffer error-buffer)) (declare-function comint-output-filter "comint" (process string)) +(declare-function comint-term-environment "comint") (defun shell-command (command &optional output-buffer error-buffer) "Execute string COMMAND in inferior shell; display output, if any. @@ -3965,10 +3966,13 @@ impose the use of a shell (with its need to quote arguments)." (shell-command-save-pos-or-erase) (setq default-directory directory) (let ((process-environment - (if (natnump async-shell-command-width) - (cons (format "COLUMNS=%d" async-shell-command-width) - process-environment) - process-environment))) + (append + (comint-term-environment) + (and (natnump async-shell-command-width) + (list + (format "COLUMNS=%d" + async-shell-command-width))) + process-environment))) (setq proc (start-process-shell-command "Shell" buffer command))) (setq mode-line-process '(":%s")) -- 2.39.5