diff options
author | Craig Earls <enderw88@gmail.com> | 2013-03-13 10:20:21 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-03-13 10:20:21 -0700 |
commit | c85f397edc33f895921b7900f938cd9cbb9f0e16 (patch) | |
tree | 1009fd8312eb6fa970c935294f7a8bfb902dd1ed | |
parent | b4fafbc94d97c3cab47b39e20e58dfab13f15033 (diff) | |
download | fork-ledger-c85f397edc33f895921b7900f938cd9cbb9f0e16.tar.gz fork-ledger-c85f397edc33f895921b7900f938cd9cbb9f0e16.tar.bz2 fork-ledger-c85f397edc33f895921b7900f938cd9cbb9f0e16.zip |
Cleaned up ledger-reconcile, easier to read, fewer lines of code.
-rw-r--r-- | lisp/ldg-reconcile.el | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el index 802cb3b4..9a6c7b67 100644 --- a/lisp/ldg-reconcile.el +++ b/lisp/ldg-reconcile.el @@ -363,6 +363,7 @@ POSTING is used in `ledger-clear-whole-transactions' is nil." ;; only one ;; *Reconcile* ;; buffer, ever + ;; Set up the reconcile buffer (if rbuf ;; *Reconcile* already exists (with-current-buffer rbuf (set 'ledger-acct account) ;; already buffer local @@ -371,31 +372,31 @@ POSTING is used in `ledger-clear-whole-transactions' is nil." (ledger-reconcile-quit-cleanup) (set 'ledger-buf buf))) ;; should already be ;; buffer-local - (if ledger-fold-on-reconcile - (ledger-occur-change-regex account ledger-buf)) - (set-buffer (get-buffer ledger-recon-buffer-name)) + (unless (get-buffer-window rbuf) - (ledger-reconcile-open-windows buf rbuf)) - (ledger-reconcile-refresh) - (goto-char (point-min)) - (setq ledger-target - (ledger-read-commodity-string "Set reconciliation target")) - (ledger-display-balance)) - - (progn ;; no recon-buffer, starting from scratch. - (add-hook 'after-save-hook 'ledger-reconcile-refresh-after-save nil t) - (if ledger-fold-on-reconcile - (ledger-occur-mode account buf)) - - (with-current-buffer (get-buffer-create ledger-recon-buffer-name) - (ledger-reconcile-open-windows buf (current-buffer)) - (ledger-reconcile-mode) - (set (make-local-variable 'ledger-buf) buf) - (set (make-local-variable 'ledger-acct) account) - (ledger-do-reconcile) - (set (make-local-variable 'ledger-target) - (ledger-read-commodity-string "Set reconciliation target")) - (ledger-display-balance)))))) + (ledger-reconcile-open-windows buf rbuf))) + + (progn ;; no recon-buffer, starting from scratch. + (add-hook 'after-save-hook 'ledger-reconcile-refresh-after-save nil t) + + (with-current-buffer (setq rbuf + (get-buffer-create ledger-recon-buffer-name)) + (ledger-reconcile-open-windows buf rbuf) + (ledger-reconcile-mode) + (make-local-variable 'ledger-target) + (set (make-local-variable 'ledger-buf) buf) + (set (make-local-variable 'ledger-acct) account)))) + + ;; Fold the ledger buffer + (if ledger-fold-on-reconcile + (ledger-occur-mode account buf)) + + ;; Now, actually run the reconciliation + (with-current-buffer rbuf + (ledger-reconcile-refresh) + (goto-char (point-min)) + (ledger-reconcile-change-target) + (ledger-display-balance)))) (defvar ledger-reconcile-mode-abbrev-table) |