From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Shug Boabie Newsgroups: gmane.emacs.help Subject: Re: compiling in C mode and the compilation buffer Date: Wed, 28 Jul 2004 01:24:03 +0000 (UTC) Organization: BT Openworld Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20040728022342.1a999383@localhost> References: <20040724233448.3eab8cfa@localhost> <878yd766ol.fsf@osu.edu> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1090978028 16506 80.91.224.253 (28 Jul 2004 01:27:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2004 01:27:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 03:27:00 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BpdDg-0006oY-00 for ; Wed, 28 Jul 2004 03:27:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BpdGn-00022c-Ha for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Jul 2004 21:30:13 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshosting.com!nx01.iad01.newshosting.com!news-peer0-test!btnet-feed5!btnet!news.btopenworld.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-NNTP-Posting-Host: host217-42-154-36.range217-42.btcentralplus.com Original-X-Trace: sparta.btinternet.com 1090977843 11075 217.42.154.36 (28 Jul 2004 01:24:03 GMT) Original-X-Complaints-To: news-complaints@lists.btinternet.com Original-NNTP-Posting-Date: Wed, 28 Jul 2004 01:24:03 +0000 (UTC) X-Newsreader: Sylpheed-Claws 0.9.12 (GTK+ 1.2.10; powerpc-unknown-linux-gnu) Original-Xref: shelby.stanford.edu gnu.emacs.help:124513 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 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:19848 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19848 Benjamin Rutt wrote: > Shug Boabie writes: > > i was wondering; is there a way to have the compilation buffer close > > automatically if there are no warnings or errors? > > > > also, is there a way to run the compile command, without having to agree > > that `make -k` is the correct command each time? that extra 'enter' is just > > annoying. > > I would use the following for all of this: > > (require 'compile) > (setq compilation-read-command nil) > (defun my-compilation-finish-function-standard (buf str) > ;; avoid doing this for buffers created from M-x grep > (when (string-match "*compilation.*" (buffer-name buf)) > (if (string-match "exited abnormally" str) > ;;there were errors > (progn > (message "compilation errors, press C-x ` to visit")) > ;;no errors, make the compilation window go away > (run-at-time 0.5 nil 'delete-windows-on buf) > (message "NO COMPILATION ERRORS!")))) > (add-to-list 'compilation-finish-functions > 'my-compilation-finish-function-standard) excellent, however i would still like the window to remain open upon detection of warnings as well [in order to force me to write ISO C99 code :-)]. i use the compile command exclusively for C code, so a grep for "warning:" should be sufficient. however, my attempts to customise your function have failed. any further hints?