diff options
| -rw-r--r-- | lisp/progmodes/compile.el | 97 |
1 files changed, 53 insertions, 44 deletions
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 016b31b0bf9..bc720859cdd 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el | |||
| @@ -68,6 +68,12 @@ describing how the process finished.") | |||
| 68 | "The buffer in which the last compilation was started, | 68 | "The buffer in which the last compilation was started, |
| 69 | or which was used by the last \\[next-error] or \\[compile-goto-error].") | 69 | or which was used by the last \\[next-error] or \\[compile-goto-error].") |
| 70 | 70 | ||
| 71 | (defvar compilation-in-progress nil | ||
| 72 | "List of compilation processes now running.") | ||
| 73 | (or (assq 'compilation-in-progress minor-mode-alist) | ||
| 74 | (setq minor-mode-alist (cons '(compilation-in-progress " Compiling") | ||
| 75 | minor-mode-alist))) | ||
| 76 | |||
| 71 | (defvar compilation-parsing-end nil | 77 | (defvar compilation-parsing-end nil |
| 72 | "Position of end of buffer when last error messages were parsed.") | 78 | "Position of end of buffer when last error messages were parsed.") |
| 73 | 79 | ||
| @@ -292,10 +298,11 @@ means the default). The defaults for these variables are the global values of | |||
| 292 | (window-height)))) | 298 | (window-height)))) |
| 293 | (select-window w)))) | 299 | (select-window w)))) |
| 294 | ;; Start the compilation. | 300 | ;; Start the compilation. |
| 295 | (set-process-sentinel (start-process-shell-command (downcase mode-name) | 301 | (let ((proc (start-process-shell-command (downcase mode-name) |
| 296 | outbuf | 302 | outbuf |
| 297 | command) | 303 | command))) |
| 298 | 'compilation-sentinel)) | 304 | (set-process-sentinel proc 'compilation-sentinel) |
| 305 | (setq compilation-in-progress (cons proc compilation-in-progress)))) | ||
| 299 | ;; Make it so the next C-x ` will use this buffer. | 306 | ;; Make it so the next C-x ` will use this buffer. |
| 300 | (setq compilation-last-buffer outbuf))) | 307 | (setq compilation-last-buffer outbuf))) |
| 301 | 308 | ||
| @@ -331,46 +338,48 @@ Runs `compilation-mode-hook' with `run-hooks' (which see)." | |||
| 331 | (defun compilation-sentinel (proc msg) | 338 | (defun compilation-sentinel (proc msg) |
| 332 | "Sentinel for compilation buffers." | 339 | "Sentinel for compilation buffers." |
| 333 | (let ((buffer (process-buffer proc))) | 340 | (let ((buffer (process-buffer proc))) |
| 334 | (cond ((null (buffer-name buffer)) | 341 | (if (memq (process-status proc) '(signal exit)) |
| 335 | ;; buffer killed | 342 | (progn |
| 336 | (set-process-buffer proc nil)) | 343 | (if (null (buffer-name buffer)) |
| 337 | ((memq (process-status proc) '(signal exit)) | 344 | ;; buffer killed |
| 338 | (let ((obuf (current-buffer)) | 345 | (set-process-buffer proc nil) |
| 339 | omax opoint) | 346 | (let ((obuf (current-buffer)) |
| 340 | ;; save-excursion isn't the right thing if | 347 | omax opoint) |
| 341 | ;; process-buffer is current-buffer | 348 | ;; save-excursion isn't the right thing if |
| 342 | (unwind-protect | 349 | ;; process-buffer is current-buffer |
| 343 | (progn | 350 | (unwind-protect |
| 344 | ;; Write something in the compilation buffer | 351 | (progn |
| 345 | ;; and hack its mode line. | 352 | ;; Write something in the compilation buffer |
| 346 | (set-buffer buffer) | 353 | ;; and hack its mode line. |
| 347 | (setq buffer-read-only nil) | 354 | (set-buffer buffer) |
| 348 | (setq omax (point-max) | 355 | (setq buffer-read-only nil) |
| 349 | opoint (point)) | 356 | (setq omax (point-max) |
| 350 | (goto-char omax) | 357 | opoint (point)) |
| 351 | ;; Record where we put the message, so we can ignore it | 358 | (goto-char omax) |
| 352 | ;; later on. | 359 | ;; Record where we put the message, so we can ignore it |
| 353 | (insert ?\n mode-name " " msg) | 360 | ;; later on. |
| 354 | (forward-char -1) | 361 | (insert ?\n mode-name " " msg) |
| 355 | (insert " at " (substring (current-time-string) 0 19)) | 362 | (forward-char -1) |
| 356 | (forward-char 1) | 363 | (insert " at " (substring (current-time-string) 0 19)) |
| 357 | (setq mode-line-process | 364 | (forward-char 1) |
| 358 | (concat ": " | 365 | (setq mode-line-process |
| 359 | (symbol-name (process-status proc)))) | 366 | (concat ": " |
| 360 | ;; Since the buffer and mode line will show that the | 367 | (symbol-name (process-status proc)))) |
| 361 | ;; process is dead, we can delete it now. Otherwise it | 368 | ;; Since the buffer and mode line will show that the |
| 362 | ;; will stay around until M-x list-processes. | 369 | ;; process is dead, we can delete it now. Otherwise it |
| 363 | (delete-process proc)) | 370 | ;; will stay around until M-x list-processes. |
| 364 | ;; Force mode line redisplay soon. | 371 | (delete-process proc) |
| 365 | (set-buffer-modified-p (buffer-modified-p)) | 372 | ;; Force mode line redisplay soon. |
| 366 | (setq buffer-read-only t)) | 373 | (set-buffer-modified-p (buffer-modified-p)) |
| 367 | (if (and opoint (< opoint omax)) | 374 | (setq buffer-read-only t) ;I think is this wrong --roland |
| 368 | (goto-char opoint)) | 375 | (if (and opoint (< opoint omax)) |
| 369 | (set-buffer obuf) | 376 | (goto-char opoint))) |
| 370 | (if compilation-finish-function | 377 | (set-buffer obuf)) |
| 371 | (funcall compilation-finish-function buffer msg)) | 378 | (if compilation-finish-function |
| 372 | )) | 379 | (funcall compilation-finish-function buffer msg)) |
| 373 | ))) | 380 | )) |
| 381 | (setq compilation-in-progress (delq proc compilation-in-progress)) | ||
| 382 | )))) | ||
| 374 | 383 | ||
| 375 | (defun kill-compilation () | 384 | (defun kill-compilation () |
| 376 | "Kill the process made by the \\[compile] command." | 385 | "Kill the process made by the \\[compile] command." |