branch: externals/org
commit 7fa8173282f85c2ca03cc7f51f28f6adfb250610
Author: Ian Martins <[email protected]>
Commit: Ian Martins <[email protected]>
ob-java: Allow header to override commands
lisp/ob-java.el: Allow source block headers to override the java
compiler or runtime commands.
Currently the java compiler and runtime commands are customizable, but
cannot be overridden locally in source block hearders. ob-python
allows overriding the runtime command and I've found it to be useful.
This does the same for ob-java.
---
lisp/ob-java.el | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-java.el b/lisp/ob-java.el
index c9698bd..07ff8e9 100644
--- a/lisp/ob-java.el
+++ b/lisp/ob-java.el
@@ -164,7 +164,14 @@ replaced in this string.")
(defun org-babel-execute:java (body params)
"Execute a java source block with BODY code and PARAMS params."
- (let* (;; if true, run from babel temp directory
+ (let* (;; allow header overrides
+ (org-babel-java-compiler
+ (or (cdr (assq :javac params))
+ org-babel-java-compiler))
+ (org-babel-java-command
+ (or (cdr (assq :java params))
+ org-babel-java-command))
+ ;; if true, run from babel temp directory
(run-from-temp (not (alist-get :dir params)))
;; class and package
(fullclassname (or (cdr (assq :classname params))