From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Jens Schmidt Newsgroups: gmane.emacs.help Subject: Re: Open compilation window only on errors? Date: 29 Sep 2003 10:45:10 +0100 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1064826217 1325 80.91.224.253 (29 Sep 2003 09:03:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2003 09:03:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 29 11:03:34 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1A3twL-0005bt-00 for ; Mon, 29 Sep 2003 11:03:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.22) id 1A3ttf-0005q7-LJ for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2003 05:00:47 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!news.sanjose1.Level3.net!Level3.net!news.oracle.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Original-NNTP-Posting-Host: 140.84.186.193 Original-X-Trace: news.oracle.com 1064825692 140.84.186.193 (Mon, 29 Sep 2003 01:54:52 PDT) Original-NNTP-Posting-Date: Mon, 29 Sep 2003 01:54:52 PDT Original-Xref: shelby.stanford.edu gnu.emacs.help:116933 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:12859 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:12859 Matthew Calhoun 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