GNU bug report logs - #45095
[PATCH] lisp/progmodes/compile.el: only use comint-term-environment under comint

Previous Next

Package: emacs;

Reported by: Alyssa Ross <hi <at> alyssa.is>

Date: Mon, 7 Dec 2020 09:06:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Alyssa Ross <hi <at> alyssa.is>
To: bug-gnu-emacs <at> gnu.org
Cc: Alyssa Ross <hi <at> alyssa.is>
Subject: [PATCH] lisp/progmodes/compile.el: only use comint-term-environment
 under comint
Date: Mon,  7 Dec 2020 09:04:51 +0000
comint-term-environment is used for configuring the environment for
terminal output under comint.  If compile is being used with a
different major mode, that mode probably can't handle the fancy
terminfo output that comint can, so comint-term-environment should
only be used under comint or a derived mode.

; Tested with emacs -Q as follows:
;
;  (1) Set comint-terminfo-terminal to "dumb-emacs-ansi", provided by
;      recent ncurses:
;
;          (setq comint-terminfo-terminal "dumb-emacs-ansi") C-x C-e
;
;  (2) Verify that no uninterpreted control characters are displayed by
;          (compile "grep --color=auto Emacs README") C-x C-e
;
;  (3) Verify that grep knows it can output color when using comint:
;          (compile "grep --color=auto Emacs README" t) C-x C-e
;
; Prior to this change, grep in (2) would output control characters,
; which would be displayed uninterpreted in the buffer.
---
I haven't got my copyright papers sorted yet, so hopefully this change
is also small enough that that doesn't matter.

 lisp/progmodes/compile.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 787f5d5ef3..b4bcc3f2d2 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1868,7 +1868,8 @@ compilation-start
       (let ((process-environment
 	     (append
 	      compilation-environment
-              (comint-term-environment)
+              (when (derived-mode-p 'comint-mode)
+                (comint-term-environment))
 	      (list (format "INSIDE_EMACS=%s,compile" emacs-version))
 	      (copy-sequence process-environment))))
 	(set (make-local-variable 'compilation-arguments)
-- 
2.27.0





This bug report was last modified 4 years and 225 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.