mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-06 11:55:48 +00:00
666ffc7e09
* lisp/org/ob-abc.el (org-babel-expand-body:abc): Use dolist. (org-babel-execute:abc): Fix regexp quoting. * lisp/org/ob-calc.el (org--var-syms): Rename from `var-syms'. * lisp/org/ob-lilypond.el (ly-compile-lilyfile): Remove redundant let-binding. * lisp/org/ob-table.el (sbe): Move debug declaration. * lisp/org/org-clock.el (org--msg-extra): Rename from `msg-extra'. * lisp/org/org.el (org-version): Avoid var name starting with _. (org-inhibit-startup, org-called-with-limited-levels) (org-link-search-inhibit-query, org-time-was-given) (org-end-time-was-given, org-def, org-defdecode, org-with-time): * lisp/org/org-colview.el (org-agenda-overriding-columns-format): * lisp/org/org-agenda.el (org-agenda-multi, org-depend-tag-blocked) (org-agenda-show-log-scoped): * lisp/org/ob-python.el (py-which-bufname, python-shell-buffer-name): * lisp/org/ob-haskell.el (org-export-copy-to-kill-ring): * lisp/org/ob-exp.el (org-link-search-inhibit-query): * lisp/org/ob-R.el (ess-eval-visibly-p): * lisp/org/ob-core.el (org-src-window-setup): Declare before use. (org-babel-expand-noweb-references): Remove unused `blocks-in-buffer'. * lisp/org/ox-odt.el (org-odt-hfy-face-to-css): * lisp/org/org-src.el (org-src-associate-babel-session, org-src-get-lang-mode): * lisp/org/org-bibtex.el (org-bibtex-get, org-bibtex-ask, org-bibtex) (org-bibtex-check): * lisp/org/ob-tangle.el (org-babel-tangle, org-babel-spec-to-string) (org-babel-tangle-single-block, org-babel-tangle-comment-links): * ob-table.el (sbe): * lisp/org/ob-sqlite.el (org-babel-sqlite-expand-vars): * lisp/org/ob-sql.el (org-babel-sql-expand-vars): * lisp/org/ob-shen.el (org-babel-execute:shen): * lisp/org/ob-sh.el (org-babel-execute:sh, org-babel-sh-evaluate): * lisp/org/ob-scala.el (org-babel-scala-evaluate): * lisp/org/ob-ruby.el (org-babel-ruby-table-or-string) (org-babel-ruby-evaluate): * ob-python.el (org-babel-python-table-or-string) (org-babel-python-evaluate-external-process) (org-babel-python-evaluate-session): * lisp/org/ob-picolisp.el (org-babel-execute:picolisp): * lisp/org/ob-perl.el (org-babel-perl-evaluate): * lisp/org/ob-maxima.el (org-babel-execute:maxima): * lisp/org/ob-lisp.el (org-babel-execute:lisp): * lisp/org/ob-java.el (org-babel-execute:java): * lisp/org/ob-io.el (org-babel-io-evaluate): * ob-haskell.el (org-babel-execute:haskell): * lisp/org/ob-fortran.el (org-babel-execute:fortran): * ob-exp.el (org-babel-exp-code): * lisp/org/ob-emacs-lisp.el (org-babel-execute:emacs-lisp): * lisp/org/ob-ditaa.el (org-babel-execute:ditaa): * ob-core.el (org-babel-execute-src-block, org-babel-sha1-hash) (org-babel-parse-header-arguments, org-babel-reassemble-table) (org-babel-goto-src-block-head, org-babel-mark-block) (org-babel-expand-noweb-references, org-babel-script-escape) (org-babel-process-file-name): * lisp/org/ob-clojure.el (org-babel-execute:clojure): * ob-calc.el (org-babel-execute:calc): * lisp/org/ob-awk.el (org-babel-execute:awk): * ob-abc.el (org-babel-execute:abc): * ob-R.el (org-babel-expand-body:R): * lisp/org/ob-C.el (org-babel-C-execute): Avoid deprecated ((lambda) ...).
76 lines
2.7 KiB
EmacsLisp
76 lines
2.7 KiB
EmacsLisp
;;; ob-java.el --- org-babel functions for java evaluation
|
|
|
|
;; Copyright (C) 2011-2013 Free Software Foundation, Inc.
|
|
|
|
;; Author: Eric Schulte
|
|
;; Keywords: literate programming, reproducible research
|
|
;; Homepage: http://orgmode.org
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
|
;; it under the terms of the GNU General Public License as published by
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
;; (at your option) any later version.
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
;; GNU General Public License for more details.
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
;;; Commentary:
|
|
|
|
;; Currently this only supports the external compilation and execution
|
|
;; of java code blocks (i.e., no session support).
|
|
|
|
;;; Code:
|
|
(require 'ob)
|
|
|
|
(defvar org-babel-tangle-lang-exts)
|
|
(add-to-list 'org-babel-tangle-lang-exts '("java" . "java"))
|
|
|
|
(defvar org-babel-java-command "java"
|
|
"Name of the java command.")
|
|
|
|
(defvar org-babel-java-compiler "javac"
|
|
"Name of the java compiler.")
|
|
|
|
(defun org-babel-execute:java (body params)
|
|
(let* ((classname (or (cdr (assoc :classname params))
|
|
(error
|
|
"Can't compile a java block without a classname")))
|
|
(packagename (file-name-directory classname))
|
|
(src-file (concat classname ".java"))
|
|
(cmpflag (or (cdr (assoc :cmpflag params)) ""))
|
|
(cmdline (or (cdr (assoc :cmdline params)) ""))
|
|
(full-body (org-babel-expand-body:generic body params))
|
|
(compile
|
|
(progn (with-temp-file src-file (insert full-body))
|
|
(org-babel-eval
|
|
(concat org-babel-java-compiler
|
|
" " cmpflag " " src-file) ""))))
|
|
;; created package-name directories if missing
|
|
(unless (or (not packagename) (file-exists-p packagename))
|
|
(make-directory packagename 'parents))
|
|
(let ((results (org-babel-eval (concat org-babel-java-command
|
|
" " cmdline " " classname) "")))
|
|
(org-babel-reassemble-table
|
|
(org-babel-result-cond (cdr (assoc :result-params params))
|
|
(org-babel-read results)
|
|
(let ((tmp-file (org-babel-temp-file "c-")))
|
|
(with-temp-file tmp-file (insert results))
|
|
(org-babel-import-elisp-from-file tmp-file)))
|
|
(org-babel-pick-name
|
|
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
|
|
(org-babel-pick-name
|
|
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params)))))))
|
|
|
|
(provide 'ob-java)
|
|
|
|
|
|
|
|
;;; ob-java.el ends here
|