Beancount-multi-file Emacs Lisp helpers / library to facilitate multiple files (and sets of books)

I decided I wanted to do the multiple file approach, in my case I keep one “ledger”[0] file for each bank account, credit card, AR / AP account (or whatever).

I wrote some helper functions (in Emacs Lisp) to facilitate changing ledger files easily, do transfers, set/change default ledger file and/or “entity” (company or person, etc.).

One of my favorite is probably the “snarf” function which will relocate the txn at point to the appropriate ledger file and date location.[1]

This one probably needs more cleanup (well, just need to write some documentation, really) than others to publish, but I could perhaps make the effort if there is any interest.

[0] Sorry, I realize this is probably an overloaded term, but not sure what else to call it, within the context of my package.

[1] Yes I realize date order does not “really” matter to the Beancount parser, but I’m OCD and like to keep my files in order anyway.

What's your policy for recording inter account transfers ?

I think what I do is pretty typical (using an intermediate ‘Transfers’ account) perhaps best illustrated by a simple example:

# Beancount

2025-12-20 ! "(self)" "transfer A to B" ^xfer_A_B_2025-12-20_100.00
  date-txn: 2025-12-20
  date-entered: 2025-12-20
  source: "my-beancount-transfer-insert"
  Assets:CapitalOne:Checking-A                                -100.00 USD
  Assets:Transfers

2025-12-20 ! "(self)" "transfer A to B" ^xfer_A_B_2025-12-20_100.00
  date-txn: 2025-12-20
  date-entered: 2025-12-20
  source: "my-beancount-transfer-insert"
  Assets:Chase:Checking-B                                      100.00 USD
  Assets:Transfers

Some things to point out (in case anyone is not familiar with Beancount syntax):

^xfer_A_B_2025-12-20_100.00

This is a “link” in Beancount (which links the 2 transactions together). I made a simple function to dynamically generate this (based on account “letter” shorthand, date, and amount, which combine to make a “unique enough” identifier).

I also include some metadata, which I feel is relevant (of course you don’t have to).

Above is generated by an (Emacs Lisp) function (my-beancount-transfer-insert) which prompts for “from account”, and “to account” (using completing-read), and amount, and then generates the txns accordingly. It then calls the bmf-txn-snarf-refile function (from this library) (twice) which relocates them to the appropriate location (by ledger file and date) which I find really handy. :slight_smile: