John Rakestraw <[email protected]>
writes:

> Hi, Eric --
>
> On Fri, 28 Oct 2011, Eric S Fraga wrote:
>> 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.
>
> Thanks for this message, Eric.

You're very welcome!

> I've played around with babel a bit and I'd even worked through your
> tutorial for using ledger with org mode. But I think I must be
> misunderstanding something. When I put my ledger file (~30K lines) in a
> src block, I can run the reports as you suggest. That's cool. But editing
> the file is painfully slow -- as much as 3 or 4 seconds lag time between
> key presses and characters appearing on the screen. 

What version of org are you currently using?

Do you have org-src-fontify-natively set?  This can be a source of speed
issues in Emacs, especially for such a large source code block.  It
might be good to turn fontification off; alternatively, you might find
it useful to start up with src blocks hidden by default:

   #+startup: hideblocks

as this will help avoid problems with speed in scrolling etc.  For editing,
I would recommend using the special editing mode, ledger mode in this
case.  You can invoke this mode by "C-c '" from within the source block;
same key sequence to come back to the full org buffer.  But you probably
know this already!

When you do use the special editing mode, all the ledger code will be
indented but this will not cause a problem with ledger if using a recent
org version as the code is un-indented prior to passing to ledger.

> Executing a
> babel/ledger command also indents all of the ledger entries a couple of
> spaces, and then commands run on the ledger file from the command line
> don't recognize the entries as ledger entries. (Reports generated from
> within src blocks are produced just fine.) I suspect it's operator error,
> but I've not figured it out.

Strange; executing a source block should not change the indentation of
the source block itself...  What keystroke are you actually using to
invoke babel?

> I spend virtually all of my time in emacs, too -- even though I'm a
> humanities academic and definitely *not* a programmer -- but I input
> ledger entries using ledger.el and generate reports from there using
> report queries stored in my .emacs file. Here's an example from my .emacs:
>
> ("checking future" "ledger -d 'd>=[this month]' -F '%10(date) %6(code)
> %-.40(payee) %14(amount) %14(display_total)\n' reg checking")
>
> I also have bash scripts that generate daily emails with some budget
> information and also a more complete budget report in a pdf. I'm intrigued
> by TR's approach -- it hadn't occurred to me to put bash scripts in babel
> src blocks. I'm playing around with that now.

Keep us posted!  This sounds quite interesting.

HTH,
eric
-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.90.1 + No Gnus v0.18

Reply via email to