bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

M-x compile does not set the EMACS env var anymore


From: Gustav Hållberg
Subject: M-x compile does not set the EMACS env var anymore
Date: Fri, 31 Jan 2003 20:20:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01

In emacs 21.2, M-x compile does not set the EMACS environment variable in the compilation process (which at least 20.7 used to do), and looking
at the code it seems as if it's supposed to do this still.

To test this, evaluate (compile "export")

Note that the TERM env variable is not set properly either.

I am attaching a suggested bugfix.

My patch does not address the case of the branch that gets run unless
(fboundp 'start-process).

- Gustav
--- compile-old.el      2003-01-31 19:56:44.000000000 +0100
+++ compile.el  2003-01-31 20:05:07.000000000 +0100
@@ -826,29 +826,33 @@
            (funcall compilation-process-setup-function))
        ;; Start the compilation.
        (if (fboundp 'start-process)
-           (let* ((process-environment process-environment)
-                  (proc (start-process-shell-command (downcase mode-name)
-                                                     outbuf
-                                                     command)))
+           (let ((process-environment process-environment))
              ;; Set the terminal type
              (setq process-environment
-                   (if (and (boundp 'system-uses-terminfo)
-                            system-uses-terminfo)
-                       (list "TERM=dumb" "TERMCAP="
-                             (format "COLUMNS=%d" (window-width)))
-                     (list "TERM=emacs"
-                           (format "TERMCAP=emacs:co#%d:tc=unknown:"
-                                   (window-width)))))
+                   (append process-environment
+                           (if (and (boundp 'system-uses-terminfo)
+                                    system-uses-terminfo)
+                               (list "TERM=dumb" "TERMCAP="
+                                     (format "COLUMNS=%d" (window-width)))
+                             (list "TERM=emacs"
+                                   (format "TERMCAP=emacs:co#%d:tc=unknown:"
+                                           (window-width))))))
+
              ;; Set the EMACS variable, but
              ;; don't override users' setting of $EMACS.
-             (if (getenv "EMACS")
+             (unless (getenv "EMACS")
                  (setq process-environment
                        (cons "EMACS=t" process-environment)))
-             (set-process-sentinel proc 'compilation-sentinel)
-             (set-process-filter proc 'compilation-filter)
-             (set-marker (process-mark proc) (point) outbuf)
-             (setq compilation-in-progress
-                   (cons proc compilation-in-progress)))
+
+             (let ((proc (start-process-shell-command (downcase mode-name)
+                                                      outbuf
+                                                      command)))
+               (set-process-sentinel proc 'compilation-sentinel)
+               (set-process-filter proc 'compilation-filter)
+               (set-marker (process-mark proc) (point) outbuf)
+               (setq compilation-in-progress
+                     (cons proc compilation-in-progress))))
+
          ;; No asynchronous processes available.
          (message "Executing `%s'..." command)
          ;; Fake modeline display as if `start-process' were run.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]