Do you realize that there is a function to already do this in ledger mode? "clean up buffer"
On Mon, Jun 9, 2014 at 8:07 PM, Martin Blais <[email protected]> wrote: > On Mon, Jun 2, 2014 at 8:38 AM, Martin Blais <[email protected]> wrote: >> >> On Tue, May 20, 2014 at 9:00 AM, Martin Blais <[email protected]> wrote: >>> >>> On Tue, May 20, 2014 at 6:06 AM, Stefano Zacchiroli <[email protected]> >>> wrote: >>>> >>>> On Sat, May 17, 2014 at 11:37:01PM -0400, Martin Blais wrote:In >>>> particular, I'm personally annoyed that when I batchly update ledger >>>> >>>> files to rename accounts, transaction amounts easily become unaligned. >>>> So, before (git) committing I go through them with ledger-mode and C-c >>>> C-q them to fix alignment. I've written Python code to emit properly >>>> aligned transactions when generating transaction templates from my bank >>>> statements, but I haven't gone as far as doing that around plain old >>>> sed. >>>> >>>> Do your scripts take care of that too? >>> >>> >>> Not yet but it has been annoying me too. >>> >>> >>>> >>>> Do we need a ledger-sed or something of the sort? Or maybe something >>>> simpler, such as a ledger-indent? >>> >>> >>> I need one. I'll write one. This is an easy thing to do... I'll align on >>> the first currency to the position of the longest account + a few chars. >> >> >> Here's a quick and dirty one that works for my syntax: >> >> https://hg.furius.ca/public/beancount/file/743ca856e985/experiments/bean-format >> (or as beancount/experiments/bean-format in beancount source code) >> >> I'd be happy to extend it to support Ledger syntax to (or accept a patch). > > > In addition to bean-format, which processes an entire file, I thought it > might be useful to have a little function I can invoke within Emacs to align > all the prices. It's a bit crude, but I just put one together and it works: > beancount-align-transaction > > https://hg.furius.ca/public/beancount/file/677fc6a736af/src/elisp/beancount.el#l207 > > It's bound to "C-c ;" by default. > (In Beancount's rewrite, I'm trying to keep the editor support to its > absolute minimum, that is: A minor mode (so you can use any mode you like, > such as org-mode), account name completion (I don't support aliases, so you > do it via your editor), and now, a bit of alignment support.) > > -- > > --- > You received this message because you are subscribed to the Google Groups > "Ledger" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- Craig, Corona De Tucson, AZ enderw88.wordpress.com -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
