unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Wait for compile to finish
@ 2005-10-20 13:07 Toto
  2005-10-20 16:31 ` Kevin Rodgers
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Toto @ 2005-10-20 13:07 UTC (permalink / raw)


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 ]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-10-24 10:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-20 13:07 Wait for compile to finish Toto
2005-10-20 16:31 ` Kevin Rodgers
2005-10-20 19:40   ` Eli Zaretskii
2005-10-21 15:43 ` William Xu
2005-10-21 21:18 ` Kevin Ryde
2005-10-22 16:07 ` Vagn Johansen
2005-10-24 10:22   ` Toto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).