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:
parent
64c26c6561
commit
68a1240db8
|
@ -39,16 +39,13 @@
|
||||||
"Execute a block of emacs-lisp code with org-babel. This
|
"Execute a block of emacs-lisp code with org-babel. This
|
||||||
function is called by `org-babel-execute-src-block' via multiple-value-bind."
|
function is called by `org-babel-execute-src-block' via multiple-value-bind."
|
||||||
(message "executing emacs-lisp code block...")
|
(message "executing emacs-lisp code block...")
|
||||||
(case result-type
|
(save-window-excursion
|
||||||
(output '())
|
(let ((print-level nil) (print-length nil))
|
||||||
(value (save-window-excursion
|
(eval `(let ,(mapcar (lambda (var) `(,(car var) ',(cdr var))) vars)
|
||||||
(let ((print-level nil) (print-length nil))
|
,(read (concat "(progn "
|
||||||
(eval `(let ,(mapcar (lambda (var) `(,(car var) ',(cdr var))) vars)
|
(if (or (member "code" result-params)
|
||||||
,(read (concat "(progn "
|
(member "pp" result-params))
|
||||||
(if (or (member "code" result-params)
|
(concat "(pp " body ")") body)
|
||||||
(member "pp" result-params))
|
")")))))))
|
||||||
(concat "(pp " body ")") body)
|
|
||||||
")")))))))))
|
|
||||||
|
|
||||||
(provide 'org-babel-emacs-lisp)
|
(provide 'org-babel-emacs-lisp)
|
||||||
;;; org-babel-emacs-lisp.el ends here
|
;;; org-babel-emacs-lisp.el ends here
|
||||||
|
|
|
@ -189,7 +189,7 @@ the header arguments specified at the source code block."
|
||||||
(if (eq result-type 'value)
|
(if (eq result-type 'value)
|
||||||
(setq result (org-babel-process-value-result result result-params)))
|
(setq result (org-babel-process-value-result result result-params)))
|
||||||
(org-babel-insert-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)
|
(defun org-babel-load-in-session (&optional arg info)
|
||||||
"Load the body of the current source-code block. Evaluate the
|
"Load the body of the current source-code block. Evaluate the
|
||||||
|
|
Loading…
Reference in New Issue