John Rakestraw <[email protected]> writes: > Hi -- > > On Wed, 26 Oct 2011, TR wrote: >> I have a Reports.org file that has some babel blocks that call bash >> scripts that shoot reports back to the Reports file. These reports >> are folded into an outline format, each heading (usually) contains a >> table; payables, receivables, inc stmts, expense reports, etc. > > I'm interested in trying something like this for our personal finance > reports, so I'd love to have more info. > > Thanks.
Org mode has a sub-system known as babel which allows for literate programming. This allows you to mix text and code within the same document and automatically execute code which may generate results which will then appear in the text. One of the languages supported by org+babel is ledger so that you can have ledger commands embedded in a text file and have the output of ledger commands also appear in the text file. The output can be updated whenever any new ledger entries are added. For instance, the following org mode text document snippet illustrates a very naive but still useful of the org+babel system: --8<---------------cut here---------------start------------->8--- * A simple test of ledger in an org file The following are some entries and I have requested that ledger be run to generate a balance on the accounts. I could have asked for a register or, in fact, anything at all the ledger can do through command line options. #+begin_src ledger :cmdline -s bal :results value 2010/01/01 * Starting balance assets:bank:savings £1300.00 income:starting balances 2010/07/22 * Got paid assets:bank:chequing £1000.00 income:salary 2010/07/23 Rent expenses:rent £500.00 assets:bank:chequing #+end_src #+results: : £1800.00 assets:bank : £500.00 chequing : £1300.00 savings : £500.00 expenses:rent : £-2300.00 income : £-1000.00 salary : £-1300.00 starting balances --8<---------------cut here---------------end--------------->8--- Hiting C-c C-c anywhere in the "ledger source code block" will invoke ledger on the contents of that block and generate a "results" block. The results block can appear anywhere in the file but, by default, will appear immediately below the source code block. You can combine multiple source code blocks before executing ledger and do all kinds of other wonderful things with babel (and org). Highly recommended. I only use ledger through org these days (in fact, most of my programming and day to day management is done from within org mode in Emacs!). I wrote a tutorial that shows how to use ledger from org. You can find this on the Worg website: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-ledger.html HTH, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1 : using Org-mode version 7.7 (release_7.7.473.g23b81)
