diff --git a/lisp/org-babel.el b/lisp/org-babel.el index ec028c11b..4b29d7fcc 100644 --- a/lisp/org-babel.el +++ b/lisp/org-babel.el @@ -460,14 +460,16 @@ silent -- no results are inserted" (org-cycle)))) (message "finished")))) -(defun org-babel-open-src-block-result () +(defun org-babel-open-src-block-result (&optional re-run) (interactive) "If `point' is on a src block then open the results of the -source code block, otherwise return nil." +source code block, otherwise return nil. With optional prefix +argument RE-RUN the source-code block is evaluated even if +results already exist." (when (org-babel-get-src-block-info) (save-excursion ;; go to the results, if there aren't any then run the block - (goto-char (or (org-babel-where-is-src-block-result) + (goto-char (or (and (not re-run) (org-babel-where-is-src-block-result)) (progn (org-babel-execute-src-block) (org-babel-where-is-src-block-result)))) (move-end-of-line 1) (forward-char 1) @@ -479,7 +481,7 @@ source code block, otherwise return nil." (pop-to-buffer (get-buffer-create "org-babel-results")) (delete-region (point-min) (point-max)) (if (listp results) - (insert (orgtbl-to-tsv results)) + (insert (orgtbl-to-tsv (list results) nil)) (insert results))))))) (defun org-babel-result-to-org-string (result) diff --git a/org-babel.org b/org-babel.org index 42cf8f9f3..b93a32320 100644 --- a/org-babel.org +++ b/org-babel.org @@ -479,6 +479,24 @@ This could also act reasonably with other results types... #+resname: [[file:blue.png][blue.png]] +#+srcname: task-open-vector +#+begin_src emacs-lisp +'((1 2) (3 4)) +#+end_src + +#+resname: +| 1 | 2 | +| 3 | 4 | + +#+srcname: task-open-scalar +#+begin_src emacs-lisp +3 +#+end_src + +#+resname: +: 3 + + ** TODO Finalise behaviour regarding vector/scalar output