ledger-mode icon indicating copy to clipboard operation
ledger-mode copied to clipboard

Add support for live preview of ledger xact output while adding transactions

Open bcc32 opened this issue 2 months ago • 3 comments

Add a new customization, ledger-add-transaction-idle-preview (enabled by default) to display a preview of the ledger xact output that would be inserted in the ledger buffer as the user is inputting a transaction text in ledger-add-transaction. (Also affects ledger-reconcile-add).

ledger xact's exact output can be quite unpredictable, since it is hard to remember exactly what payees exist in a ledger file, and since it depends on the most recent transactions that match the inputted strings. Displaying a live preview that can inform the user how to make their input more specific is a much nicer experience than "hit enter, see that the resulting transaction is wrong, undo, press C-c C-a again, enter date again, then press M-p to bring up previous input".

Close #456.

bcc32 avatar Dec 08 '25 01:12 bcc32

I've noticed at least one issue where the current version may sometimes swallow the user's input. I'll need to see if we're interacting with while-no-input in a bad way...

bcc32 avatar Dec 08 '25 01:12 bcc32

I've fixed the bad interactions with while-no-input by switching to make-process. This caused a performance hit, which I fixed by writing the buffer contents to a temp file, which is an improvement over call-process-region anyway.

bcc32 avatar Dec 09 '25 03:12 bcc32

... and, actually delete the temp file when we're done previewing.

bcc32 avatar Dec 09 '25 03:12 bcc32