From 73d213f2816876fe9c6c429e75a3be5454a42b34 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 23 Mar 2016 15:07:56 -0700 Subject: [PATCH] Comint, term, and compile now set EMACS This fixes directory tracking in ansi-term, at the expense of breaking some usages of 'configure'. Setting EMACS is meant to be a somewhat temporary measure, until Bash 4.4 comes out and is common. (Bug#20484). * etc/NEWS: Document this. * lisp/comint.el (comint-exec-1): * lisp/net/tramp-sh.el (tramp-remote-process-environment): * lisp/progmodes/compile.el (compilation-start): * lisp/term.el (term-exec-1): Go back to setting the EMACS environment variable, for backward compatibility to Bash 4.3 and earlier. --- etc/NEWS | 3 ++- lisp/comint.el | 7 +++++++ lisp/net/tramp-sh.el | 1 + lisp/progmodes/compile.el | 8 ++++++++ lisp/term.el | 7 +++++++ 5 files changed, 25 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 8ce194a69ca..f952a14b1ec 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1404,7 +1404,8 @@ symbol-function was changed not to signal 'void-function' any more. *** As a consequence, the second arg of 'indirect-function' is now obsolete. +++ -** Comint, term, and compile do not set the EMACS env var any more. +** Although comint, term, and compile still set the EMACS variable, +this is now considered deprecated and will be removed in a future release. Use the INSIDE_EMACS environment variable instead. +++ diff --git a/lisp/comint.el b/lisp/comint.el index dcd4a5ae4cf..cb79c175f0e 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -816,6 +816,13 @@ 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)))) + + ;; This hack is for backward compatibility with Bash 4.3 and + ;; earlier. It can break common uses of 'configure', so + ;; remove it once Bash 4.4 or later is common. + (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 1f43747c094..9fa46109a5a 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -520,6 +520,7 @@ as given in your `~/.profile'." (defcustom tramp-remote-process-environment `("TMOUT=0" "LC_CTYPE=''" ,(format "TERM=%s" tramp-terminal-type) + "EMACS=t" ;; Deprecated; remove this line once Bash 4.4-or-later is common. ,(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 b7ab408f744..0b15a283090 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1702,6 +1702,14 @@ 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. + ;; Remove this hack once Bash 4.4-or-later is common, + ;; since it can break 'configure'. + (unless (getenv "EMACS") + (list "EMACS=t")) + (list (format "INSIDE_EMACS=%s,compile" emacs-version)) (copy-sequence process-environment)))) (set (make-local-variable 'compilation-arguments) diff --git a/lisp/term.el b/lisp/term.el index a2e01ed4a29..6fd3a5e6261 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -1454,6 +1454,13 @@ 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) + + ;; This is for backwards compatibility with Bash 4.3 and earlier. + ;; Remove this hack once Bash 4.4-or-later is common, 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)) -- 2.11.4.GIT