summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Schulte <schulte.eric@gmail.com>2010-06-12 16:13:34 -0700
committerEric Schulte <schulte.eric@gmail.com>2010-06-17 18:15:32 -0700
commite0b71bf8e2f99862bcfffe8e8c41c6c2d5015159 (patch)
tree9f47f93d5dc6860cbd4885c9d506a66fc9557d26
parent45841a8a9de62049c15d371831be6673d50a24eb (diff)
downloadorg-mode-e0b71bf8e2f99862bcfffe8e8c41c6c2d5015159.tar.gz
babel: wrapping free language variable in result insertion code
* lisp/babel/ob.el (org-babel-execute-src-block): now passing additional optional argument to `org-babel-inert-results' (org-babel-insert-result): now accepting additional language variable
-rw-r--r--lisp/babel/ob.el16
1 files changed, 7 insertions, 9 deletions
diff --git a/lisp/babel/ob.el b/lisp/babel/ob.el
index 74aeae9..242112c 100644
--- a/lisp/babel/ob.el
+++ b/lisp/babel/ob.el
@@ -275,7 +275,8 @@ block."
(not (listp result)))
(list (list result))
result)))
- (org-babel-insert-result result result-params info new-hash indent)
+ (org-babel-insert-result
+ result result-params info new-hash indent lang)
(run-hooks 'org-babel-after-execute-hook)
result))
(setq call-process-region 'call-process-region-original))))
@@ -956,7 +957,8 @@ link is a file path it is expanded using `expand-file-name'."
(expand-file-name (match-string 2 raw))))
(t raw))))
-(defun org-babel-insert-result (result &optional result-params info hash indent)
+(defun org-babel-insert-result
+ (result &optional result-params info hash indent lang)
"Insert RESULT into the current buffer after the end of the
current source block. With optional argument RESULT-PARAMS
controls insertion of results in the org-mode file.
@@ -987,7 +989,8 @@ latex --- results are added inside of a #+BEGIN_LATEX block.
code ---- the results are extracted in the syntax of the source
code of the language being evaluated and are added
inside of a #+BEGIN_SRC block with the source-code
- language set appropriately."
+ language set appropriately. Note this relies on the
+ optional LANG argument."
(if (stringp result)
(progn
(setq result (org-babel-clean-text-properties result))
@@ -1048,7 +1051,7 @@ code ---- the results are extracted in the syntax of the source
results-switches result)))
((member "code" result-params)
(insert (format "#+BEGIN_SRC %s%s\n%s#+END_SRC\n"
- lang results-switches result)))
+ (or lang "none") results-switches result)))
((or (member "raw" result-params) (member "org" result-params))
(save-excursion (insert result)) (if (org-at-table-p) (org-cycle)))
(t
@@ -1063,11 +1066,6 @@ code ---- the results are extracted in the syntax of the source
(indent-rigidly beg end indent))))
(message "finished"))))
-(defun org-babel-result-to-org-string (result)
- "Return RESULT as a string in org-mode format. This function
-relies on `org-babel-insert-result'."
- (with-temp-buffer (org-babel-insert-result result) (buffer-string)))
-
(defun org-babel-remove-result (&optional info)
"Remove the result of the current source block."
(interactive)