A User's view of Hledger

Learning about hledger

Getting narrow minded in Emacs

Last week I closed out 2023, creating a separate file for my 2024 transactions.

In spite of having 4 months of data in my new file, there was one instance this week where I was entering a transaction with a certain payee for the first time in 2024. If I had previously entered that payee this year, hledger add would have been able to prompt me with the previous values in the transaction, many of which I could have simply accepted as defaults.

However, the previous transaction was now in the 2023 file. How to make sure that the latest transaction matched the previous ones in terms of categories and exact payee name?

Since I use Emacs and ledger mode with my hledger data files, one relatively easy solution was to open the 2023 file and use narrowing (C-c C-f). Narrowing, done properly, quickly winnows the transactions shown to just a few likely candidates.

Let’s say, for example, that you are transferring money from a checking account to a savings account. The last time you did this was in 2023, and all the 2023 data is in a separate file. So, the hledger add command, used against the 2024 file has no history to draw from. To get around this, you open up 2023 in Emacs, using ledger mode. If you remember that you used the word “transfer” in the previous transaction, you narrow to “transfer.” Emacs shows you just the transactions containing the word “transfer.” With just a few transactions showing, you find the applicable one and remind yourself of the pertinent details such as the categories and exact payee name, which you would want to keep the same in the new transaction.

FYI, there is a command line solution to the above problem that would have been faster. At least I once saw a reference to it. But I didn’t remember it, and this was one of those cases where finding the faster solution would have taken more time than implementing the slower solution. Not ideal, but gets an infrequent job done.