[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: [Babel] Handling of errors when using Ledger
From: |
Eric S Fraga |
Subject: |
[Orgmode] Re: [Babel] Handling of errors when using Ledger |
Date: |
Fri, 26 Nov 2010 12:39:50 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Dan Davison <address@hidden> writes:
> Eric S Fraga <address@hidden> writes:
>
>> Dan <address@hidden> writes:
>>
>> [...]
>>
>>> This patch should make ob-ledger use the common org-babel error mechanism.
>>> It is
>>> in branch ledger of the main repo. However, I'm not yet a ledger user. Could
>>> someone test it?
>>
>> Unfortunately, it doesn't work at all [1] for a very simple reason: you
>> have removed the -f option which specifies the file that ledger should
>> read.
>
> Hi Eric,
>
> Yes, ob-eval passes the src block body to the interpreter on standard
> input. I assumed that ledger would be able to read its transaction data
> from standard input. Is that not the case? What about with "--file -"
> or "-f -"?
> [...]
> If ledger can't read the src blocks body from stdin (and if it can't, I
> expect there's a good reason why not), then maybe this is a motivation
> for changing ob-eval so that the block body is read from file.
Indeed, ledger cannot read from standard input. From the man page:
,----
| All commands require a Ledger data file which can be specified with -f
| filename or via the LEDGER_FILE environment variable.
`----
and later:
,----
| -f, --file FILE
|
| Reads FILE as a Ledger file. This option may be specified multiple
| times. FILE may also be a list of file names separated by colons.
| Typically, the environment variable LEDGER_FILE is set rather than
| using this command-line option.
`----
Using an environment variable is not a good or viable solution for
babel, as far as I can figure, and there does not seem to be any concept
of "-" for standard input in lieu of a file. I cannot see any reason
for this and, to be honest, I find it annoying [1] as a long time Unix user
wishing to join tools together with pipes etc. But maybe John Wiegley
had his reasons for taking this decision. Maybe he can comment on
this... I think he reads this list?
> 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 could be a solution. In thinking about all of my babel uses, this
would have no impact on me but others may have different opinions? It
would seem to be a safer route in any case?
Thanks,
eric
Footnotes:
[1] but not annoying enough to stop using ledger, of course, as it's a
brilliant tool otherwise!
--
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 23.2.1
: using Org-mode version 7.3 (release_7.3.99.g9db0.dirty)
[Orgmode] Re: [Babel] Handling of errors when using Ledger, Sébastien Vauban, 2010/11/25
Re: [Orgmode] Re: [Babel] Handling of errors when using Ledger, Eric S Fraga, 2010/11/26