# Beancount txn parser/writer in Emacs Lisp?

**URL:** <https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314>\
**Category:** General\
**Tags:** beancount, emacs\
**Created:** [July 25, 2024, 8:49pm UTC](https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314 "2024-07-25T20:49:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![TRS-80](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/trs-80/32/92_2.png) [@TRS-80](https://forum.plaintextaccounting.org/u/TRS-80)\
**Post date:** [July 25, 2024, 8:49pm UTC](https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314/1 "2024-07-25T20:49:41Z")

</div>

Hi friends,

Over the last years I seem to have implemented some hacky parts of this here and there, and was about to start working on pulling it together properly into a library, and perhaps even publishing it at some point. However I thought I would check around and see if anyone else did it already (as I have a bad habit of re-implementing things that already exist).

I searched the official [Beancount mailing list](https://groups.google.com/g/beancount), as well as the [Library section](https://plaintextaccounting.org/#library) of the PTA website, but only found some Rust and tree-sitter based parsers[0]. Maybe that's a better way to go about it, but I don't know Rust (nor tree-sitter) and so...

Why else? Because I don't particularly like Python, I just prefer working on my books in Emacs and often find myself writing my own tools in Emacs Lisp (generally speaking).

I plan on sending this to the Beancount mailing list, as well as maybe r/plaintextaccounting, so apologies if you frequent any of those and see it duplicated.

Any thoughts would be appreciated.

[0] Which seem to be, to date, apparently WIP/incomplete(?).

---

<div class="post-metadata">

**Author:** ![TRS-80](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/trs-80/32/92_2.png) [@TRS-80](https://forum.plaintextaccounting.org/u/TRS-80)\
**Post date:** [August 2, 2024, 2:47pm UTC](https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314/2 "2024-08-02T14:47:41Z")

</div>

I am very pleased to announce the initial release of my parser/writer library!

beancount-txn-elisp

A library to read/parse and write/insert individual Beancount transactions, implemented in Emacs Lisp.

Please try to break it! 😃 And let me know if you are successful.

[https://sr.ht/~trs-80/beancount-txn-elisp/](https://sr.ht/~trs-80/beancount-txn-elisp/)

---

<div class="post-metadata">

**Author:** ![TRS-80](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/trs-80/32/92_2.png) [@TRS-80](https://forum.plaintextaccounting.org/u/TRS-80)\
**Post date:** [December 20, 2025, 7:16pm UTC](https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314/3 "2025-12-20T19:16:12Z")

</div>

## Version 0.1.0 published

I just wanted to publish an update. I’ve been using (and improving) my little library this whole time, fixing bugs, adding (small) features, etc. I use it multiple times per week, it’s a big (if underlying) part of my almost completely automated system, I probably couldn’t really do PTA without it.

I just published version 0.1.0, the main feature is “categorizer” support. If you set the variable `bean-txn-categorizer` (which see) to the name of some function, the TXN-FORM will be passed through said function and modified however you like.

Change log:

> **[~trs-80/beancount-txn-elisp: master - sourcehut git](https://git.sr.ht/~trs-80/beancount-txn-elisp/log)**

Enjoy!

---

<div class="post-metadata">

**Author:** ![simonmic](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/simonmic/32/1_2.png) [@simonmic](https://forum.plaintextaccounting.org/u/simonmic)\
**Post date:** [December 20, 2025, 8:15pm UTC](https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314/4 "2025-12-20T20:15:36Z")

</div>

Very cool. How does this fit into your workflow ? Does it make editing the journal easier ?

---

<div class="post-metadata">

**Author:** ![TRS-80](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.plaintextaccounting.org/trs-80/32/92_2.png) [@TRS-80](https://forum.plaintextaccounting.org/u/TRS-80)\
**Post date:** [December 20, 2025, 8:32pm UTC](https://forum.plaintextaccounting.org/t/beancount-txn-parser-writer-in-emacs-lisp/314/5 "2025-12-20T20:32:14Z")

</div>

> [@simonmic](#):
>
> How does this fit into your workflow ? Does it make editing the journal easier ?

To answer directly, not really, at least not in terms of what I would consider “editing.”

As I think I hinted at, I am using this as more of an underlying library, to be used by other things.

I should probably state that I am not doing the typical straight “import” that most seem to be (bank CSV or whatever). I mean, I used to do that. But I didn’t like it (I found the bank descriptions ugly, quite frankly, lol).

Some things I do, for example:

Take photo of receipt and upload to → Veryfi API → then download jpg, PDF, txt, and JSON[0] of receipt → replace original local file and generate Beancount txn automatically from that.

It’s that latter part (writing the Beancount txn) that I use this for.

I also updated my transfer function (and others) to use this library now.

Then I reconcile my txns, which I get from SimpleFIN API. If I missed any (exist in bank’s records but not mine), I can hit a key “(w)rite” and that also uses this library.

etc…

[0] This is where Veryfi really shines. They not only crop and do OCR, they return JSON of all relevant individual fields as key-value pairs (date, card number, vendor, and many more…).
