From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xu Weijiang Newsgroups: gmane.emacs.help Subject: Re: code for closing compilation buffers Date: Mon, 16 Jul 2007 09:34:42 +0800 Organization: Bentium Ltd. (CN99) Message-ID: References: <87fy3v58y5.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1184596055 17201 80.91.229.12 (16 Jul 2007 14:27:35 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Jul 2007 14:27:35 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 16 16:27:34 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IARXx-00040e-DO for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 16:27:34 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IARXp-00007a-Vs for geh-help-gnu-emacs@m.gmane.org; Mon, 16 Jul 2007 10:27:26 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.cn99.com!news.yaako.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 27 Original-NNTP-Posting-Host: 218.22.21.22 Original-X-Trace: news.yaako.com 1184549681 5385 218.22.21.22 (16 Jul 2007 01:34:41 GMT) Original-X-Complaints-To: usenet@news.yaako.com Original-NNTP-Posting-Date: Mon, 16 Jul 2007 01:34:41 +0000 (UTC) User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt) Cancel-Lock: sha1:j0f9J+TJnSNs2cQYVjiARWVGBhw= Original-Xref: shelby.stanford.edu gnu.emacs.help:150112 X-Mailman-Approved-At: Mon, 16 Jul 2007 10:27:10 -0400 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: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:45719 Archived-At: Hadron writes: > I googled up some code and then modified it to use the more recent > compilation-finish-functions hook. > > Could someone take a peek that I did the "if then else" part right. > > If errors then jump to first error, else close the window. It *works* I > would just be grateful if someone could comment on whether its done > right: > > > (add-hook 'compilation-finish-functions > (lambda (buf str) > (if (string-match "exited abnormally" str) > (next-error) > ;;no errors, make the compilation window go away in a few seconds > (run-at-time "2 sec" nil 'delete-windows-on (get-buffer-create "*compilation*")) > (message "No Compilation Errors!") > ) > )) It works great, Thanks. Best regards Xu Weijiang -- everything has its rules!