diff options
author | Craig Earls <enderw88@gmail.com> | 2013-03-13 11:27:51 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-03-13 11:27:51 -0700 |
commit | b608ed23e413aaec6024c42c453f8cd9854498d7 (patch) | |
tree | 5d05a01da9abc4128850ec0696ae1205431533e7 /lisp | |
parent | 027c03858d5292a2c66888133a5a464514f5a8ab (diff) | |
download | fork-ledger-b608ed23e413aaec6024c42c453f8cd9854498d7.tar.gz fork-ledger-b608ed23e413aaec6024c42c453f8cd9854498d7.tar.bz2 fork-ledger-b608ed23e413aaec6024c42c453f8cd9854498d7.zip |
Reconcile skips asking for target if there are no uncleared xacts.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/ldg-reconcile.el | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el index 37d6f32c..ec4b7f88 100644 --- a/lisp/ldg-reconcile.el +++ b/lisp/ldg-reconcile.el @@ -145,15 +145,16 @@ And calculate the target-delta of the account being reconciled." (ledger-display-balance))) (defun ledger-reconcile-refresh () - "Force the reconciliation window to refresh." + "Force the reconciliation window to refresh. +Return the number of uncleared xacts found." (interactive) (let ((inhibit-read-only t) (line (count-lines (point-min) (point)))) (erase-buffer) - (ledger-do-reconcile) - (set-buffer-modified-p t) - (goto-char (point-min)) - (forward-line line))) + (prog1 (ledger-do-reconcile) + (set-buffer-modified-p t) + (goto-char (point-min)) + (forward-line line)))) (defun ledger-reconcile-refresh-after-save () "Refresh the recon-window after the ledger buffer is saved." @@ -270,7 +271,7 @@ POSTING is used in `ledger-clear-whole-transactions' is nil." (nth 0 posting))))) ;; return line-no of posting (defun ledger-do-reconcile () - "Get the uncleared transactions in the account and display them in the *Reconcile* buffer." + "Return the number of uncleared transactions in the account and display them in the *Reconcile* buffer." (let* ((buf ledger-buf) (account ledger-acct) (ledger-success nil) @@ -318,7 +319,8 @@ POSTING is used in `ledger-clear-whole-transactions' is nil." (set-buffer-modified-p nil) (toggle-read-only t) - (ledger-reconcile-ensure-xacts-visible))) + (ledger-reconcile-ensure-xacts-visible) + (length xacts))) (defun ledger-reconcile-ensure-xacts-visible () "Ensures that the last of the visible transactions in the @@ -396,9 +398,8 @@ moved and recentered. If they aren't strange things happen." (save-excursion (if ledger-fold-on-reconcile (ledger-occur-mode account ledger-buf))) - (ledger-reconcile-refresh) - (goto-char (point-min)) - (ledger-reconcile-change-target) + (if (> (ledger-reconcile-refresh) 0) + (ledger-reconcile-change-target)) (ledger-display-balance)))) (defvar ledger-reconcile-mode-abbrev-table) |