summaryrefslogtreecommitdiff
path: root/lisp/ob-scala.el
diff options
context:
space:
mode:
authorSebastien Delafond <seb@debian.org>2013-08-11 16:27:56 +0200
committerS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:27 +0200
commit53b246b7d66bfa03ab9bcf47d4647913b401e3d6 (patch)
treeb5ea4e732c2219456d13048feb05b37b22a76391 /lisp/ob-scala.el
parent8606e2621fc00fd8b334a06924aeef3aab7a2e4d (diff)
parente32a45ed36d6000db4b39171149072d11b77af72 (diff)
Imported Debian patch 8.0.7-1
Diffstat (limited to 'lisp/ob-scala.el')
-rw-r--r--lisp/ob-scala.el23
1 files changed, 14 insertions, 9 deletions
diff --git a/lisp/ob-scala.el b/lisp/ob-scala.el
index b5eb184..7cb3099 100644
--- a/lisp/ob-scala.el
+++ b/lisp/ob-scala.el
@@ -1,6 +1,6 @@
;;; ob-scala.el --- org-babel functions for Scala evaluation
-;; Copyright (C) 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2013 Free Software Foundation, Inc.
;; Author: Andrzej Lichnerowicz
;; Keywords: literate programming, reproducible research
@@ -31,17 +31,14 @@
;;; Code:
(require 'ob)
-(require 'ob-ref)
-(require 'ob-comint)
-(require 'ob-eval)
(eval-when-compile (require 'cl))
+(defvar org-babel-tangle-lang-exts) ;; Autoloaded
(add-to-list 'org-babel-tangle-lang-exts '("scala" . "scala"))
(defvar org-babel-default-header-args:scala '())
(defvar org-babel-scala-command "scala"
"Name of the command to use for executing Scala code.")
-
(defun org-babel-execute:scala (body params)
"Execute a block of Scala code with org-babel. This function is
called by `org-babel-execute-src-block'"
@@ -72,9 +69,17 @@ Emacs-lisp table, otherwise return the results as a string."
(defvar org-babel-scala-wrapper-method
- "(
+
+"var str_result :String = null;
+
+Console.withOut(new java.io.OutputStream() {def write(b: Int){
+}}) {
+ str_result = {
%s
-) asString print
+ }.toString
+}
+
+print(str_result)
")
@@ -96,8 +101,8 @@ in BODY as elisp."
(wrapper (format org-babel-scala-wrapper-method body)))
(with-temp-file src-file (insert wrapper))
((lambda (raw)
- (if (member "code" result-params)
- raw
+ (org-babel-result-cond result-params
+ raw
(org-babel-scala-table-or-string raw)))
(org-babel-eval
(concat org-babel-scala-command " " src-file) ""))))))