From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [BUG][babel] ":result output table" doesn't work for python code blocks
Date: Wed, 27 Apr 2011 16:28:33 +0100 [thread overview]
Message-ID: <87oc3rvhlq.fsf@pinto.chemeng.ucl.ac.uk> (raw)
In-Reply-To: <87pqo7keva.fsf@gmail.com> (Eric Schulte's message of "Wed, 27 Apr 2011 07:16:55 -0600")
"Eric Schulte" <schulte.eric@gmail.com> writes:
>>> perhaps the data could be printed as an Org-mode table, and then the
>>> "output raw" :results combination could be used, or the output could
>
>>> be sent through another code block to convert the string to a table.
>>
>> That's what I do at the moment, actually.
>>
>> Mind you, org is able to take the output and convert it to a table
>> easily enough with =C-c |= (org-table-create-or-convert-from-region)
>> operating on the output if selected as a region. Would it be possible
>> to post-process the output from babel automatically using this method
>> (maybe with a hook?) with the output selected if ":results output
>> table", say, were specified? That alone would be sufficient for 90% of
>> the cases...
>>
>
> Ah, that sounds like a much more satisfying and general solution than
> the previous approach of parsing output in language-specific manners.
> Although I don't have time at the moment, I will put automatic
> conversion of org type results onto my todo list, so that at some point
> in the future, code like the following will be possible...
>
> #+source: org-results
> #+begin_src sh :results output org
> echo "| 1 |"
> echo "| 2 |"
> #+end_src
>
> #+begin_src emacs-lisp :var in=org-results
> (listp in)
> #+end_src
> #+results:
> : t
Eric,
I am not sure I explained myself clearly above. What I meant is that
the output of, say, this octave code:
--8<---------------cut here---------------start------------->8---
#+srcname: octave-formatted
#+begin_src octave :results output raw
A = [1, 2; 3, 4];
disp(A)
#+end_src
#+results: octave-formatted
1 2
3 4
--8<---------------cut here---------------end--------------->8---
can subsequently be selected and converted to a table by applying the
org-table-create-or-convert-from-region command, which gives:
--8<---------------cut here---------------start------------->8---
| 1 | 2 |
| 3 | 4 |
--8<---------------cut here---------------end--------------->8---
It's not about identifying /org-like/ output but simply applying that
function automatically to the output, if "output table" has been
requested.
I hope this makes more sense?
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.5 (release_7.5.209.g1a687)
prev parent reply other threads:[~2011-04-27 15:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-15 0:46 [BUG][babel] ":result output table" doesn't work for python code blocks Ethan Ligon
2011-04-15 2:26 ` Eric Schulte
2011-04-15 10:35 ` Eric S Fraga
2011-04-15 16:13 ` Eric Schulte
2011-04-20 20:28 ` Eric S Fraga
2011-04-26 19:31 ` Eric Schulte
2011-04-27 10:09 ` Eric S Fraga
2011-04-27 13:16 ` Eric Schulte
2011-04-27 15:28 ` Eric S Fraga [this message]
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=87oc3rvhlq.fsf@pinto.chemeng.ucl.ac.uk \
--to=e.fraga@ucl.ac.uk \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
/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).