Announcing beancount-txn, a parser/writer for Beancount txns, implemented in Emacs Lisp

133 views
Skip to first unread message

TRS-80

unread,
Aug 2, 2024, 10:53:29 AM8/2/24
to bean...@googlegroups.com

Hello friends,

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! :D And let me know if you are successful.

https://sr.ht/~trs-80/beancount-txn-elisp/

--
Cheers,
TRS-80

Stefano Merlo

unread,
Aug 5, 2024, 2:15:17 PM8/5/24
to Beancount
Hello,
    I am implementing the writer functions in my commands. Some early comments:
- there are several hard-coded entities that I would try to eliminate, such as the test file rows to parse: I'd rather write a string on a temp buffer to parse. I'll submit a proposed change
- another hard-coded entity is the order of the arguments of the txn-form: personal preference, I'd have used a plist, also to eliminate many nils when passing the txn-form to the writer. I might also propose a change
- in parallel I'll write test cases for the writer

--Stefano

TRS-80

unread,
Aug 13, 2024, 9:07:30 AM8/13/24
to bean...@googlegroups.com
Hi Stefano,

Thanks for kicking the tires!

Stefano Merlo <trepr...@gmail.com> writes:

> - there are several hard-coded entities that I would try to eliminate,
> such as the test file rows to parse: I'd rather write a string on a
> temp buffer to parse. I'll submit a proposed change

Yes, I was just kind of in a hurry to get some tests written. Plus I'm
fairly new at writing tests and using ert. So, if you have some better
ideas, I am open to them.

> - another hard-coded entity is the order of the arguments of the
> txn-form: personal preference, I'd have used a plist, also to
> eliminate many nils when passing the txn-form to the writer. I might
> also propose a change

Unless I am misunderstanding you (or there is a better way I did not
consider), I think the txn-form itself needs to be "hard coded" as it's
essentially a data structure to pass back and forth between parser and
writer. I did it this way to preserve the structure and relationships
of all the txn elements (and their associated metadata) as a nested
list.

But maybe you meant the arguments to the functions `bean-txn-insert' and
`bean-txn-format' for example? If so, I take your point. I see how
that could be cumbersome entering all those extra nils, especially
seeing how `postings' is at the very end, and arguably the most common
argument.

Maybe a good way to do that would be to write another wrapper function
that accepts a plist as arguments and then converts them to the order
that those functions expect. This way everyone can have it however they
like. Or maybe I should just change the interface. I am not sure yet,
but I will think about it.

> - in parallel I'll write test cases for the writer

This would be lovely! As you maybe saw in the README, I did not get
around to it yet.

I was lucky to have some free time on my hands, and get this project in
a good enough state to be usable and release it. However going forward
I am going to have to get back to work here very soon and all that nice
free time is going to evaporate, unfortunately. But I will try and at
least keep in touch on the mailing list as time allows, and especially
respond to the mailing list / issue tracker at my project repository.
Although my responses may become delayed. So I wanted to at least
mention this.

--
Cheers,
TRS-80

Reply all
Reply to author
Forward
0 new messages