From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: bago@ludens.elte.hu (Toto) Newsgroups: gmane.emacs.help Subject: Wait for compile to finish Date: 20 Oct 2005 15:07:54 +0200 Organization: Eotvos University, Budapest, Hungary Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1129817034 21835 80.91.229.2 (20 Oct 2005 14:03:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 20 Oct 2005 14:03:54 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Oct 20 16:03:41 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ESavB-0004kT-GS for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Oct 2005 15:57:29 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ESavA-0006L6-Nn for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Oct 2005 09:57:28 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.ems.psu.edu!news.cse.psu.edu!canoe.uoregon.edu!newshub.sdsu.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.iif.hu!NIIF!ludens.elte.hu!not-for-bago Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-Xref: shelby.stanford.edu gnu.emacs.help:134817 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: , 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:30402 Archived-At: Greetings! My problem is the following: I would like to have a function, which runs the program, that belongs to the buffer i'm editing or compile it first if it isn't done already. To make it more clear. Say, i'm editing helloworld.c and i call this function, it should execute helloworld.exe (yes, i'm on windows). If there is no hello.exe in the current directory (or it is older than the source file) emacs should compile it first and run it afterwards. For this purpose I have come up with a funcion similar to the one below. But: Compile is asynchronous, so this funcion tries to execute the exe file before the compilation finishes (and the exe is created). My question is: Is there a synchronous version of compile? Or how can i determine that compile has finished (and get the result of the compilation - success or failure)? The (pseudo) code is as follows: (defun run-compiled-program (params) "Runs the program with the same name as the buffer." (interactive "sRun with parameter(s): ") (setq exe (concat (file-name-sans-extension (buffer-file-name)) ".exe" ) ) (if (not (file-newer-than-file-p exe (buffer-file-name))) (compile-this-buffer) ;; using the compile funcion ) (shell-command (concat exe " " params) ) ) ;; GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600) of 2005-03-08 on S8472 Any suggestions are welcome. Ps.: my english might not be the best ;) -- [ Toto ]