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 20:29:29 +0000 (UTC) Organization: BT Openworld Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20040728212909.5bdfbad2@localhost> References: <20040724233448.3eab8cfa@localhost> <878yd766ol.fsf@osu.edu> <20040728022342.1a999383@localhost> <20040728023945.2d3d1697@localhost> <87y8l4b87o.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 1091046730 7314 80.91.224.253 (28 Jul 2004 20:32:10 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2004 20:32:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 22:32:02 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 1Bpv5l-0006jZ-00 for ; Wed, 28 Jul 2004 22:32:02 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bpv8v-0005ch-G0 for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2004 16:35:17 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!feed.news.tiscali.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.stueberl.de!news.cs.univ-paris8.fr!feeder.news.heanet.ie!zen.net.uk!demorgan.zen.co.uk!194.72.9.35.MISMATCH!news-peer1!btnet-feed5!btnet!news.btopenworld.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 42 Original-NNTP-Posting-Host: host217-42-154-36.range217-42.btcentralplus.com Original-X-Trace: sparta.btinternet.com 1091046569 19334 217.42.154.36 (28 Jul 2004 20:29:29 GMT) Original-X-Complaints-To: news-complaints@lists.btinternet.com Original-NNTP-Posting-Date: Wed, 28 Jul 2004 20:29:29 +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:124532 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:19867 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19867 Benjamin Rutt wrote: > Shug Boabie writes: > > >> 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? > > > > for the record, here is what i have been trying to do, but it is not > > working: > > > > (defun sam-compile (buf str) > > (when (string-match "*compilation.*" (buffer-name buf)) > > (if (string-match "exited abnormally" str) > > (progn > > (message "compilation errors, press C-x ` to view")) > > (if (string-match "warning:" str) > > (progn > > (message "compilation warnings, press C-x ` to view")) > > (run-at-time 0.5 nil 'delete-windows-on buf) > > (message "no compile errors or warnings"))))) > > This won't work because the `str' variable above only gets the last > line output by emacs during a compilation. It will either look like > "Compilation exited abnormally" or "Compilation finished". aah, i thought that might have been the case. cheers. > I suggest if you really want to treat warnings as errors, you can tell > your compiler to do so. Under gcc, you would pass the -Werror flag > during compilation. yeah... i've been doing that as a workaround, but it would be nice to be able to have it detect warnings. if this function were made more advanced... like parsing the whole output, it would allow warning detection AND also auto jump-to the first line of warnings/errors that the compile command produces. but thats an exercise for the more confident elisp user :-) thanks for the function... it basically does what i wanted :-)