Re: flymake integration for the eclipse java compiler

"Suraj Acharya" <[email protected]> Wed, 25 Apr 2007 18:20:33 -0700
Newsgroups gmane.emacs.jdee
Message-ID <[email protected]>
On 4/25/07, Jason Coffin <[email protected]> wrote:
> On 4/25/07, Suraj Acharya <[email protected]> wrote:
> > It's supposed to pass jde-global-classpath to the compiler. Did that
> > not work automatically? What did you have to do to setup the
> > classpath.
>
> Hmm... it seems to do that when I use jde-ecj-server-flymake-init. I
> have a new problem now, see below.
>
> > > I also noticed that using Windows Emacs 22.0.95.1 I can get flymake
> > > to work but only when using jde-ecj-flymake-init not when using
> > > jde-ecj-server-flymake-init I'm not sure what is wrong, my beanshell
> > > environment seems to work fine. There are no error messages, flymake
> > > just won't highlight my syntax errors.
> >
> > Try setting flymake-log-level to 3, the output of the compile process
> > and other stuff should be logged to the *Messages* buffer. That should
> > give you some indication of what is going wrong.
>
> I did that and the eclipse compiler reports the error but it isn't
> being highlighted in my buffer this is the relevant output:
>
> file e:/work/LTY-P000039/backoffice/process/src/main/java/com/**myCompanyName**/backoffice/daemons/ISPSpamComplaintHandler.java,
> init=jde-ecj-server-flymake-init
> server process 1772 "exited" with output c:\Documents and
> Settings\jcoffin\Local
> Settings\Temp\-18539309\ISPSpamComplaintHandler.java:1: error: Syntax
> error on token "dpackage", package expected
>         dpackage com.upromise.backoffice.daemons;
>         ^^^^^^^^
> 1 problem (1 error)
> bsh %
> cleaning up using jde-ecj-flymake-cleanup
> deleted file c:/DOCUME~1/jcoffin/LOCALS~1/Temp/-18539309/ISPSpamComplaintHandler.java
> ISPSpamComplaintHandler.java: 0 error(s), 0 warning(s) in 0.72
> second(s) [2 times]
>

Ah, this looks like a familiar problem. Process output buffering
behaves slightly differently on windows machines. Does this help?

(defun jde-ecj-flymake-process-filter (process output)
  "Parse OUTPUT and highlight error lines.
It is the flymake process filter. It is also responsible for
calling `jde-ecj-flymake-server-process-end' if the process is a server
process and the output contains the end of output marker
`flymake-process-server-end-marker'."
  (let ((source-buffer (process-buffer process)))
    (flymake-log 3 "received %d byte(s) of output from process %d"
                 (length output) (process-id process))
    (flymake-log 3 "output : %s" output)
    (when source-buffer
      (with-current-buffer source-buffer
        (flymake-parse-output-and-residual output))))
  (if (and flymake-process-server-end-marker (string-match
flymake-process-server-end-marker output))
      (jde-ecj-flymake-server-process-end process output)))