Browse Source

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.
Eric Schulte 7 years ago
parent
commit
f51fd88554
1 changed files with 5 additions and 2 deletions
  1. 5 2
      lisp/ob-core.el

+ 5 - 2
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."