From f51fd88554c64a3b0e9be23a5a134c557406d3fb Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sun, 24 Feb 2013 09:49:12 -0700 Subject: [PATCH] Return expanded code on programmatic calls * lisp/ob-core.el (org-babel-expand-src-block): Return value of expanded code block on non-interactive calls. --- lisp/ob-core.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 717746e8b..3278bf91a 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -630,8 +630,11 @@ arguments and pop open the results in a preview buffer." (org-babel-expand-body:generic body params (and (fboundp assignments-cmd) (funcall assignments-cmd params)))))) - (org-edit-src-code - nil expanded (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*")))) + (if (called-interactively-p 'any) + (org-edit-src-code + nil expanded + (concat "*Org-Babel Preview " (buffer-name) "[ " lang " ]*")) + expanded))) (defun org-babel-edit-distance (s1 s2) "Return the edit (levenshtein) distance between strings S1 S2."