unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jens Schmidt <Jens.Schmidt27@epost.de>
Subject: Re: Open compilation window only on errors?
Date: 29 Sep 2003 10:45:10 +0100	[thread overview]
Message-ID: <uvfrcylll.fsf@undis.closed> (raw)
In-Reply-To: mailman.813.1064689050.21628.help-gnu-emacs@gnu.org

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

       reply	other threads:[~2003-09-29  9:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.813.1064689050.21628.help-gnu-emacs@gnu.org>
2003-09-29  9:45 ` Jens Schmidt [this message]
2003-10-13  8:05   ` Open compilation window only on errors? Matthew Calhoun
2003-09-29 14:45 ` François Fleuret
2003-09-29 22:10 ` Kevin Rodgers
     [not found] <mailman.1571.1066032399.21628.help-gnu-emacs@gnu.org>
2003-10-13 17:24 ` Kevin Rodgers
2003-09-27 18:57 Matthew Calhoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=uvfrcylll.fsf@undis.closed \
    --to=jens.schmidt27@epost.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).