emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* babel :results output and format of output
@ 2013-02-24 10:50 D M German
  2013-02-24 11:51 ` Sean O'Halpin
  0 siblings, 1 reply; 2+ messages in thread
From: D M German @ 2013-02-24 10:50 UTC (permalink / raw)
  To: emacs-orgmode


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?

thanks a lot for your help,


--dmg



--
Daniel M. German                  "In questions of science the authority of
                                   a thousand is not worth the humble
   Galileo ->                      reasoning of a single individual."
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: babel :results output and format of output
  2013-02-24 10:50 babel :results output and format of output D M German
@ 2013-02-24 11:51 ` Sean O'Halpin
  0 siblings, 0 replies; 2+ messages in thread
From: Sean O'Halpin @ 2013-02-24 11:51 UTC (permalink / raw)
  To: dmg; +Cc: emacs-orgmode

On Sun, Feb 24, 2013 at 10:50 AM, D M German <dmg@uvic.ca> 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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-02-24 11:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-24 10:50 babel :results output and format of output D M German
2013-02-24 11:51 ` Sean O'Halpin

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).