[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Open compilation window only on errors?
From: |
Jens Schmidt |
Subject: |
Re: Open compilation window only on errors? |
Date: |
29 Sep 2003 10:45:10 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 |
Matthew Calhoun <calhounm@mac.com> writes:
> When I compile using M-x compile, Emacs opens a new window for
> the compilation buffer when it's finished. This is great when
> there are warnings or errors, but when there aren't I would like
> to prevent Emacs from opening the new window, and instead maybe
> just put a message in the minibuffer indicating that compilation
> was successful. Is there a variable I can set for this, or does
> anyone have elisp code that does something similar?
The following does not exactly do what you want to do since the
window on M-x compile gets opened anyway. But you may do a C-x 1
to get rid of it and it will pop up again at end of compilation
if and only if compilation was unsuccessful.
I like the solution since you may both
- catch errors quickly that show up immediately and
- forget about long-running compilations regardless whether they
finish up successfully or not.
(defun check-compilation-result (buffer msg)
"Signal end of compilation.
Pops up a buffer with compilation results if necessary."
(ding)
(if (or (< (length msg) 8)
(not (equal (substring msg 0 8) "finished")))
(display-buffer buffer))
(message (concat "Compilation " (substring msg 0 -1))))
(setq compilation-finish-function 'check-compilation-result)
Jens