org-babel: ensure that result is returned when using :results output

One half of this patch is a revert of c167a4ac32.

These changes are necessary so that :results output works correctly
with #+lob calls. For example the following example did not work:

--------------------------------------------------
3. :results output org -> doesn't work with #+lob:
--------------------------------------------------
\#+srcname: randthree(n,max)
\#+begin_src ruby
number = n
maximum = max
puts "* Random numbers\n" +
"Here are some random numbers: " +
(1..number).collect {|x| (rand * maximum).ceil }.join(", ") +
"."
\#+end_src

\#+lob: randthree(n=3,max=10) :results output org
This commit is contained in:
Dan Davison 2009-10-20 09:24:15 -04:00
parent 64c26c6561
commit 68a1240db8
2 changed files with 9 additions and 12 deletions

View File

@ -39,16 +39,13 @@
"Execute a block of emacs-lisp code with org-babel. This
function is called by `org-babel-execute-src-block' via multiple-value-bind."
(message "executing emacs-lisp code block...")
(case result-type
(output '())
(value (save-window-excursion
(let ((print-level nil) (print-length nil))
(eval `(let ,(mapcar (lambda (var) `(,(car var) ',(cdr var))) vars)
,(read (concat "(progn "
(if (or (member "code" result-params)
(member "pp" result-params))
(concat "(pp " body ")") body)
")")))))))))
(save-window-excursion
(let ((print-level nil) (print-length nil))
(eval `(let ,(mapcar (lambda (var) `(,(car var) ',(cdr var))) vars)
,(read (concat "(progn "
(if (or (member "code" result-params)
(member "pp" result-params))
(concat "(pp " body ")") body)
")")))))))
(provide 'org-babel-emacs-lisp)
;;; org-babel-emacs-lisp.el ends here

View File

@ -189,7 +189,7 @@ the header arguments specified at the source code block."
(if (eq result-type 'value)
(setq result (org-babel-process-value-result result result-params)))
(org-babel-insert-result result result-params)
(case result-type (output nil) (value result))))
result))
(defun org-babel-load-in-session (&optional arg info)
"Load the body of the current source-code block. Evaluate the