diff options
author | Craig Earls <enderw88@gmail.com> | 2013-04-08 10:35:55 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-04-08 10:35:55 -0700 |
commit | 33c046d06876915864de397ed1c3d8d671ffd1db (patch) | |
tree | e3ca8c020b0d40c050af88bda072ece0928e0767 /lisp/ldg-mode.el | |
parent | 98f8df5583f16792243aeadee9ed19bd8b3f7897 (diff) | |
download | fork-ledger-33c046d06876915864de397ed1c3d8d671ffd1db.tar.gz fork-ledger-33c046d06876915864de397ed1c3d8d671ffd1db.tar.bz2 fork-ledger-33c046d06876915864de397ed1c3d8d671ffd1db.zip |
Added quick balance check to ledger-mode
Diffstat (limited to 'lisp/ldg-mode.el')
-rw-r--r-- | lisp/ldg-mode.el | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lisp/ldg-mode.el b/lisp/ldg-mode.el index 6dea1735..98236980 100644 --- a/lisp/ldg-mode.el +++ b/lisp/ldg-mode.el @@ -56,6 +56,21 @@ ": ")))) (read-string default-prompt nil 'ledger-minibuffer-history default))) +(defun ledger-display-balance-at-point () + "Display the cleared-or-pending balance. +And calculate the target-delta of the account being reconciled." + (interactive) + + (let* ((account (ledger-read-account-with-prompt "Account balance to show")) + (pending (ledger-reconcile-get-cleared-or-pending-balance (current-buffer) account))) + (when pending + (if ledger-target + (message "Pending balance: %s, Difference from target: %s" + (ledger-commodity-to-string pending) + (ledger-commodity-to-string (-commodity ledger-target pending))) + (message "Pending balance: %s" + (ledger-commodity-to-string pending)))))) + (defun ledger-magic-tab (&optional interactively) "Decide what to with with <TAB> . Can be pcomplete, or align-posting" @@ -120,6 +135,7 @@ Can be pcomplete, or align-posting" (define-key map [(control ?c) (control ?t)] 'ledger-insert-effective-date) (define-key map [(control ?c) (control ?u)] 'ledger-schedule-upcoming) (define-key map [(control ?c) (control ?y)] 'ledger-set-year) + (define-key map [(control ?c) (control ?p)] 'ledger-display-balance-at-point) (define-key map [tab] 'ledger-magic-tab) (define-key map [(control ?i)] 'ledger-magic-tab) (define-key map [(control ?c) tab] 'ledger-fully-complete-xact) @@ -163,6 +179,7 @@ Can be pcomplete, or align-posting" (define-key map [toggle-xact] '(menu-item "Toggle Current Transaction" ledger-toggle-current-transaction)) (define-key map [sep4] '(menu-item "--")) (define-key map [recon-account] '(menu-item "Reconcile Account" ledger-reconcile)) + (define-key map [check-balance] '(menu-item "Check Balance" ledger-display-balance-at-point)) (define-key map [sep6] '(menu-item "--")) (define-key map [edit-amount] '(menu-item "Calc on Amount" ledger-post-edit-amount)) (define-key map [sep] '(menu-item "--")) |