From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: [BUG][babel] ":result output table" doesn't work for python code blocks Date: Wed, 27 Apr 2011 16:28:33 +0100 Message-ID: <87oc3rvhlq.fsf@pinto.chemeng.ucl.ac.uk> References: <87k4ew2vfu.fsf@are.berkeley.edu> <87oc485jy3.fsf@gmail.com> <87hb9zyf79.fsf@ucl.ac.uk> <877hava3d8.fsf@gmail.com> <87aafksm4y.fsf@ucl.ac.uk> <87zkncolm9.fsf@gmail.com> <87aafc9fag.fsf@pinto.chemeng.ucl.ac.uk> <87pqo7keva.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF6fQ-00071Q-Gm for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 11:28:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QF6fP-0000LZ-94 for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 11:28:40 -0400 Received: from vscani-d2.ucl.ac.uk ([144.82.108.133]:61865) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QF6fO-0000LI-SV for emacs-orgmode@gnu.org; Wed, 27 Apr 2011 11:28:39 -0400 In-Reply-To: <87pqo7keva.fsf@gmail.com> (Eric Schulte's message of "Wed, 27 Apr 2011 07:16:55 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org "Eric Schulte" 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)