Skip to content

Conversation

@bcc32
Copy link
Collaborator

@bcc32 bcc32 commented Dec 8, 2025

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 added 5 commits December 7, 2025 18:44
Elisp convention is that most functions may change the match data and the caller
is responsible for using save-match-data where needed.
This check should not run in temporary buffers that might be put into
ledger-mode for fontification purposes only.
@bcc32
Copy link
Collaborator Author

bcc32 commented Dec 8, 2025

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 bcc32 marked this pull request as draft December 8, 2025 01:38
@bcc32 bcc32 marked this pull request as ready for review December 9, 2025 03:23
@bcc32
Copy link
Collaborator Author

bcc32 commented Dec 9, 2025

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.

This is far faster, and means the buffer contents only need to be written once.
It is still read multiple times by ledger, but hopefully from the page cache
since the file is unchanged while the user adjusts their input.
@bcc32
Copy link
Collaborator Author

bcc32 commented Dec 9, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ledger-add-transaction candidate narrowing

1 participant