summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/ldg-reconcile.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/ldg-reconcile.el b/lisp/ldg-reconcile.el
index ed974a1e..395266e3 100644
--- a/lisp/ldg-reconcile.el
+++ b/lisp/ldg-reconcile.el
@@ -24,6 +24,7 @@
(defvar ledger-buf nil)
(defvar ledger-bufs nil)
(defvar ledger-acct nil)
+
(defcustom ledger-recon-buffer-name "*Reconcile*"
"Name to use for reconciliation window"
:group 'ledger)
@@ -33,6 +34,12 @@
matching the reconcile regex"
:group 'ledger)
+(defcustom ledger-buffer-tracks-reconcile-buffer t
+ "if t, then when the cursor is moved to a new xact in the recon
+ window, then that transaction will be shown in its source
+ buffer."
+ :group 'ledger)
+
(defun ledger-display-balance ()
"Calculate the cleared balance of the account being reconciled"
(interactive)
@@ -231,6 +238,22 @@
(select-window recon-window))))
+(defun ledger-reconcile-track-xact ()
+ (if (or (eq this-command 'next-line)
+ (eq this-command 'previous-line)
+ (eq this-command 'mouse-set-point))
+ (let* ((where (get-text-property (point) 'where))
+ (target-buffer (ledger-reconcile-get-buffer
+ where))
+ (cur-buf (current-buffer)))
+ (when target-buffer
+ (switch-to-buffer-other-window target-buffer)
+ (goto-char (cdr where))
+ (recenter)
+ (switch-to-buffer-other-window cur-buf)
+ ))))
+
+
(defun ledger-reconcile (account)
(interactive "sAccount to reconcile: ")
(let ((buf (current-buffer))
@@ -240,6 +263,7 @@
(quit-window (get-buffer-window rbuf))
(kill-buffer rbuf)))
(add-hook 'after-save-hook 'ledger-reconcile-refresh-after-save)
+ (add-hook 'post-command-hook 'ledger-reconcile-track-xact)
(if ledger-fold-on-reconcile
(ledger-occur-mode account buf))