Browse Source

added more tests, still not there

Eric Schulte 16 years ago
parent
commit
97d8e85a92
2 changed files with 24 additions and 4 deletions
  1. 6 4
      lisp/org-babel.el
  2. 18 0
      org-babel.org

+ 6 - 4
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)

+ 18 - 0
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