Added ability to have ledger buffer track the xact under point in recon window
controllable using ledger-buffer-tracks-reconcile-buffer
This commit is contained in:
parent
e3be9686e4
commit
5f67cfbec7
1 changed files with 24 additions and 0 deletions
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue