On Tue, 24 Feb 2015, Nicolas Goaziou wrote:
John Kitchin <jkitc...@andrew.cmu.edu> writes:
Fabulous! Thanks!
BTW,
#+BEGIN_SRC emacs-lisp
'((a (b)))
#+END_SRC
#+RESULTS: foo
| a | (b) |
Shouldn't we also return lists deeper than 2 levels as strings? Does it
even make sense to try formatting them into a table?
My vote is no - it doesn't make sense. Let the user pick `:results list'
or `:results pp' after it returns a string.
BTW, the string produced when a list cannot be rendered as a table ought
to be removable.
The patch makes such strings removable. i.e.
#+BEGIN_SRC emacs-lisp
org-babel-load-languages
#+END_SRC
will have the ": " prefix or #+begin/end_example delimiters to allow later
removal like this:
#+RESULTS:
: ((R . t) (latex . t) ... (sql) ...
HTH,
Chuck
From b1179a79c6d72cc0beab6e7fd9774f49ea1bbbae Mon Sep 17 00:00:00 2001
From: Charles Berry <ccbe...@ucsd.edu>
Date: Tue, 24 Feb 2015 15:12:53 -0800
Subject: [PATCH] ob-core.el: examplify list made into strings
* ob-core.el (org-babel-insert-result): When a list cannot be rendered
as a table and is turned into a string make it removable if
`:results replace' (the default) or `:results table' was specified.
---
lisp/ob-core.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-core.el b/lisp/ob-core.el
index f2062ef..4be10c1 100644
--- a/lisp/ob-core.el
+++ b/lisp/ob-core.el
@@ -2299,7 +2299,10 @@ INFO may provide the values of these header arguments
(in the
"{{{results(" ")}}}"))
((and inlinep (member "file" result-params))
(funcall wrap nil nil nil nil "{{{results(" ")}}}"))
- ((and (not (funcall proper-list-p result))
+ ((and (not (and (funcall proper-list-p result)
+ (org-every (lambda (e)
+ (or (atom e) (funcall proper-list-p
e)))
+ result)))
(not (member "file" result-params)))
(let ((org-babel-inline-result-wrap
;; Hard code {{{results(...)}}} on top of
customization.
--
1.9.3 (Apple Git-50)