A User's view of Hledger

Learning about hledger

ledger-occur

If you use Emacs and ledger mode, you have access to a very hand feature called ledger-occur.

If you are not familiar with this, the idea is that you can limit the transactions you see to only those that match what you specify. For example, let’s say that you want to see only the transactions pertaining to your electric bill. If the payee is ACME Power, specify “ACME” or “ACME Power” as the matching text, and you will see only the transactions that include that text.

Ledger-occur helped me the other day when I entered a charge to a wrong credit card. One solution would have been to go to the data file, delete the whole transaction, go back to the command line, and finally use iadd to enter the transaction correctly.

I chose instead to make the change directly in the text file. That is, I deleted the transaction category belonging to the erroneous credit card and replaced it with the correct transaction category. The problem, however, for me is making sure that I got the replacement transaction category exactly correct. Specifically, I didn’t need something that sounds right; I needed something that exactly matches the categories for the previous charges against this card.

To see the correct information, I invoked occur-mode to show similar transactions that I had entered in the past, ones that were charged to the credit card for which I need to confirm the transaction category. Now I could make my correction to the just-entered transaction, knowing that it had the correct transaction category.

Note: A previous version of this post had the wrong name for ledger-occur. I updated the text so that it had the correct name.