Rodrigo Coutinho Correia writes:
 > 
 > hello,
 > 
 > i'm trying to use jde within emacs lisp, i want to call
 > (jde-compile) in a temp buffer and then after that, call
 > (bsh-eval ...) to reload this last compiled class...
 > 

Why do you want to do this?

 > the thing is that without (bsh-eval ...) everything goes
 > smoothly but when i insert (bsh-eval ...) things don't work!
 > i try to put (message ...) inside all functions that are
 > called with hook jde-compile-finish-hook and them doesn't seem
 > to be called... i'm guessing that (jde-compile) is not
 > synchronous or something and (bsh-eval ...) is called
 > before the real computation inside (jde-compile) is done!
 > (i'm thinkig that there is a problem with the process filters
 >  they change inside the jde-compile and things gets messed up
 >  when i call (bsh-eval ...) after (jde-compile))
 > 
 > 
 > but when i added (bsh-eval ...) inside the jde-compile-finish-hook
 > with (add-hook 'jde-compile-finish-hook '(lambda (buf msg)
 >                                             (bsh-eval ...))
 > things seem to work... but i didn't want things like this
 > because this changes for all .java files and i want only for
 > the current .java temp file
 > 
 > 
 > 
 > why can something like
 > 
 > (progn
 >   (jde-compile)
 >   (bsh-eval (concat "reloadClasses(\""
 >                     java-temp-file-name
 >                     "\");")))
 > 
 > work?
 > 

Hi Rogrigo,

This is probable a timing problem. jde-compile sets its own bsh
response filter and then sends a compilation message to the bsh. It
then returns. It expects its own filter to remain in effect until the
compiler responds.  Ordinarily this would be the case but in your case
you invoke bsh-eval immediately after jde-compile returns. This
reinstalls the standard bsh-eval filter before the compiler has a
chance to respond, thus short-circuiting the compile-finish hook
processing.

I think the only reliable way to work around this problem is to do
everything that depends on the compilation having finished, including
a bsh-eval, in a jde-compile-finish-hook function. If you don't want
your hook function to apply to every compilation, it could include a
test for the specific cases that you do want it to handle, e.g., you
could use a global flag variable, set the global variable before you
call jde-compile and have your compile-finish hook function test the
variable before it does anything.


- Paul

Reply via email to