From mboxrd@z Thu Jan 1 00:00:00 1970 From: Viktor Rosenfeld Subject: [BABEL] BUG: Can't pass format string (-F) to ledger Date: Sat, 14 May 2011 16:41:15 +0200 Message-ID: <20110514144115.GA416@kenny.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39567) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLG1x-0001KZ-SM for emacs-orgmode@gnu.org; Sat, 14 May 2011 10:41:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QLG1w-0001Nm-TS for emacs-orgmode@gnu.org; Sat, 14 May 2011 10:41:21 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:46439) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLG1w-0001Nd-KB for emacs-orgmode@gnu.org; Sat, 14 May 2011 10:41:20 -0400 Received: by fxm18 with SMTP id 18so2859603fxm.0 for ; Sat, 14 May 2011 07:41:19 -0700 (PDT) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, I'm having trouble passing format strings (-F) to ledger using org-babel. When I pass -F to :cmdline, I get the following error: Not enough arguments for format string. This appears to be a problem with the %-markup in the format string. Posted below is a sample org file containing the steps to reproduce the error and the expected results. Cheers, Viktor * Setup babel We need ledger and shell support. #+begin_src emacs-lisp :results silent (require 'ob-ledger) (require 'ob-sh) #+end_src * Sample data Here's some sample data: - monthly budget 100 € for food - spent 10 € on groceries - spent 5 € taxi fare #+srcname: sample-data #+begin_src ledger :noweb yes :tangle sample.ledger ~ Monthly Expenses:Food 100,00 € Assets 2011/05/13 Groceries Expenses:Food 10,00 € Assets 2011/05/13 Taxi fare Expenses 5,00 € Assets #+end_src #+results: sample-data : -15,00 € Assets : 15,00 € Expenses If you tangle the code above, this block should also produce a balance: #+begin_src sh :results output cat sample.ledger | ledger -f - bal #+end_src #+results: : -15,00 € Assets : 15,00 € Expenses * How to reproduce the error I want to create a table containing the budgeted accounts as well as unbudgeted expenses: #+begin_src ledger :noweb yes :cmdline -F "%A\t%t\n" -p 2011/5 --budget -M reg ^Expenses <> #+end_src #+begin_src ledger :noweb yes :cmdline -F "%D\t%P\t%t\n" -p 2011/5 --unbudgeted reg ^Expenses <> #+end_src Evaluating these blocks produces the error. The problem appears to be the percentage signs. For example, the following works, producing two lines for the balance block shown above. #+begin_src ledger :noweb yes :cmdline -F "LINE\n" bal <> #+end_src #+results: : LINE : LINE * Expected results Here are the same commands (as I understand it) on the shell. Bundgeted accounts: #+begin_src sh cat sample.ledger | \ ledger -f - -F "%A\t%t\n" -p 2011/5 --budget -M reg ^Expenses #+end_src #+results: | Expenses:Food | -90,00 € | Unbudgeted expenses: #+begin_src sh cat sample.ledger | \ ledger -f - -F "%D\t%P\t%t\n" -p 2011/5 --unbudgeted reg ^Expenses #+end_src #+results: | 2011/05/13 | Taxi fare | 5,00 € |