bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-te


From: Alyssa Ross
Subject: bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment
Date: Fri, 4 Dec 2020 00:03:04 +0000

Even though async-shell-command will open a shell-mode buffer, and
shell-mode inherits from comint-mode, because it doesn't use
comint-exec, comint-term-environment isn't respected.  It would make
sense for it to, because since async-shell-command uses comint, any
fancy stuff comint-term-environment enables should work in
async-shell-command too.

With this change, a simple (setq comint-terminfo-terminal "dumb-emacs-ansi")
is all that's required to get colored output from many programs on a
GNU/Linux system with a recent version of ncurses when run through
async-shell-command.
---
 lisp/simple.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index b5ba05426f..dcd619b0ab 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3783,10 +3783,11 @@ shell-command
                   (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)
+                          (when (natnump async-shell-command-width)
+                            (format "COLUMNS=%d" async-shell-command-width))
+                          process-environment)))
                    (setq proc
                          (start-process-shell-command "Shell" buffer command)))
                  (setq mode-line-process '(":%s"))
-- 
2.27.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]