At 07:56 PM 8/14/00 EDT, you wrote:
>>At 04:52 AM 8/14/00 -0400, Daniel Hegyi wrote:
>> >Hi,
>> >
>> >I'm trying to create a function that compiles *and* runs my java
>> >program. I've created a hook that executes another function at the end
>> >of a compilation.
>> >
>> >
>> >;; To be used as a hook at the end of a java compilation
>> >(defun end-of-java-compile (bufname msg)
>> >  "To be used as a hook at the end of a java compilation"
>> >  (if (not (eq (string-match "finished" msg) nil)
>>
>> >      (progn
>> >    (message "This works here.")
>> >    (jde-run)
>> >    )
>> >    )
>> >  )
>> >
>> >;; Set function to be called at end of java compilation
>> >(setq compilation-finish-function 'end-of-java-compile)
>> >
>> >
>> >
>> >The output at the end of the compilation is:
>> >
>> >This works here.
>> >error in process sentinel: Wrong type argument: stringp, nil [2 times]
>> >
>> >
>> >Does anybody have an idea what the problem might be?
>> >
>>
>>;; To be used as a hook at the end of a java compilation
>>(defun end-of-java-compile (bufname msg)
>>  "To be used as a hook at the end of a java compilation"
>>   (if (not (eq (string-match "finished" msg) nil)
>>                                         ^^^
>>If this is nil, string-match generates the error you are seeing.
>>
>>       (progn
>>      (message "This works here.")
>>      (jde-run)
>>      )
>>     )
>>   )
>>
>>You might want to use the new variable jde-compile-finish-hook for this
>>purpose.
>>
>>- Paul
>
>
>Hi Paul,
>
>Thanks for your quick response. Unfortunately, I'm a bit confused, namely, 
>"msg" doesn't seem to be nil. The following code shows this:
>
>
>
>;; To be used as a hook at the end of a java compilation
>(defun end-of-java-compile (bufname msg)
>"To be used as a hook at the end of a java compilation"
>  (if (not (eq (string-match "finished" msg) nil))
>      (progn
>       (message "This works here.")
>       (message msg)
>       (jde-run)
>       )
>    )
>  )
>
>
>The output:
>
>This works here.
>finished
>^^^^^^^^
>
>error in process sentinel: Wrong type argument: stringp, nil [2 times]
>
>
>It seems that the "messages" work fine, only "jde-run" doesn't want to run 
>for some reason.
>

The reason is that the process sentinal is running jde-run from the
compilation buffer but jde-run expects to be invoked from the source buffer.

- Paul

Reply via email to