emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Re: [Babel] Piping between code blocks Was: Handling of errors


From: Eric Schulte
Subject: [Orgmode] Re: [Babel] Piping between code blocks Was: Handling of errors when using Ledger
Date: Sat, 27 Nov 2010 15:04:46 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Dan Davison <address@hidden> writes:

>
> Incidentally, I have for a long time wondered whether we should permit
> src blocks to read *input data* from standard input. This would require
> altering ob-eval such that the src block body is read from file. Then we
> could do things like
>
> #+source: output-some-text
> #+begin_src sh :results output
>   # print stuff
> #+end_src
>
> #+begin_src perl :stdin output-some-text
>   while ( <> ) {
>       # process the text
>   }
> #+end_src
>

This is interesting, it would involve starting all such pipe-chained
blocks at the same time, and coordinating their input and output through
Unix pipes (note: I don't know how pipes would work on a Windows
machine).

One question is whether we allow data to pass /directly/ between blocks,
or if we insert babel in between to do its usual parsing (i.e. arrays
into elisp lists, etc...).  I'd lean against inserting babel as I
believe this would be of use mainly for performance, and Emacs/Babel
parsing would blow any performance gains.  Also it could be difficult to
implement.

I think that in addition to the :stdin option above we would need a
=:stdout= option would imply both =:results output= and =:results
scalar= and would allow the process to write intermediate results
directly to a supplied pipe.  Perhaps such a :stdout option would never
be supplied directly by the user, but would rather be used by babel to
organize piping when that code block has referenced by another code
block using :stdin.

Does the above make sense or sound appealing?

Best -- Eric



reply via email to

[Prev in Thread] Current Thread [Next in Thread]