]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix last change to shell-command
authorBasil L. Contovounesios <contovob@tcd.ie>
Sat, 5 Dec 2020 10:39:55 +0000 (10:39 +0000)
committerBasil L. Contovounesios <contovob@tcd.ie>
Sat, 5 Dec 2020 10:45:17 +0000 (10:45 +0000)
* 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

index 4356e40d4fd2d3eaba91e70751fe605da1b1f39c..d73bc6b0682fea2071f9115f4dbaacc76b4180c7 100644 (file)
@@ -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).