|
@@ -156,20 +156,22 @@ the header arguments specified at the source code block."
|
|
|
(body (second info))
|
|
|
(params (org-babel-merge-params
|
|
|
(third info) (org-babel-get-src-block-function-args) params))
|
|
|
- (result-params (split-string (or (cdr (assoc :results params)) "")))
|
|
|
- (result-type (cond ((member "output" result-params) 'output)
|
|
|
- ((member "value" result-params) 'value)
|
|
|
- (t 'value)))
|
|
|
+ (processed-params (org-babel-process-params params))
|
|
|
+ (result-params (third processed-params))
|
|
|
+ (result-type (fourth processed-params))
|
|
|
(cmd (intern (concat "org-babel-execute:" lang)))
|
|
|
result)
|
|
|
;; (message (format "params=%S" params)) ;; debugging
|
|
|
(unless (member lang org-babel-interpreters)
|
|
|
(error "Language is not in `org-babel-interpreters': %s" lang))
|
|
|
(when arg (setq result-params (cons "silent" result-params)))
|
|
|
- (setq result (org-babel-process-result (funcall cmd body params) result-type))
|
|
|
+ (setq result
|
|
|
+ (org-babel-process-result
|
|
|
+ (multiple-value-bind (session vars result-params result-type) processed-params
|
|
|
+ (funcall cmd body params)) result-type))
|
|
|
(org-babel-insert-result result result-params)
|
|
|
(case result-type (output nil) (value result))))
|
|
|
-
|
|
|
+
|
|
|
(defun org-babel-process-result (result result-type)
|
|
|
"This doesn't do anything currently.
|
|
|
|
|
@@ -330,6 +332,20 @@ of the following form. (language body header-arguments-alist)"
|
|
|
(cons (intern (concat ":" arg)) nil)))
|
|
|
(split-string (concat " " arg-string) "[ \f\t\n\r\v]+:" t)))))
|
|
|
|
|
|
+(defun org-babel-process-params (params)
|
|
|
+ "Parse params and resolve references.
|
|
|
+
|
|
|
+Return a list (session vars result-params result-type). These are
|
|
|
+made available to the org-babel-execute:LANG functions via
|
|
|
+multiple-value-bind."
|
|
|
+ (let* ((session (cdr (assoc :session params)))
|
|
|
+ (vars (org-babel-ref-variables params))
|
|
|
+ (result-params (split-string (or (cdr (assoc :results params)) "")))
|
|
|
+ (result-type (cond ((member "output" result-params) 'output)
|
|
|
+ ((member "value" result-params) 'value)
|
|
|
+ (t 'value))))
|
|
|
+ (list session vars result-params result-type)))
|
|
|
+
|
|
|
(defun org-babel-where-is-src-block-head ()
|
|
|
"Return the point at the beginning of the current source
|
|
|
block. Specifically at the beginning of the #+BEGIN_SRC line.
|