From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [Babel] Handling of errors when using Ledger Date: Fri, 26 Nov 2010 11:47:10 +0000 Message-ID: <87vd3kxq69.fsf@gmail.com> References: <877hhudxor.fsf@mundaneum.com> <87sk0inmys.fsf@stats.ox.ac.uk> <807hhnfaix.fsf@mundaneum.com> <87mxqiv7q3.wl%ucecesf@ucl.ac.uk> <871v68eb5k.fsf@pinto.chemeng.ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=50946 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PLwlw-000525-Dl for emacs-orgmode@gnu.org; Fri, 26 Nov 2010 06:47:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PLwlu-0007iE-D5 for emacs-orgmode@gnu.org; Fri, 26 Nov 2010 06:47:24 -0500 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:35550) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PLwlu-0007hi-67 for emacs-orgmode@gnu.org; Fri, 26 Nov 2010 06:47:22 -0500 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric S Fraga Cc: emacs-orgmode@gnu.org Eric S Fraga writes: > Dan 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 > > 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.