Subject: Re: bug#20202: 24.3; Comint mode sets a bad $EMACS
From: Stefan Monnier <[email-masked]>
To: Eli Barzilay <[email-masked]>
Cc: [email-masked]
Date: Thu, 09 Apr 2015 11:02:29 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> Yeah, that's what I thought.  FWIW, to avoid it for now, I've made my
> Emacs set it to "emacs" and it looks like that works fine for builds.

I've just installed the patch below into master, which should fix this
problem,

        Stefan

diff --git a/lisp/comint.el b/lisp/comint.el
index 31649ff..2769c87 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -816,8 +816,6 @@ series of processes in the same Comint buffer.  The hook
 		    (format "COLUMNS=%d" (window-width)))
 	    (list "TERM=emacs"
 		  (format "TERMCAP=emacs:co#%d:tc=unknown:" (window-width))))
-	  (unless (getenv "EMACS")
-	    (list "EMACS=t"))
 	  (list (format "INSIDE_EMACS=%s,comint" emacs-version))
 	  process-environment))
 	(default-directory
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index f59c5fb..3f006e8 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -496,7 +496,6 @@ as given in your `~/.profile'."
 (defcustom tramp-remote-process-environment
   `("TMOUT=0" "LC_CTYPE=''"
     ,(format "TERM=%s" tramp-terminal-type)
-    "EMACS=t" ;; Deprecated.
     ,(format "INSIDE_EMACS='%s,tramp:%s'" emacs-version tramp-version)
     "CDPATH=" "HISTORY=" "MAIL=" "MAILCHECK=" "MAILPATH=" "PAGER=cat"
     "autocorrect=" "correct=")
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 362bbf5..9d36e91 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1666,11 +1666,7 @@ Returns the compilation buffer created."
 		(list "TERM=emacs"
 		      (format "TERMCAP=emacs:co#%d:tc=unknown:"
 			      (window-width))))
-	      ;; Set the EMACS variable, but
-	      ;; don't override users' setting of $EMACS.
-	      (unless (getenv "EMACS")
-		(list "EMACS=t"))
-	      (list "INSIDE_EMACS=t")
+	      (list (format "INSIDE_EMACS=%s,compile" emacs-version))
 	      (copy-sequence process-environment))))
 	(set (make-local-variable 'compilation-arguments)
 	     (list command mode name-function highlight-regexp))
diff --git a/lisp/term.el b/lisp/term.el
index 43138fa..4c82986 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1505,11 +1505,6 @@ Using \"emacs\" loses, because bash disables editing if $TERM == emacs.")
 	   (format "TERMINFO=%s" data-directory)
 	   (format term-termcap-format "TERMCAP="
 		   term-term-name term-height term-width)
-	   ;; We are going to get rid of the binding for EMACS,
-	   ;; probably in Emacs 23, because it breaks
-	   ;; `./configure' of some packages that expect it to
-	   ;; say where to find EMACS.
-	   (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
 	   (format "INSIDE_EMACS=%s,term:%s" emacs-version term-protocol-version)
 	   (format "LINES=%d" term-height)
 	   (format "COLUMNS=%d" term-width))