From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sean O'Halpin" Subject: Re: babel :results output and format of output Date: Sun, 24 Feb 2013 11:51:43 +0000 Message-ID: References: <87ip5iyoii.fsf@mn.cs.uvic.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:60082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9a7P-0008IA-7B for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 06:51:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U9a7N-0004QH-LS for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 06:51:47 -0500 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:61206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U9a7N-0004Pq-Dm for emacs-orgmode@gnu.org; Sun, 24 Feb 2013 06:51:45 -0500 Received: by mail-we0-f174.google.com with SMTP id r6so1703530wey.19 for ; Sun, 24 Feb 2013 03:51:43 -0800 (PST) In-Reply-To: <87ip5iyoii.fsf@mn.cs.uvic.ca> 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: dmg@uvic.ca Cc: emacs-orgmode@gnu.org On Sun, Feb 24, 2013 at 10:50 AM, D M German wrote: > > hi everybody, > > > I have been testing babel with perl and I am very puzzled by the > following: > > > Say I have the following script that outputs 10 numbers. org/babel wraps > it as a begin_example > > > #+begin_src perl :results output > for (my $i=0;$i<10;$i++) { > print "$i\n"; > } > #+end_src > > #+RESULTS: > #+begin_example > 0 > 1 > 2 > 3 > 4 > 5 > 6 > 7 > 8 > 9 > #+end_example > > > But if my script only outputs 9 lines then the format is not wrapped by > #+begin_example, and instead is prefixed by : > > #+begin_src perl :results output > for (my $i=0;$i<9;$i++) { > print "$i\n"; > } > #+end_src > > #+RESULTS: > : 0 > : 1 > : 2 > : 3 > : 4 > : 5 > : 6 > : 7 > : 8 > > Is this behaviour expected? Is the threshold at which it happens > configurable? Yes - it's controlled by =org-babel-min-lines-for-block-output= in lisp/ob-core.el: #+BEGIN_QUOTE (defvar org-babel-min-lines-for-block-output 10 "The minimum number of lines for block output. If number of lines of output is equal to or exceeds this value, the output is placed in a #+begin_example...#+end_example block. Otherwise the output is marked as literal by inserting colons at the starts of the lines. This variable only takes effect if the :results output option is in effect.") #+END_QUOTE Regards, Sean