unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment
@ 2020-12-04  0:03 Alyssa Ross
  2020-12-04 10:07 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Alyssa Ross @ 2020-12-04  0:03 UTC (permalink / raw)
  To: 45034; +Cc: Alyssa Ross

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






^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment
  2020-12-04  0:03 bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment Alyssa Ross
@ 2020-12-04 10:07 ` Lars Ingebrigtsen
  2020-12-05 11:26   ` Basil L. Contovounesios
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-04 10:07 UTC (permalink / raw)
  To: Alyssa Ross; +Cc: 45034

Alyssa Ross <hi@alyssa.is> writes:

> 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.

Thanks; makes sense to me, so I've applied it to Emacs 28 (with some
small changes).

This change was small enough to apply without assigning copyright to the
FSF, but for future patches you want to submit, it might make sense to
get the paperwork started now, so that subsequent patches can be applied
speedily. Would you be willing to sign such paperwork?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment
  2020-12-04 10:07 ` Lars Ingebrigtsen
@ 2020-12-05 11:26   ` Basil L. Contovounesios
  2020-12-06 13:21     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Basil L. Contovounesios @ 2020-12-05 11:26 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Alyssa Ross, 45034

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Alyssa Ross <hi@alyssa.is> writes:
>
>> 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.
>
> Thanks; makes sense to me, so I've applied it to Emacs 28 (with some
> small changes).

This caused an error with:

0. emacs -Q
1. (async-shell-command "true") C-x C-e

I pushed the following fixes to master; let me know if there's anything
wrong with them.

Fix last change to shell-command
e5a18efd3d 2020-12-05 10:45:17 +0000
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=e5a18efd3d96a942c6d6bdc04d0d431165f3138a

Thanks,

-- 
Basil





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment
  2020-12-05 11:26   ` Basil L. Contovounesios
@ 2020-12-06 13:21     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-12-06 13:21 UTC (permalink / raw)
  To: Basil L. Contovounesios; +Cc: Alyssa Ross, 45034

"Basil L. Contovounesios" <contovob@tcd.ie> writes:

> This caused an error with:
>
> 0. emacs -Q
> 1. (async-shell-command "true") C-x C-e
>
> I pushed the following fixes to master; let me know if there's anything
> wrong with them.

Thanks; looks good to me.  I really thought I'd tested this, but I
tested with `M-x async-shell-command'...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-06 13:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-04  0:03 bug#45034: [PATCH] * lisp/simple.el (async-shell-command): use comint-term-environment Alyssa Ross
2020-12-04 10:07 ` Lars Ingebrigtsen
2020-12-05 11:26   ` Basil L. Contovounesios
2020-12-06 13:21     ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).