From e5a18efd3d96a942c6d6bdc04d0d431165f3138a Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Sat, 5 Dec 2020 10:39:55 +0000 Subject: [PATCH] Fix last change to shell-command * lisp/simple.el: Specify comint-term-environment arglist in function declaration. (shell-command): Load shell.el before calling comint-term-environment; otherwise it is undefined. Allow async-shell-command-width to take precedence over the COLUMNS value returned by comint-term-environment. (Bug#45034) --- lisp/simple.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 4356e40d4fd..d73bc6b0682 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3786,7 +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") +(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,18 +3965,19 @@ 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) - (let ((process-environment + (require 'shell) + (let ((process-environment (append - (comint-term-environment) (and (natnump async-shell-command-width) (list (format "COLUMNS=%d" async-shell-command-width))) + (comint-term-environment) process-environment))) (setq proc (start-process-shell-command "Shell" buffer command))) (setq mode-line-process '(":%s")) - (require 'shell) (shell-mode) + (shell-mode) (set-process-sentinel proc #'shell-command-sentinel) ;; Use the comint filter for proper handling of ;; carriage motion (see comint-inhibit-carriage-motion). -- 2.39.5