]> git.eshelyaron.com Git - emacs.git/commitdiff
Make shell-command use comint settings
authorAlyssa Ross <hi@alyssa.is>
Fri, 4 Dec 2020 10:06:48 +0000 (11:06 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 4 Dec 2020 10:06:48 +0000 (11:06 +0100)
* 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

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