babel: Ensure that result is a file link when that is intended

* lisp/ob.el (org-babel-execute-src-block): If ":results file" is in
effect, then ensure that the value of :file is returned as the result;
don't rely on language files for this.

Examples of languages that were not honouring :file are sh and
emacs-lisp.
This commit is contained in:
Dan Davison 2010-10-31 12:55:35 +00:00
parent cf0cdd7785
commit d6599c5699
1 changed files with 12 additions and 7 deletions

View File

@ -391,13 +391,18 @@ block."
(message "executing %s code block%s..."
(capitalize lang)
(if (nth 4 info) (format " (%s)" (nth 4 info)) ""))
(setq result (funcall cmd body params))
(if (eq (cdr (assoc :result-type params)) 'value)
(setq result (if (and (or (member "vector" result-params)
(member "table" result-params))
(not (listp result)))
(list (list result))
result)))
(setq result
((lambda (result)
(cond
((member "file" result-params)
(cdr (assoc :file params)))
((and (eq (cdr (assoc :result-type params)) 'value)
(or (member "vector" result-params)
(member "table" result-params))
(not (listp result)))
(list (list result)))
(t result)))
(funcall cmd body params)))
(org-babel-insert-result
result result-params info new-hash indent lang)
(run-hooks 'org-babel-after-execute-hook)