From: Alyssa Ross Date: Fri, 4 Dec 2020 10:06:48 +0000 (+0100) Subject: Make shell-command use comint settings X-Git-Tag: emacs-28.0.90~4932 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=cbfce827ace4c410a2eed50c8d8c763721925b7e;p=emacs.git 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 --- 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"))