emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel] New handling of file output
@ 2010-12-21 16:02 Dan Davison
  2010-12-21 16:57 ` [babel] R: " Dan Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Davison @ 2010-12-21 16:02 UTC (permalink / raw)
  To: emacs-orgmode

Please note the following changes to the way that org-babel handles
file output. These may break existing org-babel files which use
the :file header argument.

:file <filename> should be understood as saying "write the result
to <filename> and return a link to <filename>".

This works for all languages. For graphics languages (e.g. ditaa, dot,
gnuplot) there is no change in behavior: "result" in the above is the
graphics, and a link to the image is placed in the org buffer. For
general-purpose languages (e.g. emacs-lisp, python, R, ruby, shell),
the "result" written to file is the normal org-babel result (string,
number, table).

This is a backwards-incompatible change for R, which was previously
interpreting :file to mean "send graphics to file". I will send a
separate email concerning R.

In order to return a file link from a src block without telling babel
to save any results to that file, use :results <filename> and do not
use :file. The code block can of course write arbitrary content to
<filename>.

Some examples:

Save the output of ls -l as a .csv file (recall that :results value is
the default):

#+begin_src sh :file dirlisting.csv :sep ,
 ls -l
#+end_src

Send the text output of ls -l directly to file:

#+begin_src sh :results output :file dirlisting.txt
 ls -l
#+end_src

Dan

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

end of thread, other threads:[~2011-01-06 17:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-21 16:02 [babel] New handling of file output Dan Davison
2010-12-21 16:57 ` [babel] R: " Dan Davison
2011-01-01 21:49   ` Thomas S. Dye
2011-01-01 22:58   ` Thomas S. Dye
2011-01-06 17:14     ` Dan Davison

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