gnu-emacs-sources
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

wait for compilation process to be finished


From: dejfson
Subject: wait for compilation process to be finished
Date: Tue, 5 Aug 2008 14:52:40 -0700 (PDT)
User-agent: G2/1.0

Dear All,
I have sent this emacs to comp.emacs, however this group seems to me
more appropriate, so I give
it a try:

i'd like to call compile command from elisp. I need a function, which
exits when the compilation is finished. As compilation is asynchronous
process, it needs to be synchronized. I wrote then a hook which should
do the job, and called my compiling function:

this is a hook declaration:
----------------------------->
(setq cw-compile-flag t)
(add-hook 'compilation-finish-functions #'(lambda (buf str) (progn
(message "FOOKME") (setq cw-compile-flag nil))))

and this is a function call:
----------------------------->
(defun cw-compile-tags ()
  "Function compiles cw tags file. The filename is TAGS.cw and it is
stored in the project directory, which must
exist."
    ;; save the current buffer so it does not pop up with a question:
    (save-buffer)
    (setq cw-compile-flag t)
    (compile (concat "find " cw-project-directory " | egrep 'h$|hpp$'
| etags -D -l c++ --regex='/[ \t]*class[ \t]+[A-Za-z0-9_]*[ \t\n]*[:
{]/' -o " cw-project-directory "TAGS.cw -"))

    ;; as compilation is asynchronous, we need to wait until the
compilation is finished:
    (while cw-compile-flag (sleep-for 0 100))
)

and now you run it:
--------------------------->
(cw-compile-tags)

.................... and it hangs on wait loop there. From unknown
reasons the compilation process does not
start, *compilation* buffer is not opened, thus cw-compile-flag is
always true what makes the loop infinite.

When I run it without the while loop, everything works fine.
How can I assure that compilation is started, and finished? I'd like
to return from my function at the moment when the stuff is compiled.

Any help appreciated.
d.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]