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: Wed, 28 Jul 2004 08:57:15 -0400 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87y8l4b87o.fsf@osu.edu> References: <20040724233448.3eab8cfa@localhost> <878yd766ol.fsf@osu.edu> <20040728022342.1a999383@localhost> <20040728023945.2d3d1697@localhost> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1091019729 31700 80.91.224.253 (28 Jul 2004 13:02:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2004 13:02:09 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 15:02: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 1Bpo4H-0000KS-00 for ; Wed, 28 Jul 2004 15:02:01 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Bpo7P-0007Yc-RJ for geh-help-gnu-emacs@m.gmane.org; Wed, 28 Jul 2004 09:05:16 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 34 Original-X-Trace: news.uni-berlin.de dS9a0dMLqfKaOTT828ks7gboR/J4kzTX0UPfA3jJpslwqBsZ0= Mail-Copies-To: nobody User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) Cancel-Lock: sha1:GaV82HBq/UC0mkJqjz/YbKADzNI= Original-Xref: shelby.stanford.edu gnu.emacs.help:124518 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:19853 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:19853 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". 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. Note, also, that even during successful compilation, you can still do C-x ` to take you to any warnings that may have occured. -- Benjamin Rutt