Merge branch 'master' of git+ssh://repo.or.cz/srv/git/org-mode

This commit is contained in:
Carsten Dominik 2009-11-12 07:01:17 +01:00
commit 3f86145946
3 changed files with 18 additions and 22 deletions

View File

@ -54,11 +54,11 @@
"
(defn spit
[f content]
(with-open [#^java.io.PrintWriter w
(java.io.PrintWriter.
(java.io.BufferedWriter.
(java.io.OutputStreamWriter.
(java.io.FileOutputStream.
(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)))
@ -136,7 +136,7 @@ specifying a var of the same value."
(vars (org-babel-ref-variables params))
(var-lines (mapcar ;; define any top level session variables
(lambda (pair)
(format "(defn %s %s)\n" (car pair) (org-babel-clojure-var-to-clojure (cdr pair))))
(format "(def %s %s)\n" (car pair) (org-babel-clojure-var-to-clojure (cdr pair))))
vars)))
session-buf))
@ -146,7 +146,7 @@ then create. Return the initialized session."
(unless (string= session "none")
(if (comint-check-proc "*inferior-lisp*")
(get-buffer "*inferior-lisp*")
(let ((session-buffer (save-window-excursion (slime 'clojure) (current-buffer))))
(let ((session-buffer (save-window-excursion (slime 'clojure) (current-buffer))))
(sit-for 5)
(if (slime-connected-p)
session-buffer
@ -166,7 +166,7 @@ then create. Return the initialized session."
(buffer-string)))
(value
(let ((tmp-src-file (make-temp-file "clojure_babel_input_"))
(tmp-results-file (make-temp-file "clojure_babel_results_")))
(tmp-results-file (make-temp-file "clojure_babel_results_")))
(with-temp-file tmp-src-file
(insert (format org-babel-clojure-wrapper-method body tmp-results-file tmp-results-file)))
(shell-command
@ -198,8 +198,8 @@ last statement in BODY, as elisp."
"Execute a block of Clojure code with org-babel."
(let* ((processed-params (org-babel-process-params params))
(vars (second processed-params))
(body (org-babel-clojure-build-full-form body vars))
(session (org-babel-clojure-initiate-session (first processed-params))))
(body (org-babel-clojure-build-full-form body vars))
(session (org-babel-clojure-initiate-session (first processed-params))))
(org-babel-clojure-evaluate session body (fourth processed-params))))
(provide 'org-babel-clojure)

View File

@ -108,11 +108,10 @@ last statement in BODY, as elisp."
(if (member "pp" result-params)
(error "Pretty-printing not implemented for perl")
org-babel-perl-wrapper-method)
(let ((lines (split-string
(org-remove-indentation (org-babel-trim body)) "[\r\n]")))
(concat
(mapconcat #'identity (butlast lines) "\n")
(format "\nreturn %s" (car (last lines)))))
(mapconcat
(lambda (line) (format "\t%s" line))
(split-string
(org-remove-indentation (org-babel-trim body)) "[\r\n]") "\n")
tmp-file))
;; (message "buffer=%s" (buffer-string)) ;; debugging
(shell-command-on-region (point-min) (point-max) "perl"))

View File

@ -160,13 +160,10 @@ last statement in BODY, as elisp."
(if (member "pp" result-params)
org-babel-python-pp-wrapper-method
org-babel-python-wrapper-method)
(let ((lines (split-string
(org-remove-indentation (org-babel-trim body)) "[\r\n]")))
(concat
(mapconcat
(lambda (line) (format "\t%s" line))
(butlast lines) "\n")
(format "\n\treturn %s" (car (last lines)))))
(mapconcat
(lambda (line) (format "\t%s" line))
(split-string
(org-remove-indentation (org-babel-trim body)) "[\r\n]") "\n")
tmp-file))
;; (message "buffer=%s" (buffer-string)) ;; debugging
(shell-command-on-region (point-min) (point-max) "python"))