org-mode/lisp/ob-clojure.el

319 lines
12 KiB
EmacsLisp
Raw Normal View History

;;; ob-clojure.el --- org-babel functions for clojure evaluation
;; Copyright (C) 2009, 2010 Free Software Foundation, Inc.
;; Author: Joel Boehland
;; Keywords: literate programming, reproducible research
;; Homepage: http://orgmode.org
2010-10-29 03:11:46 -04:00
;; Version: 7.02trans
;; 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:
;;; ob support for evaluating clojure code
;;; Requirements:
;;; A working clojure install. This also implies a working java executable
;;; clojure-mode
;;; slime
;;; swank-clojure
;;; By far, the best way to install these components is by following
;;; the directions as set out by Phil Hagelberg (Technomancy) on the
;;; web page: http://technomancy.us/126
;;; Code:
(require 'ob)
2010-07-04 17:46:13 -04:00
(require 'ob-eval)
(eval-when-compile (require 'cl))
2010-07-04 11:24:08 -04:00
(declare-function slime-eval-async "ext:slime" (sexp &optional cont package))
(declare-function slime-eval "ext:slime" (sexp &optional package))
(declare-function swank-clojure-concat-paths "ext:slime" (paths))
(declare-function slime "ext:slime" (&optional command coding-system))
(declare-function slime-output-buffer "ext:slime" (&optional noprompt))
(declare-function slime-filter-buffers "ext:slime" (predicate))
(add-to-list 'org-babel-tangle-lang-exts '("clojure" . "clj"))
(defvar org-babel-default-header-args:clojure '())
(defvar org-babel-clojure-wrapper-method
"
(defn spit
[f content]
(with-open [#^java.io.PrintWriter w
(java.io.PrintWriter.
(java.io.BufferedWriter.
(java.io.OutputStreamWriter.
(java.io.FileOutputStream.
(java.io.File. f)))))]
(.print w content)))
(defn main
[]
%s)
2010-07-04 17:01:30 -04:00
(spit \"%s\" (str (main)))")
;;";; <-- syntax highlighting is messed without this double quote
;;taken mostly from clojure-test-mode.el
(defun org-babel-clojure-clojure-slime-eval (string &optional handler)
"Evaluate a STRING of clojure code using `slime-eval-async'."
(slime-eval-async `(swank:eval-and-grab-output ,string)
(or handler #'identity)))
2009-11-10 00:44:13 -05:00
(defun org-babel-clojure-slime-eval-sync (string)
"Evaluate a STRING of clojure code using `slime-eval'."
(slime-eval `(swank:eval-and-grab-output ,string)))
;;taken from swank-clojure.el
(defvar swank-clojure-binary)
(defvar swank-clojure-classpath)
(defvar swank-clojure-java-path)
(defvar swank-clojure-extra-vm-args)
(defvar swank-clojure-library-paths)
(defvar swank-clojure-extra-classpaths)
(defun org-babel-clojure-babel-clojure-cmd ()
"Create the command to start clojure according to current settings."
(or (when swank-clojure-binary
(if (listp swank-clojure-binary)
swank-clojure-binary
(list swank-clojure-binary)))
(when swank-clojure-classpath
(delq
nil
(append
(list swank-clojure-java-path)
swank-clojure-extra-vm-args
(list
(when swank-clojure-library-paths
(concat "-Djava.library.path="
(swank-clojure-concat-paths swank-clojure-library-paths)))
"-classpath"
(swank-clojure-concat-paths
(append
swank-clojure-classpath
swank-clojure-extra-classpaths))
"clojure.main"))))
(error "%s" (concat "You must specifiy either a `swank-clojure-binary' "
"or a `swank-clojure-classpath'"))))
(defun org-babel-clojure-table-or-string (results)
"Convert RESULTS to an elisp value.
If RESULTS looks like a table, then convert to an Emacs-lisp
table, otherwise return the results as a string."
(org-babel-read
(if (string-match "^\\[.+\\]$" results)
(org-babel-read
(concat "'"
(replace-regexp-in-string
"\\[" "(" (replace-regexp-in-string
"\\]" ")" (replace-regexp-in-string
", " " " (replace-regexp-in-string
"'" "\"" results))))))
results)))
(defun org-babel-clojure-var-to-clojure (var)
"Convert an elisp value into a clojure variable.
The elisp value VAR is converted into a string of clojure source
code specifying a variable of the same value."
(if (listp var)
(format "'%s" var)
(format "%S" var)))
(defun org-babel-clojure-build-full-form (body vars)
"Construct a clojure let form with VARS as the let variables."
2010-07-04 17:01:30 -04:00
(let ((vars-forms
(mapconcat ;; define any variables
(lambda (pair)
(format "%s %s"
(car pair) (org-babel-clojure-var-to-clojure (cdr pair))))
vars "\n "))
(body (org-babel-trim body)))
2010-07-04 17:01:30 -04:00
(if (> (length vars-forms) 0)
(format "(let [%s]\n %s)" vars-forms body)
body)))
(defun org-babel-prep-session:clojure (session params)
"Prepare SESSION according to the header arguments specified in PARAMS."
(require 'slime) (require 'swank-clojure)
(let* ((session-buf (org-babel-clojure-initiate-session session))
(vars (mapcar #'cdr (org-babel-get-header params :var)))
(var-lines (mapcar ;; define any top level session variables
(lambda (pair)
2009-12-30 18:55:00 -05:00
(format "(def %s %s)\n" (car pair)
(org-babel-clojure-var-to-clojure (cdr pair))))
vars)))
session-buf))
(defun org-babel-load-session:clojure (session body params)
"Load BODY into SESSION."
(require 'slime) (require 'swank-clojure)
(save-window-excursion
(let ((buffer (org-babel-prep-session:clojure session params)))
(with-current-buffer buffer
(goto-char (point-max))
(insert (org-babel-chomp body)))
buffer)))
2009-12-30 18:55:00 -05:00
(defvar org-babel-clojure-buffers '())
(defvar org-babel-clojure-pending-sessions '())
(defun org-babel-clojure-session-buffer (session)
"Return the buffer associated with SESSION."
2009-12-30 18:55:00 -05:00
(cdr (assoc session org-babel-clojure-buffers)))
(defun org-babel-clojure-initiate-session-by-key (&optional session)
"Initiate a clojure session in an inferior-process-buffer.
If there is not a current inferior-process-buffer in SESSION
then create one. Return the initialized session."
2009-12-30 18:55:00 -05:00
(save-window-excursion
(let* ((session (if session
(if (stringp session) (intern session)
session)
2010-07-04 17:01:30 -04:00
:default))
2009-12-30 18:55:00 -05:00
(clojure-buffer (org-babel-clojure-session-buffer session)))
(unless (and clojure-buffer (buffer-live-p clojure-buffer))
2010-07-04 17:01:30 -04:00
(setq org-babel-clojure-buffers
(assq-delete-all session org-babel-clojure-buffers))
2009-12-30 18:55:00 -05:00
(push session org-babel-clojure-pending-sessions)
(slime)
;; we are waiting to finish setting up which will be done in
;; org-babel-clojure-session-connected-hook below.
(let ((timeout 9))
(while (and (not (org-babel-clojure-session-buffer session))
(< 0 timeout))
2010-07-04 17:01:30 -04:00
(message "Waiting for clojure repl for session: %s ... %i"
session timeout)
2009-12-30 18:55:00 -05:00
(sit-for 1)
(decf timeout)))
(setq org-babel-clojure-pending-sessions
(remove session org-babel-clojure-pending-sessions))
(unless (org-babel-clojure-session-buffer session)
(error "Couldn't create slime clojure process"))
(setq clojure-buffer (org-babel-clojure-session-buffer session)))
session)))
(defun org-babel-clojure-initiate-session (&optional session params)
"Return the slime-clojure repl buffer bound to SESSION.
Returns nil if \"none\" is specified."
(require 'slime) (require 'swank-clojure)
2009-12-30 18:55:00 -05:00
(unless (and (stringp session) (string= session "none"))
2010-07-04 17:01:30 -04:00
(org-babel-clojure-session-buffer
(org-babel-clojure-initiate-session-by-key session))))
2009-12-30 18:55:00 -05:00
(defun org-babel-clojure-session-connected-hook ()
"Finish binding an org-babel session to a slime-clojure repl."
2009-12-30 18:55:00 -05:00
(let ((pending-session (pop org-babel-clojure-pending-sessions)))
(when pending-session
(save-excursion
(switch-to-buffer (slime-output-buffer))
2010-07-04 17:01:30 -04:00
(rename-buffer
(if (stringp pending-session)
pending-session (symbol-name pending-session)))
(org-babel-clojure-bind-session-to-repl-buffer
pending-session (slime-output-buffer))))))
2009-12-30 18:55:00 -05:00
(add-hook 'slime-connected-hook 'org-babel-clojure-session-connected-hook)
(defun org-babel-clojure-bind-session-to-repl-buffer (session repl-buffer)
"Associate SESSION with REPL-BUFFER."
2009-12-30 18:55:00 -05:00
(when (stringp session) (setq session (intern session)))
(setq org-babel-clojure-buffers
(cons (cons session repl-buffer)
(assq-delete-all session org-babel-clojure-buffers))))
(defun org-babel-clojure-repl-buffer-pred ()
"Test whether the current buffer is an active slime-clojure
repl buffer."
2009-12-30 18:55:00 -05:00
(and (buffer-live-p (current-buffer)) (eq major-mode 'slime-repl-mode)))
(defun org-babel-clojure-bind-session-to-repl (session)
"Bind SESSION to a clojure repl."
2009-12-30 18:55:00 -05:00
(interactive "sEnter session name: ")
(let ((repl-bufs (slime-filter-buffers 'org-babel-clojure-repl-buffer-pred)))
(unless repl-bufs (error "No existing slime-clojure repl buffers exist"))
(let ((repl-buf (read-buffer "Choose slime-clojure repl: " repl-bufs t)))
(org-babel-clojure-bind-session-to-repl-buffer session repl-buf))))
2010-07-04 17:01:30 -04:00
(defun org-babel-clojure-evaluate-external-process
(buffer body &optional result-type)
"Evaluate the body in an external process."
2010-07-04 17:01:30 -04:00
(let ((cmd (format "%s -" (mapconcat #'identity
(org-babel-clojure-babel-clojure-cmd)
" "))))
(case result-type
(output (org-babel-eval cmd body))
(value (let* ((tmp-file (org-babel-temp-file "clojure-")))
babel: New function to process file names for use in external processes * ob.el (org-babel-process-file-name): New function (org-babel-maybe-remote-file): Delete function * ob-sql.el (org-babel-execute:sql): Use org-babel-process-file-name * ob-scheme.el (org-babel-execute:scheme): Use org-babel-process-file-name * ob-sass.el (org-babel-execute:sass): Use org-babel-process-file-name * ob-ruby.el (org-babel-ruby-evaluate): Use org-babel-process-file-name * ob-python.el (org-babel-python-evaluate-external-process): Use org-babel-process-file-name (org-babel-python-evaluate-session): Use org-babel-process-file-name * ob-plantuml.el (org-babel-execute:plantuml): Use org-babel-process-file-name * ob-perl.el (org-babel-perl-evaluate): Use org-babel-process-file-name * ob-octave.el (org-babel-octave-evaluate-external-process): Use org-babel-process-file-name (org-babel-octave-evaluate-session): Use org-babel-process-file-name, don't use org-babel-maybe-remote-file * ob-lisp.el (org-babel-execute:lisp): Use org-babel-process-file-name * ob-ledger.el (org-babel-execute:ledger): Use org-babel-process-file-name * ob-js.el (org-babel-execute:js): Use org-babel-process-file-name * ob-haskell.el (org-babel-haskell-export-to-lhs): Use org-babel-process-file-name * ob-gnuplot.el (org-babel-execute:gnuplot): Use org-babel-process-file-name * ob-eval.el (org-babel-eval-read-file): Don't use org-babel-maybe-remote-file * ob-dot.el (org-babel-execute:dot): Use org-babel-process-file-name * ob-ditaa.el (org-babel-execute:ditaa): Use org-babel-process-file-name * ob-clojure.el (org-babel-clojure-evaluate-external-process): Use org-babel-process-file-name * ob-asymptote.el (org-babel-execute:asymptote): Use org-babel-process-file-name * ob-R.el (org-babel-R-assign-elisp): Don't use org-babel-maybe-remote-file, use org-babel-process-file-name (org-babel-R-evaluate-external-process): Use org-babel-process-file-name (org-babel-R-evaluate-session): Use org-babel-process-file-name * ob-C.el (org-babel-C-execute): Use org-babel-process-file-name In addition to passing the file path through `expand-file-name', tramp-style remote file names are converted to conventional (local) file paths. The reason is that, if a tramp file name was in use in emacs, then the shell command will be executing on the remote machine in question. Further, by default the file name is passed through `shell-quote-argument'.
2010-09-22 16:40:14 -04:00
(org-babel-eval
cmd
(format
org-babel-clojure-wrapper-method
body
(org-babel-process-file-name tmp-file 'noquote)))
2010-07-04 17:01:30 -04:00
(org-babel-clojure-table-or-string
(org-babel-eval-read-file tmp-file)))))))
(defun org-babel-clojure-evaluate-session (buffer body &optional result-type)
"Evaluate the body in the context of a clojure session."
2010-07-04 17:01:30 -04:00
(require 'slime) (require 'swank-clojure)
(let ((raw nil)
(results nil))
(with-current-buffer buffer
2009-12-30 18:55:00 -05:00
(setq raw (org-babel-clojure-slime-eval-sync body))
(setq results (reverse (mapcar #'org-babel-trim raw)))
(cond
((equal result-type 'output)
(mapconcat #'identity (reverse (cdr results)) "\n"))
((equal result-type 'value)
(org-babel-clojure-table-or-string (car results)))))))
(defun org-babel-clojure-evaluate (buffer body &optional result-type)
"Pass BODY to the Clojure process in BUFFER.
If RESULT-TYPE equals 'output then return a list of the outputs
of the statements in BODY, if RESULT-TYPE equals 'value then
return the value of the last statement in BODY as elisp."
(if buffer
(org-babel-clojure-evaluate-session buffer body result-type)
(org-babel-clojure-evaluate-external-process buffer body result-type)))
removing obsoleted optional third argument from org-babel-expand-body:LANG * lisp/ob-C.el (org-babel-expand-body:c++): removing obsoleted optional third argument (org-babel-expand-body:c++): removing obsoleted optional third argument (org-babel-C-expand): removing obsoleted optional third argument * lisp/ob-R.el: (org-babel-expand-body:R): removing obsoleted optional third argument (org-babel-execute:R): removing obsoleted optional third argument (org-babel-R-variable-assignments): removing obsoleted optional third argument * lisp/ob-asymptote.el: (org-babel-expand-body:asymptote): removing obsoleted optional third argument (org-babel-execute:asymptote): removing obsoleted optional third argument * lisp/ob-clojure.el: (org-babel-expand-body:clojure): removing obsoleted optional third argument (org-babel-execute:clojure): removing obsoleted optional third argument * lisp/ob-css.el: (org-babel-expand-body:css): removing obsoleted optional third argument * lisp/ob-ditaa.el: (org-babel-expand-body:ditaa): removing obsoleted optional third argument * lisp/ob-dot.el: (org-babel-expand-body:dot): removing obsoleted optional third argument (org-babel-execute:dot): removing obsoleted optional third argument * lisp/ob-emacs-lisp.el: (org-babel-expand-body:emacs-lisp): removing obsoleted optional third argument (org-babel-execute:emacs-lisp): removing obsoleted optional third argument * lisp/ob-gnuplot.el: (org-babel-expand-body:gnuplot): removing obsoleted optional third argument * lisp/ob-haskell.el: (org-babel-expand-body:haskell): removing obsoleted optional third argument (org-babel-execute:haskell): removing obsoleted optional third argument (org-babel-load-session:haskell): removing obsoleted optional third (org-babel-prep-session:haskell): removing obsoleted optional third * lisp/ob-js.el: (org-babel-expand-body:js): removing obsoleted optional third argument (org-babel-execute:js): removing obsoleted optional third argument * lisp/ob-latex.el: (org-babel-expand-body:latex): removing obsoleted optional third argument * lisp/ob-lisp.el: (org-babel-expand-body:lisp): removing obsoleted optional third argument (org-babel-execute:lisp): removing obsoleted optional third argument * lisp/ob-mscgen.el: (org-babel-expand-body:mscgen): removing obsoleted optional third argument * lisp/ob-ocaml.el: (org-babel-expand-body:ocaml): removing obsoleted optional third argument (org-babel-execute:ocaml): removing obsoleted optional third argument * lisp/ob-octave.el: (org-babel-expand-body:matlab): removing obsoleted optional third argument (org-babel-expand-body:octave): removing obsoleted optional third argument (org-babel-execute:octave): removing obsoleted optional third argument (org-babel-octave-variable-assignments): removing obsoleted optional third * lisp/ob-org.el: (org-babel-expand-body:org): removing obsoleted optional third argument * lisp/ob-perl.el: (org-babel-expand-body:perl): removing obsoleted optional third argument (org-babel-execute:perl): removing obsoleted optional third argument * lisp/ob-plantuml.el: (org-babel-expand-body:plantuml): removing obsoleted optional third argument * lisp/ob-python.el: (org-babel-expand-body:python): removing obsoleted optional third argument (org-babel-execute:python): removing obsoleted optional third argument (org-babel-python-variable-assignments): removing obsoleted optional third * lisp/ob-ruby.el: (org-babel-expand-body:ruby): removing obsoleted optional third argument (org-babel-execute:ruby): removing obsoleted optional third argument * lisp/ob-sass.el: (org-babel-expand-body:sass): removing obsoleted optional third argument * lisp/ob-scheme.el: (org-babel-expand-body:scheme): removing obsoleted optional third argument (org-babel-execute:scheme): removing obsoleted optional third argument * lisp/ob-screen.el: (org-babel-expand-body:screen): removing obsoleted optional third argument * lisp/ob-sh.el: (org-babel-expand-body:sh): removing obsoleted optional third argument (org-babel-execute:sh): removing obsoleted optional third argument (org-babel-sh-variable-assignments): removing obsoleted optional third * lisp/ob-sql.el: (org-babel-expand-body:sql): removing obsoleted optional third argument * lisp/ob-sqlite.el: (org-babel-expand-body:sqlite): removing obsoleted optional third argument (org-babel-execute:sqlite): removing obsoleted optional third argument * lisp/ob.el: (org-babel-expand-body:generic): removing obsoleted optional third argument
2010-10-15 23:35:45 -04:00
(defun org-babel-expand-body:clojure (body params)
"Expand BODY according to PARAMS, return the expanded body."
2010-04-11 16:29:24 -04:00
(org-babel-clojure-build-full-form
removing obsoleted optional third argument from org-babel-expand-body:LANG * lisp/ob-C.el (org-babel-expand-body:c++): removing obsoleted optional third argument (org-babel-expand-body:c++): removing obsoleted optional third argument (org-babel-C-expand): removing obsoleted optional third argument * lisp/ob-R.el: (org-babel-expand-body:R): removing obsoleted optional third argument (org-babel-execute:R): removing obsoleted optional third argument (org-babel-R-variable-assignments): removing obsoleted optional third argument * lisp/ob-asymptote.el: (org-babel-expand-body:asymptote): removing obsoleted optional third argument (org-babel-execute:asymptote): removing obsoleted optional third argument * lisp/ob-clojure.el: (org-babel-expand-body:clojure): removing obsoleted optional third argument (org-babel-execute:clojure): removing obsoleted optional third argument * lisp/ob-css.el: (org-babel-expand-body:css): removing obsoleted optional third argument * lisp/ob-ditaa.el: (org-babel-expand-body:ditaa): removing obsoleted optional third argument * lisp/ob-dot.el: (org-babel-expand-body:dot): removing obsoleted optional third argument (org-babel-execute:dot): removing obsoleted optional third argument * lisp/ob-emacs-lisp.el: (org-babel-expand-body:emacs-lisp): removing obsoleted optional third argument (org-babel-execute:emacs-lisp): removing obsoleted optional third argument * lisp/ob-gnuplot.el: (org-babel-expand-body:gnuplot): removing obsoleted optional third argument * lisp/ob-haskell.el: (org-babel-expand-body:haskell): removing obsoleted optional third argument (org-babel-execute:haskell): removing obsoleted optional third argument (org-babel-load-session:haskell): removing obsoleted optional third (org-babel-prep-session:haskell): removing obsoleted optional third * lisp/ob-js.el: (org-babel-expand-body:js): removing obsoleted optional third argument (org-babel-execute:js): removing obsoleted optional third argument * lisp/ob-latex.el: (org-babel-expand-body:latex): removing obsoleted optional third argument * lisp/ob-lisp.el: (org-babel-expand-body:lisp): removing obsoleted optional third argument (org-babel-execute:lisp): removing obsoleted optional third argument * lisp/ob-mscgen.el: (org-babel-expand-body:mscgen): removing obsoleted optional third argument * lisp/ob-ocaml.el: (org-babel-expand-body:ocaml): removing obsoleted optional third argument (org-babel-execute:ocaml): removing obsoleted optional third argument * lisp/ob-octave.el: (org-babel-expand-body:matlab): removing obsoleted optional third argument (org-babel-expand-body:octave): removing obsoleted optional third argument (org-babel-execute:octave): removing obsoleted optional third argument (org-babel-octave-variable-assignments): removing obsoleted optional third * lisp/ob-org.el: (org-babel-expand-body:org): removing obsoleted optional third argument * lisp/ob-perl.el: (org-babel-expand-body:perl): removing obsoleted optional third argument (org-babel-execute:perl): removing obsoleted optional third argument * lisp/ob-plantuml.el: (org-babel-expand-body:plantuml): removing obsoleted optional third argument * lisp/ob-python.el: (org-babel-expand-body:python): removing obsoleted optional third argument (org-babel-execute:python): removing obsoleted optional third argument (org-babel-python-variable-assignments): removing obsoleted optional third * lisp/ob-ruby.el: (org-babel-expand-body:ruby): removing obsoleted optional third argument (org-babel-execute:ruby): removing obsoleted optional third argument * lisp/ob-sass.el: (org-babel-expand-body:sass): removing obsoleted optional third argument * lisp/ob-scheme.el: (org-babel-expand-body:scheme): removing obsoleted optional third argument (org-babel-execute:scheme): removing obsoleted optional third argument * lisp/ob-screen.el: (org-babel-expand-body:screen): removing obsoleted optional third argument * lisp/ob-sh.el: (org-babel-expand-body:sh): removing obsoleted optional third argument (org-babel-execute:sh): removing obsoleted optional third argument (org-babel-sh-variable-assignments): removing obsoleted optional third * lisp/ob-sql.el: (org-babel-expand-body:sql): removing obsoleted optional third argument * lisp/ob-sqlite.el: (org-babel-expand-body:sqlite): removing obsoleted optional third argument (org-babel-execute:sqlite): removing obsoleted optional third argument * lisp/ob.el: (org-babel-expand-body:generic): removing obsoleted optional third argument
2010-10-15 23:35:45 -04:00
body (mapcar #'cdr (org-babel-get-header params :var))))
2010-04-11 16:29:24 -04:00
(defun org-babel-execute:clojure (body params)
"Execute a block of Clojure code."
(require 'slime) (require 'swank-clojure)
babel:removing calls to ob-process-params, and updating use of results * lisp/ob-C.el (org-babel-C-execute): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-R.el (org-babel-execute:R): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-R-variable-assignments): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-asymptote.el (org-babel-execute:asymptote): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-clojure.el (org-babel-execute:clojure): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-dot.el (org-babel-execute:dot): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-execute:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-haskell.el (org-babel-execute:haskell): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-js.el (org-babel-execute:js): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-lisp.el (org-babel-execute:lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ocaml.el (org-babel-execute:ocaml): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-octave.el (org-babel-execute:octave): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-perl.el (org-babel-execute:perl): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-python.el (org-babel-execute:python): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ruby.el (org-babel-execute:ruby): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-scheme.el (org-babel-execute:scheme): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-screen.el (org-babel-execute:screen): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-prep-session:screen): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sh.el (org-babel-execute:sh): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sql.el (org-babel-execute:sql): removing call to org-babel-process-params which should no longer be called from within a language file * ob-haskell.el (org-babel-execute:haskell): Remove reference to processed params * ob-clojure.el (org-babel-execute:clojure): Remove reference to processed params * ob-R.el (org-babel-execute:R): Remove reference to processed params
2010-10-21 07:52:24 -04:00
(let* ((body (org-babel-expand-body:clojure body params))
2010-07-04 17:01:30 -04:00
(session (org-babel-clojure-initiate-session
babel:removing calls to ob-process-params, and updating use of results * lisp/ob-C.el (org-babel-C-execute): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-R.el (org-babel-execute:R): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-R-variable-assignments): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-asymptote.el (org-babel-execute:asymptote): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-clojure.el (org-babel-execute:clojure): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-dot.el (org-babel-execute:dot): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-execute:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-haskell.el (org-babel-execute:haskell): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-js.el (org-babel-execute:js): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-lisp.el (org-babel-execute:lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ocaml.el (org-babel-execute:ocaml): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-octave.el (org-babel-execute:octave): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-perl.el (org-babel-execute:perl): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-python.el (org-babel-execute:python): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ruby.el (org-babel-execute:ruby): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-scheme.el (org-babel-execute:scheme): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-screen.el (org-babel-execute:screen): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-prep-session:screen): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sh.el (org-babel-execute:sh): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sql.el (org-babel-execute:sql): removing call to org-babel-process-params which should no longer be called from within a language file * ob-haskell.el (org-babel-execute:haskell): Remove reference to processed params * ob-clojure.el (org-babel-execute:clojure): Remove reference to processed params * ob-R.el (org-babel-execute:R): Remove reference to processed params
2010-10-21 07:52:24 -04:00
(cdr (assoc :session params)))))
(org-babel-reassemble-table
babel:removing calls to ob-process-params, and updating use of results * lisp/ob-C.el (org-babel-C-execute): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-R.el (org-babel-execute:R): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-R-variable-assignments): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-asymptote.el (org-babel-execute:asymptote): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-clojure.el (org-babel-execute:clojure): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-dot.el (org-babel-execute:dot): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-execute:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-haskell.el (org-babel-execute:haskell): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-js.el (org-babel-execute:js): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-lisp.el (org-babel-execute:lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ocaml.el (org-babel-execute:ocaml): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-octave.el (org-babel-execute:octave): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-perl.el (org-babel-execute:perl): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-python.el (org-babel-execute:python): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ruby.el (org-babel-execute:ruby): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-scheme.el (org-babel-execute:scheme): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-screen.el (org-babel-execute:screen): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-prep-session:screen): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sh.el (org-babel-execute:sh): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sql.el (org-babel-execute:sql): removing call to org-babel-process-params which should no longer be called from within a language file * ob-haskell.el (org-babel-execute:haskell): Remove reference to processed params * ob-clojure.el (org-babel-execute:clojure): Remove reference to processed params * ob-R.el (org-babel-execute:R): Remove reference to processed params
2010-10-21 07:52:24 -04:00
(org-babel-clojure-evaluate session body (cdr (assoc :result-type params)))
2010-07-04 17:01:30 -04:00
(org-babel-pick-name
babel:removing calls to ob-process-params, and updating use of results * lisp/ob-C.el (org-babel-C-execute): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-R.el (org-babel-execute:R): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-R-variable-assignments): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-asymptote.el (org-babel-execute:asymptote): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-clojure.el (org-babel-execute:clojure): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-dot.el (org-babel-execute:dot): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-execute:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-haskell.el (org-babel-execute:haskell): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-js.el (org-babel-execute:js): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-lisp.el (org-babel-execute:lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ocaml.el (org-babel-execute:ocaml): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-octave.el (org-babel-execute:octave): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-perl.el (org-babel-execute:perl): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-python.el (org-babel-execute:python): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ruby.el (org-babel-execute:ruby): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-scheme.el (org-babel-execute:scheme): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-screen.el (org-babel-execute:screen): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-prep-session:screen): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sh.el (org-babel-execute:sh): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sql.el (org-babel-execute:sql): removing call to org-babel-process-params which should no longer be called from within a language file * ob-haskell.el (org-babel-execute:haskell): Remove reference to processed params * ob-clojure.el (org-babel-execute:clojure): Remove reference to processed params * ob-R.el (org-babel-execute:R): Remove reference to processed params
2010-10-21 07:52:24 -04:00
(cdr (assoc :colname-names params)) (cdr (assoc :colnames params)))
2010-07-04 17:01:30 -04:00
(org-babel-pick-name
babel:removing calls to ob-process-params, and updating use of results * lisp/ob-C.el (org-babel-C-execute): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-R.el (org-babel-execute:R): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-R-variable-assignments): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-asymptote.el (org-babel-execute:asymptote): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-clojure.el (org-babel-execute:clojure): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-dot.el (org-babel-execute:dot): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-execute:emacs-lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-haskell.el (org-babel-execute:haskell): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-js.el (org-babel-execute:js): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-lisp.el (org-babel-execute:lisp): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ocaml.el (org-babel-execute:ocaml): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-octave.el (org-babel-execute:octave): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-perl.el (org-babel-execute:perl): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-python.el (org-babel-execute:python): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-ruby.el (org-babel-execute:ruby): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-scheme.el (org-babel-execute:scheme): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-screen.el (org-babel-execute:screen): removing call to org-babel-process-params which should no longer be called from within a language file (org-babel-prep-session:screen): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sh.el (org-babel-execute:sh): removing call to org-babel-process-params which should no longer be called from within a language file * lisp/ob-sql.el (org-babel-execute:sql): removing call to org-babel-process-params which should no longer be called from within a language file * ob-haskell.el (org-babel-execute:haskell): Remove reference to processed params * ob-clojure.el (org-babel-execute:clojure): Remove reference to processed params * ob-R.el (org-babel-execute:R): Remove reference to processed params
2010-10-21 07:52:24 -04:00
(cdr (assoc :rowname-names params)) (cdr (assoc :rownames params))))))
(provide 'ob-clojure)
;; arch-tag: a43b33f2-653e-46b1-ac56-2805cf05b7d1
;;; ob-clojure.el ends here