narendraj9 / hledger-mode

An Emacs major mode for Hledger
GNU General Public License v3.0
227 stars 22 forks source link

How to add custom reports #34

Open DamienCassou opened 3 years ago

DamienCassou commented 3 years ago

Hi,

I maintain budget accounts and would appreciate seeing a report showing them. With ledger-mode, I configure ledger-reports with an item such as:

("Budget" "%(binary) -f %(ledger-file) balance --empty --sort account ^Budget and not \\(Unbudgeted\\)")

Is there a way to configure user-specific reports?

narendraj9 commented 3 years ago

With the current implementation, there is no way to specify a custom report. We would need to modify hledger-run-command function to read the hledger command to execute from a configurable variable as ledger-mode does.

We can implement that by looking command here (https://github.com/narendraj9/hledger-mode/blob/bad680b33c2ca20a6088986a10735a5df3cb9996/hledger-reports.el#L309) in an association list (similar to ledger-reports) and use the associated command in place of the input command string if there is a mapping.