diff options
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/compile.el | 94 |
2 files changed, 68 insertions, 31 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf7567fb46f..c8dac9db694 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2008-10-09 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/compile.el (compilation-start): Resurrect the version | ||
| 4 | for systems that don't support asynchronous subprocesses. | ||
| 5 | |||
| 1 | 2008-10-09 Martin Rudalics <rudalics@gmx.at> | 6 | 2008-10-09 Martin Rudalics <rudalics@gmx.at> |
| 2 | 7 | ||
| 3 | * window.el (pop-up-frames): Add choice graphic-only. | 8 | * window.el (pop-up-frames): Add choice graphic-only. |
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 79049a49cfb..c25c45f356f 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -1246,38 +1246,70 @@ Returns the compilation buffer created." | |||
| 1246 | (funcall compilation-process-setup-function)) | 1246 | (funcall compilation-process-setup-function)) |
| 1247 | (compilation-set-window-height outwin) | 1247 | (compilation-set-window-height outwin) |
| 1248 | ;; Start the compilation. | 1248 | ;; Start the compilation. |
| 1249 | (let ((proc | 1249 | (if (fboundp 'start-process) |
| 1250 | (if (eq mode t) | 1250 | (let ((proc |
| 1251 | ;; comint uses `start-file-process'. | 1251 | (if (eq mode t) |
| 1252 | (get-buffer-process | 1252 | ;; comint uses `start-file-process'. |
| 1253 | (with-no-warnings | 1253 | (get-buffer-process |
| 1254 | (comint-exec | 1254 | (with-no-warnings |
| 1255 | outbuf (downcase mode-name) | 1255 | (comint-exec |
| 1256 | (if (file-remote-p default-directory) | 1256 | outbuf (downcase mode-name) |
| 1257 | "/bin/sh" | 1257 | (if (file-remote-p default-directory) |
| 1258 | shell-file-name) | 1258 | "/bin/sh" |
| 1259 | nil `("-c" ,command)))) | 1259 | shell-file-name) |
| 1260 | (start-file-process-shell-command (downcase mode-name) | 1260 | nil `("-c" ,command)))) |
| 1261 | outbuf command)))) | 1261 | (start-file-process-shell-command (downcase mode-name) |
| 1262 | ;; Make the buffer's mode line show process state. | 1262 | outbuf command)))) |
| 1263 | ;; Make the buffer's mode line show process state. | ||
| 1264 | (setq mode-line-process | ||
| 1265 | (list (propertize ":%s" 'face 'compilation-warning))) | ||
| 1266 | (set-process-sentinel proc 'compilation-sentinel) | ||
| 1267 | (unless (eq mode t) | ||
| 1268 | ;; Keep the comint filter, since it's needed for proper handling | ||
| 1269 | ;; of the prompts. | ||
| 1270 | (set-process-filter proc 'compilation-filter)) | ||
| 1271 | ;; Use (point-max) here so that output comes in | ||
| 1272 | ;; after the initial text, | ||
| 1273 | ;; regardless of where the user sees point. | ||
| 1274 | (set-marker (process-mark proc) (point-max) outbuf) | ||
| 1275 | (when compilation-disable-input | ||
| 1276 | (condition-case nil | ||
| 1277 | (process-send-eof proc) | ||
| 1278 | ;; The process may have exited already. | ||
| 1279 | (error nil))) | ||
| 1280 | (setq compilation-in-progress | ||
| 1281 | (cons proc compilation-in-progress))) | ||
| 1282 | ;; No asynchronous processes available. | ||
| 1283 | (message "Executing `%s'..." command) | ||
| 1284 | ;; Fake modeline display as if `start-process' were run. | ||
| 1263 | (setq mode-line-process | 1285 | (setq mode-line-process |
| 1264 | (list (propertize ":%s" 'face 'compilation-warning))) | 1286 | (list (propertize ":run" 'face 'compilation-warning))) |
| 1265 | (set-process-sentinel proc 'compilation-sentinel) | 1287 | (force-mode-line-update) |
| 1266 | (unless (eq mode t) | 1288 | (sit-for 0) ; Force redisplay |
| 1267 | ;; Keep the comint filter, since it's needed for proper handling | 1289 | (save-excursion |
| 1268 | ;; of the prompts. | 1290 | ;; Insert the output at the end, after the initial text, |
| 1269 | (set-process-filter proc 'compilation-filter)) | 1291 | ;; regardless of where the user sees point. |
| 1270 | ;; Use (point-max) here so that output comes in | 1292 | (goto-char (point-max)) |
| 1271 | ;; after the initial text, | 1293 | (let* ((buffer-read-only nil) ; call-process needs to modify outbuf |
| 1272 | ;; regardless of where the user sees point. | 1294 | (status (call-process shell-file-name nil outbuf nil "-c" |
| 1273 | (set-marker (process-mark proc) (point-max) outbuf) | 1295 | command))) |
| 1274 | (when compilation-disable-input | 1296 | (cond ((numberp status) |
| 1275 | (condition-case nil | 1297 | (compilation-handle-exit |
| 1276 | (process-send-eof proc) | 1298 | 'exit status |
| 1277 | ;; The process may have exited already. | 1299 | (if (zerop status) |
| 1278 | (error nil))) | 1300 | "finished\n" |
| 1279 | (setq compilation-in-progress | 1301 | (format "exited abnormally with code %d\n" status)))) |
| 1280 | (cons proc compilation-in-progress)))) | 1302 | ((stringp status) |
| 1303 | (compilation-handle-exit 'signal status | ||
| 1304 | (concat status "\n"))) | ||
| 1305 | (t | ||
| 1306 | (compilation-handle-exit 'bizarre status status))))) | ||
| 1307 | ;; Without async subprocesses, the buffer is not yet | ||
| 1308 | ;; fontified, so fontify it now. | ||
| 1309 | (let ((font-lock-verbose nil)) ; shut up font-lock messages | ||
| 1310 | (font-lock-fontify-buffer)) | ||
| 1311 | (set-buffer-modified-p nil) | ||
| 1312 | (message "Executing `%s'...done" command))) | ||
| 1281 | ;; Now finally cd to where the shell started make/grep/... | 1313 | ;; Now finally cd to where the shell started make/grep/... |
| 1282 | (setq default-directory thisdir) | 1314 | (setq default-directory thisdir) |
| 1283 | ;; The following form selected outwin ever since revision 1.183, | 1315 | ;; The following form selected outwin ever since revision 1.183, |