ledger-mode
ledger-mode copied to clipboard
ledger-add-xact fails in an empty buffer ignoring main ledger file
Hi, I am having issues running C-c C-a
bound to ledger-add-transaction
in a new file that has no transaction. The issue is that ledger xact
executed from ledger-add-transaction
returns no matches.
Relevant setup is the following:
-
main.journal
with includes files and contains historical transactions -
new.journal
which I create and would like to fill with new transaction usingC-c C-a
functionality
I use ledger-mode
in Doom Emacs through straight. I have set these variables for ledger-mode
:
(setq ledger-init-file-name (expand-file-name "~/Documents/Finances/Private/main.journal")
ledger-accounts-file (expand-file-name "~/Documents/Finances/Private/meta.journal")
ledger-binary-path "/opt/homebrew/bin/ledger"
ledger-default-date-format ledger-iso-date-format
ledger-highlight-xact-under-point nil)
When I run C-c C-a
with any date and uber
, ledger-mode raises error:
Error: No accounts, and no past transaction matching 'uber'
However, in cli, ledger xact 2023-11-11 uber
would give a match
2024-03-20 Uber
Expenses:Transport:Cabs EUR 53.36
Assets:Visa
I suspect the error occurs here in ledger-exec-ledger code. In fact, (ledger-master-file)
resolves to the current buffer, new.journal
, which is empty, and so as far as I see ledger xact
is called via call-process-region
with just contents of the new.journal
file, i.e. with no historical transactions.
Am I missing anything to make C-c C-a
work in the config, that is, to receive ledger-init-file-name
or have ledger-master-file
properly resolved? I tried setting it as a variable, but that leads to C-c C-a
just failing with an error Ledger execution failed
. Thanks :)