Skip to content
Browse files

Allow jar files to be in a users home directory

Signed-off-by: Aemon Cannon <aemoncannon@gmail.com>
  • Loading branch information...
1 parent 233e273 commit f418b663db98f75ffd442def4fe7abeef9e1a0c6 Dru Nelson committed with
Showing with 25 additions and 1 deletion.
  1. +25 −1 flyparse-mode.el
View
26 flyparse-mode.el
@@ -91,6 +91,16 @@
"Shell command called to parse this buffer.")
(make-variable-buffer-local 'flyparse-parse-cmd)
+(defvar flyparse-java-lib-dir
+ (expand-file-name "~/emacs/flyparse-mode/lib/")
+ "Directory with necessary java jar files.")
+(make-variable-buffer-local 'flyparse-java-lib-dir)
+
+(defvar flyparse-java-jars
+ `("flyparse-parsers.jar" "antlr-runtime-3.1.jar")
+ "Jars used by flyparse.")
+(make-variable-buffer-local 'flyparse-java-jars)
+
(defvar flyparse-file-type-commands
`(("\.as$" . ("java" "emacs.flyparse.as3.AS3Driver"))
("\.css$" . ("java" "emacs.flyparse.css.CSSDriver"))
@@ -539,7 +549,7 @@
(let* ((parser-cmd (or flyparse-parse-cmd
(flyparse-cmd-for-file-type buffer-file-name)))
(cmd (first parser-cmd))
- (args (rest parser-cmd)))
+ (args (append (flyparse-java-lib-cmd-line) (rest parser-cmd))))
(flyparse-create-temp-buffer-copy)
(condition-case err
(let ((proc (flyparse-create-parse-process
@@ -565,8 +575,22 @@
(defun flyparse-create-parse-process (cmd args)
"Start parse process. Return the emacs process object."
+ (flyparse-log 3 "parse process cmd: %s with args: %s." cmd args)
(apply 'start-process "*flyparse-proc*" (current-buffer) cmd args))
+(defun flyparse-java-separator ()
+ "Return the string used as a java jar separator."
+ (if (memq system-type '(ms-dos windows-nt cygwin))
+ ";"
+ ":"))
+
+(defun flyparse-java-lib-cmd-line ()
+ "Generate command line args for java process."
+ (list "-classpath"
+ (mapconcat (lambda (x) (concat flyparse-java-lib-dir x))
+ flyparse-java-jars
+ (flyparse-java-separator))))
+
(defun flyparse-process-filter (process output)
"STDOUT of parser is already redirected to a file,
so we'll only be receiving STDERR here..."

0 comments on commit f418b66

Please sign in to comment.
Something went wrong with that request. Please try again.