emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Daniele Pizzolli <dan@toel.it>,
	emacs-orgmode@gnu.org, John Kitchin <jkitchin@andrew.cmu.edu>
Subject: [PATCH] was Re: [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t
Date: Tue, 24 Feb 2015 15:36:01 -0800	[thread overview]
Message-ID: <alpine.OSX.2.00.1502241515480.1867@charles-berrys-macbook.local> (raw)
In-Reply-To: <8761ar45kp.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 825 bytes --]

On Tue, 24 Feb 2015, Nicolas Goaziou wrote:

> John Kitchin <jkitchin@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

[-- Attachment #2: make stringified lists removable --]
[-- Type: TEXT/PLAIN, Size: 1243 bytes --]

From b1179a79c6d72cc0beab6e7fd9774f49ea1bbbae Mon Sep 17 00:00:00 2001
From: Charles Berry <ccberry@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)


  parent reply	other threads:[~2015-02-24 23:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-23 12:48 [BUG] babel eval of emacs-lisp: orgtbl-to-orgtbl: Wrong type argument: listp, t Daniele Pizzolli
2015-02-23 12:57 ` John Kitchin
2015-02-23 13:17   ` Daniele Pizzolli
2015-02-23 15:43     ` John Kitchin
2015-02-23 17:46       ` Nicolas Goaziou
2015-02-23 18:07         ` John Kitchin
2015-02-24 16:50           ` Nicolas Goaziou
2015-02-24 18:21             ` John Kitchin
2015-02-24 23:36             ` Charles C. Berry [this message]
2015-02-25 13:44               ` [PATCH] was " Nicolas Goaziou
2015-02-23 19:30         ` Daniele Pizzolli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.OSX.2.00.1502241515480.1867@charles-berrys-macbook.local \
    --to=ccberry@ucsd.edu \
    --cc=dan@toel.it \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    --cc=mail@nicolasgoaziou.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).