From d6599c569974487ebaa3bafffd2a06d30688fe8b Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 31 Oct 2010 12:55:35 +0000 Subject: [PATCH] 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. --- lisp/ob.el | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index 38c03c1b6..3ce898f68 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -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)