for a nice and tidy ledger I do two cleaning steps after having my entries in the ledger file and I am wondering how I could combine them to a single step.
First, I run (ledger-mode-clean-buffer) from within emacs to have all my manual edits aligned and everything chronological in order.
Second, I have a macro that jumps to the next comment and runs (ledger-post-align-dwim).
Does anyone know, how I can extend (ledger-mode-clean-buffer) to aling comments as well?
For context, this is how it looks right after csv import:
2023-02-01 GOODWORKS CORP
; Really long text with lots of numbers and descrition and a lot of whitespace actually and all the things that make my ledger not so pleasant to look at
assets:bank:checking $1000
income:salary $1000
and after cleaning
2023-02-01 GOODWORKS CORP
; Really long text with lots of numbers and descrition and a lot
; of whitespace actually and all the things that make my ledger
; not so pleasant to look at
assets:bank:checking $1000
income:salary $1000
Does anyone know enough elisp to add the function to ledger-mode-clean-buffer?
(If you have another approach, tidying your ledger, I am also interested in hearing it )
Thanks for your suggestion. It almost does what I want. However, there seems to be edge cases where it doesn't work.
Having a heading with a tag fills the collumn with the comment below... For example:
-2025-01-03 SHOPNAME ; tag:ABC
- ; some more information
+2025-01-03 SHOPNAME ; tag:ABC some
+ ; more information
Assests -16,00 €
Expenses 16,00 €
Not sure if it is worth the trouble to try to fix this. I think I should (and can) live with the burden of running two functions here....