From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Benjamin Rutt Newsgroups: gmane.emacs.help Subject: Re: compiling in C mode and the compilation buffer Date: Sun, 25 Jul 2004 18:52:26 -0400 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <878yd766ol.fsf@osu.edu> References: <20040724233448.3eab8cfa@localhost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1090796252 18249 80.91.224.253 (25 Jul 2004 22:57:32 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 25 Jul 2004 22:57:32 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 26 00:57:22 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 1Borvm-0000zh-00 for ; Mon, 26 Jul 2004 00:57:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Borym-000765-68 for geh-help-gnu-emacs@m.gmane.org; Sun, 25 Jul 2004 19:00:28 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!feed.news.tiscali.de!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 38 Original-X-Trace: news.uni-berlin.de cSyM2tnhENGiFmu5HdM7NAIXBVoanXI0eIo+DhJscGfu8JRXo= Mail-Copies-To: nobody User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:tJIoCeV/ctj0f7y46FaIA12bRlU= Original-Xref: shelby.stanford.edu gnu.emacs.help:124444 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:19780 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19780 Shug Boabie writes: > i like to compile my code from within Emacs as i have a Makefile setup. > however, upon compiling; even on a successful compile the compilation > buffer needs to be closed afterward. > > 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) ;; don't prompt (setq compilation-read-command nil) ;; close the window on successful compile (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) -- Benjamin Rutt