emacs-orgmode
[Top][All Lists]
Advanced

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

[Orgmode] Re: [Babel] Handling of errors when using Ledger


From: Dan Davison
Subject: [Orgmode] Re: [Babel] Handling of errors when using Ledger
Date: Fri, 26 Nov 2010 11:47:10 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

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 -"?

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

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.

Dan

>  Ledger does not interpret a file argument directly but needs the
> -f option, as in:
>
>    ledger -f file.ledger <rest of command line>
>
> Note the second line in the concatenated list of strings below:
>
> [...]
>
>> -    (with-output-to-string
>> -      (shell-command (concat "ledger"
>> -                            " -f " (org-babel-process-file-name in-file)
>> -                            " " cmdline
>> -                            " > " (org-babel-process-file-name out-file))))
>
> I am not sure how you pass this option with the much shorter code you
> have written:
>
>> +  (org-babel-eval
>> +   (concat org-babel-ledger-command " " (cdr (assoc :cmdline params)))
>> +   body))
>
> I hope this makes sense?
>
> Footnotes: 
> [1]  actually, what does work very nicely indeed is that error messages
>      are reported perfectly!!  So thank you very much for this.



reply via email to

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