aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2004-10-16 18:38:36 +0000
committerJuri Linkov2004-10-16 18:38:36 +0000
commit577bf5d26e8835144005a0505e2ecc611369f92f (patch)
tree883a839af0026aaefa7d28b94a678b67dbca44f9
parentc2e2ede7e88395e3f85871bd58dc9dab1d83d242 (diff)
downloademacs-577bf5d26e8835144005a0505e2ecc611369f92f.tar.gz
emacs-577bf5d26e8835144005a0505e2ecc611369f92f.zip
(compilation-start): Move let-binding of
`process-environment' into `with-current-buffer' body. Reported by Matt Hodges <MPHodges@member.fsf.org>.
-rw-r--r--lisp/ChangeLog8
-rw-r--r--lisp/progmodes/compile.el152
2 files changed, 83 insertions, 77 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c0c5518f765..9409b485a3a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12004-10-16 Juri Linkov <juri@jurta.org>
2
3 * progmodes/compile.el (compilation-start): Move let-binding of
4 `process-environment' into `with-current-buffer' body.
5 Reported by Matt Hodges <MPHodges@member.fsf.org>.
6
12004-10-16 Richard M. Stallman <rms@gnu.org> 72004-10-16 Richard M. Stallman <rms@gnu.org>
2 8
3 * pcvs-util.el (cvs-bury-buffer): 9 * pcvs-util.el (cvs-bury-buffer):
@@ -271,7 +277,7 @@
2712004-10-05 Juri Linkov <juri@jurta.org> 2772004-10-05 Juri Linkov <juri@jurta.org>
272 278
273 * isearch.el (isearch-done): Set mark after running hook. 279 * isearch.el (isearch-done): Set mark after running hook.
274 Suggested by Drew Adams <drew.adams@oracle.com>. 280 Reported by Drew Adams <drew.adams@oracle.com>.
275 281
276 * info.el (Info-history, Info-toc): Fix Info headers. 282 * info.el (Info-history, Info-toc): Fix Info headers.
277 (Info-toc): Narrow buffer before Info-fontify-node. 283 (Info-toc): Narrow buffer before Info-fontify-node.
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index a3aa70a8a8d..d90fe77fe28 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -866,20 +866,6 @@ Returns the compilation buffer created."
866 (if (eq mode t) 866 (if (eq mode t)
867 (prog1 "compilation" (require 'comint)) 867 (prog1 "compilation" (require 'comint))
868 (replace-regexp-in-string "-mode$" "" (symbol-name mode)))) 868 (replace-regexp-in-string "-mode$" "" (symbol-name mode))))
869 (process-environment
870 (append
871 compilation-environment
872 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
873 system-uses-terminfo)
874 (list "TERM=dumb" "TERMCAP="
875 (format "COLUMNS=%d" (window-width)))
876 (list "TERM=emacs"
877 (format "TERMCAP=emacs:co#%d:tc=unknown:"
878 (window-width))))
879 ;; Set the EMACS variable, but
880 ;; don't override users' setting of $EMACS.
881 (unless (getenv "EMACS") '("EMACS=t"))
882 (copy-sequence process-environment)))
883 cd-path ; in case process-environment contains CDPATH 869 cd-path ; in case process-environment contains CDPATH
884 (thisdir (if (string-match "^\\s *cd\\s +\\(.+?\\)\\s *[;&\n]" command) 870 (thisdir (if (string-match "^\\s *cd\\s +\\(.+?\\)\\s *[;&\n]" command)
885 (substitute-in-file-name (match-string 1 command)) 871 (substitute-in-file-name (match-string 1 command))
@@ -923,69 +909,83 @@ Returns the compilation buffer created."
923 ;; Pop up the compilation buffer. 909 ;; Pop up the compilation buffer.
924 (setq outwin (display-buffer outbuf nil t)) 910 (setq outwin (display-buffer outbuf nil t))
925 (with-current-buffer outbuf 911 (with-current-buffer outbuf
926 (if (not (eq mode t)) 912 (let ((process-environment
927 (funcall mode) 913 (append
928 (setq buffer-read-only nil) 914 compilation-environment
929 (with-no-warnings (comint-mode)) 915 (if (if (boundp 'system-uses-terminfo) ; `if' for compiler warning
930 (compilation-shell-minor-mode)) 916 system-uses-terminfo)
931 (if highlight-regexp 917 (list "TERM=dumb" "TERMCAP="
932 (set (make-local-variable 'compilation-highlight-regexp) 918 (format "COLUMNS=%d" (window-width)))
933 highlight-regexp)) 919 (list "TERM=emacs"
934 (set (make-local-variable 'compilation-arguments) 920 (format "TERMCAP=emacs:co#%d:tc=unknown:"
935 (list command mode name-function highlight-regexp)) 921 (window-width))))
936 (set (make-local-variable 'revert-buffer-function) 922 ;; Set the EMACS variable, but
937 'compilation-revert-buffer) 923 ;; don't override users' setting of $EMACS.
938 (set-window-start outwin (point-min)) 924 (unless (getenv "EMACS") '("EMACS=t"))
939 (or (eq outwin (selected-window)) 925 (copy-sequence process-environment))))
940 (set-window-point outwin (if compilation-scroll-output 926 (if (not (eq mode t))
941 (point) 927 (funcall mode)
942 (point-min)))) 928 (setq buffer-read-only nil)
943 ;; The setup function is called before compilation-set-window-height 929 (with-no-warnings (comint-mode))
944 ;; so it can set the compilation-window-height buffer locally. 930 (compilation-shell-minor-mode))
945 (if compilation-process-setup-function 931 (if highlight-regexp
946 (funcall compilation-process-setup-function)) 932 (set (make-local-variable 'compilation-highlight-regexp)
947 (compilation-set-window-height outwin) 933 highlight-regexp))
948 ;; Start the compilation. 934 (set (make-local-variable 'compilation-arguments)
949 (if (fboundp 'start-process) 935 (list command mode name-function highlight-regexp))
950 (let ((proc (if (eq mode t) 936 (set (make-local-variable 'revert-buffer-function)
951 (get-buffer-process 937 'compilation-revert-buffer)
952 (with-no-warnings 938 (set-window-start outwin (point-min))
953 (comint-exec outbuf (downcase mode-name) 939 (or (eq outwin (selected-window))
954 shell-file-name nil `("-c" ,command)))) 940 (set-window-point outwin (if compilation-scroll-output
955 (start-process-shell-command (downcase mode-name) 941 (point)
956 outbuf command)))) 942 (point-min))))
957 ;; Make the buffer's mode line show process state. 943 ;; The setup function is called before compilation-set-window-height
958 (setq mode-line-process '(":%s")) 944 ;; so it can set the compilation-window-height buffer locally.
959 (set-process-sentinel proc 'compilation-sentinel) 945 (if compilation-process-setup-function
960 (set-process-filter proc 'compilation-filter) 946 (funcall compilation-process-setup-function))
961 (set-marker (process-mark proc) (point) outbuf) 947 (compilation-set-window-height outwin)
962 (setq compilation-in-progress 948 ;; Start the compilation.
963 (cons proc compilation-in-progress))) 949 (if (fboundp 'start-process)
964 ;; No asynchronous processes available. 950 (let ((proc (if (eq mode t)
965 (message "Executing `%s'..." command) 951 (get-buffer-process
966 ;; Fake modeline display as if `start-process' were run. 952 (with-no-warnings
967 (setq mode-line-process ":run") 953 (comint-exec outbuf (downcase mode-name)
968 (force-mode-line-update) 954 shell-file-name nil `("-c" ,command))))
969 (sit-for 0) ; Force redisplay 955 (start-process-shell-command (downcase mode-name)
970 (let ((status (call-process shell-file-name nil outbuf nil "-c" 956 outbuf command))))
971 command))) 957 ;; Make the buffer's mode line show process state.
972 (cond ((numberp status) 958 (setq mode-line-process '(":%s"))
973 (compilation-handle-exit 'exit status 959 (set-process-sentinel proc 'compilation-sentinel)
974 (if (zerop status) 960 (set-process-filter proc 'compilation-filter)
975 "finished\n" 961 (set-marker (process-mark proc) (point) outbuf)
976 (format "\ 962 (setq compilation-in-progress
963 (cons proc compilation-in-progress)))
964 ;; No asynchronous processes available.
965 (message "Executing `%s'..." command)
966 ;; Fake modeline display as if `start-process' were run.
967 (setq mode-line-process ":run")
968 (force-mode-line-update)
969 (sit-for 0) ; Force redisplay
970 (let ((status (call-process shell-file-name nil outbuf nil "-c"
971 command)))
972 (cond ((numberp status)
973 (compilation-handle-exit 'exit status
974 (if (zerop status)
975 "finished\n"
976 (format "\
977exited abnormally with code %d\n" 977exited abnormally with code %d\n"
978 status)))) 978 status))))
979 ((stringp status) 979 ((stringp status)
980 (compilation-handle-exit 'signal status 980 (compilation-handle-exit 'signal status
981 (concat status "\n"))) 981 (concat status "\n")))
982 (t 982 (t
983 (compilation-handle-exit 'bizarre status status)))) 983 (compilation-handle-exit 'bizarre status status))))
984 ;; Without async subprocesses, the buffer is not yet 984 ;; Without async subprocesses, the buffer is not yet
985 ;; fontified, so fontify it now. 985 ;; fontified, so fontify it now.
986 (let ((font-lock-verbose nil)) ; shut up font-lock messages 986 (let ((font-lock-verbose nil)) ; shut up font-lock messages
987 (font-lock-fontify-buffer)) 987 (font-lock-fontify-buffer))
988 (message "Executing `%s'...done" command))) 988 (message "Executing `%s'...done" command))))
989 (if (buffer-local-value 'compilation-scroll-output outbuf) 989 (if (buffer-local-value 'compilation-scroll-output outbuf)
990 (save-selected-window 990 (save-selected-window
991 (select-window outwin) 991 (select-window outwin)