Ciao Stefano, On 07/07/2020 01:08, Stefano Zacchiroli wrote:
> I agree it looks like quite a burden for a single tool --- even though I > think it's a very important one to have, due to the intrinsic nature of > plain text accounting. And also, the alternative looks worse to me: > people just sed or search/replace in their ledgers messing up spacing or > worse. I don't think the user experience in doing that is great, and > that affects our user base. I do mechanical transformations to my ledger in Emacs and with a tiny bit of Emacs list all transformations I've done so far were very easy to implement. I can see how an imperative way to perform those operations may be interesting for those not familiar with a less programmable text editor, but I am not sure I would design Beancount around that. > There is an alternative though. Define a single canonical way to indent > Beancount textual ledgers and have a tool like Python's Black that > reformats a Beancount ledger (or even isolated directives) that way. > Right now there are some ambiguities, e.g., do you indent a metadata > attached to a transaction leg or not? Do you put them on the same line > of the transaction leg or on the line beneath it? Etc. And it gets > tricky with comments (which generally you want to keep as-is), both in > general and even more so when they are mixed with tags. If you have such > an "opinionated" pretty printer you can do all your changes on the AST > and just pretty print your result. In a way Emacs is my way to enforce a consistent formatting. I see the value in an automatic indentation and re-formatting tool for Beancount, but I am not sure it should live in Beancount itself. Cheers, Dan -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to beancount+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/992982bb-ea6d-8816-25f4-e94ea8cd508f%40grinta.net.