unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alyssa Ross <hi@alyssa.is>
To: 45095@debbugs.gnu.org
Cc: Alyssa Ross <hi@alyssa.is>
Subject: bug#45095: [PATCH] lisp/progmodes/compile.el: only use comint-term-environment under comint
Date: Mon,  7 Dec 2020 09:04:51 +0000	[thread overview]
Message-ID: <20201207090450.2225-1-hi@alyssa.is> (raw)

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






             reply	other threads:[~2020-12-07  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-07  9:04 Alyssa Ross [this message]
2020-12-07 15:57 ` bug#45095: [PATCH] lisp/progmodes/compile.el: only use comint-term-environment under comint Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201207090450.2225-1-hi@alyssa.is \
    --to=hi@alyssa.is \
    --cc=45095@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).