Skip to content

Instantly share code, notes, and snippets.

@irq0
Created September 14, 2012 18:30
Show Gist options
  • Save irq0/3723779 to your computer and use it in GitHub Desktop.
Save irq0/3723779 to your computer and use it in GitHub Desktop.
emacs: java flymake, runtime syntax check with cedet
;; Dependencies: ecj (in MacPorts), ede project for the file, cedet development version (from bzr)
(require 'flymake)
(defvar flymake-java-version "1.6")
(defun flymake-java-ecj-init ()
(flymake-simple-make-init-impl
'flymake-create-temp-with-folder-structure nil nil
(file-name-nondirectory buffer-file-name)
'flymake-java-ecj-cmdline))
(defun flymake-java-ecj-cmdline (source base-dir)
(let* ((project (ede-current-project))
(classpath (append (ede-java-classpath project)
semanticdb-javap-classpath
(list (concat-path (oref project :directory) (first (oref project :srcroot)))))))
(list "ecj" (list "-Xemacs" "-d" "none"
"-source" flymake-java-version
"-target" flymake-java-version
"-classpath"
(combine-and-quote-strings classpath ":")
source))))
(push '(".+\\.java$" flymake-java-ecj-init) flymake-allowed-file-name-masks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment