comparison lisp/progmodes/compile.el @ 81801:2e8d5916d236

* comint.el (make-comint, make-comint-in-buffer) (comint-exec-1): Replace `start-process' by `start-file-process'. * progmodes/compile.el (compilation-start): Revert redefining `start-process'.
author Michael Albinus <michael.albinus@gmx.de>
date Tue, 10 Jul 2007 19:52:11 +0000
parents 15008ad392dc
children 8c1a05c2d668
comparison
equal deleted inserted replaced
81800:e29d41367d51 81801:2e8d5916d236
1096 ;; Set the EMACS variable, but 1096 ;; Set the EMACS variable, but
1097 ;; don't override users' setting of $EMACS. 1097 ;; don't override users' setting of $EMACS.
1098 (unless (getenv "EMACS") 1098 (unless (getenv "EMACS")
1099 (list "EMACS=t")) 1099 (list "EMACS=t"))
1100 (list "INSIDE_EMACS=t") 1100 (list "INSIDE_EMACS=t")
1101 (copy-sequence process-environment))) 1101 (copy-sequence process-environment))))
1102 (start-process (symbol-function 'start-process)))
1103 (set (make-local-variable 'compilation-arguments) 1102 (set (make-local-variable 'compilation-arguments)
1104 (list command mode name-function highlight-regexp)) 1103 (list command mode name-function highlight-regexp))
1105 (set (make-local-variable 'revert-buffer-function) 1104 (set (make-local-variable 'revert-buffer-function)
1106 'compilation-revert-buffer) 1105 'compilation-revert-buffer)
1107 (set-window-start outwin (point-min)) 1106 (set-window-start outwin (point-min))
1112 ;; The setup function is called before compilation-set-window-height 1111 ;; The setup function is called before compilation-set-window-height
1113 ;; so it can set the compilation-window-height buffer locally. 1112 ;; so it can set the compilation-window-height buffer locally.
1114 (if compilation-process-setup-function 1113 (if compilation-process-setup-function
1115 (funcall compilation-process-setup-function)) 1114 (funcall compilation-process-setup-function))
1116 (compilation-set-window-height outwin) 1115 (compilation-set-window-height outwin)
1117 ;; Redefine temporarily `start-process' in order to handle
1118 ;; remote compilation.
1119 (fset 'start-process
1120 (lambda (name buffer program &rest program-args)
1121 (apply
1122 (if (file-remote-p default-directory)
1123 'start-file-process
1124 start-process)
1125 name buffer program program-args)))
1126 ;; Start the compilation. 1116 ;; Start the compilation.
1127 (unwind-protect 1117 (let ((proc (if (eq mode t)
1128 (let ((proc (if (eq mode t) 1118 (get-buffer-process
1129 (get-buffer-process 1119 (with-no-warnings
1130 (with-no-warnings 1120 (comint-exec outbuf (downcase mode-name)
1131 (comint-exec outbuf (downcase mode-name) 1121 shell-file-name nil `("-c" ,command))))
1132 shell-file-name nil 1122 (start-process-shell-command (downcase mode-name)
1133 `("-c" ,command)))) 1123 outbuf command))))
1134 (start-process-shell-command (downcase mode-name) 1124 ;; Make the buffer's mode line show process state.
1135 outbuf command)))) 1125 (setq mode-line-process '(":%s"))
1136 ;; Make the buffer's mode line show process state. 1126 (set-process-sentinel proc 'compilation-sentinel)
1137 (setq mode-line-process '(":%s")) 1127 (set-process-filter proc 'compilation-filter)
1138 (set-process-sentinel proc 'compilation-sentinel) 1128 (set-marker (process-mark proc) (point) outbuf)
1139 (set-process-filter proc 'compilation-filter) 1129 (when compilation-disable-input
1140 (set-marker (process-mark proc) (point) outbuf) 1130 (condition-case nil
1141 (when compilation-disable-input 1131 (process-send-eof proc)
1142 (condition-case nil 1132 ;; The process may have exited already.
1143 (process-send-eof proc) 1133 (error nil)))
1144 ;; The process may have exited already. 1134 (setq compilation-in-progress
1145 (error nil))) 1135 (cons proc compilation-in-progress))))
1146 (setq compilation-in-progress
1147 (cons proc compilation-in-progress)))
1148 ;; Unwindform: Reset original definition of `start-process'
1149 (fset 'start-process start-process)))
1150 ;; Now finally cd to where the shell started make/grep/... 1136 ;; Now finally cd to where the shell started make/grep/...
1151 (setq default-directory thisdir)) 1137 (setq default-directory thisdir))
1152 (if (buffer-local-value 'compilation-scroll-output outbuf) 1138 (if (buffer-local-value 'compilation-scroll-output outbuf)
1153 (save-selected-window 1139 (save-selected-window
1154 (select-window outwin) 1140 (select-window outwin)