summaryrefslogtreecommitdiff
path: root/lisp/ledger-mode.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2015-11-04 19:19:07 -0700
committerCraig Earls <enderw88@gmail.com>2015-11-04 19:19:07 -0700
commitcb05126e18f4d2fa5aa18cdb5a6af03436962068 (patch)
tree2691f85ddd6c90c986a821bc646f5d0f582a7217 /lisp/ledger-mode.el
parent1cf83c6f5f5d005fb143f34b32b86bb838cd9674 (diff)
parentd38f8d3bff66e89cc79b1791566fdf9eca62a8e9 (diff)
downloadfork-ledger-cb05126e18f4d2fa5aa18cdb5a6af03436962068.tar.gz
fork-ledger-cb05126e18f4d2fa5aa18cdb5a6af03436962068.tar.bz2
fork-ledger-cb05126e18f4d2fa5aa18cdb5a6af03436962068.zip
Merge commit 'd38f8d3bff66e89cc79b1791566fdf9eca62a8e9' into next
Diffstat (limited to 'lisp/ledger-mode.el')
-rw-r--r--lisp/ledger-mode.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index 30f25dfc..26de84fc 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -125,14 +125,19 @@
": "))
nil 'ledger-minibuffer-history default))
-(defun ledger-display-balance-at-point ()
+(defun ledger-display-balance-at-point (&optional arg)
"Display the cleared-or-pending balance.
-And calculate the target-delta of the account being reconciled."
- (interactive)
+And calculate the target-delta of the account being reconciled.
+
+With prefix argument \\[universal-argument] ask for the target commodity and convert
+the balance into that."
+ (interactive "P")
(let* ((account (ledger-read-account-with-prompt "Account balance to show"))
+ (target-commodity (when arg (ledger-read-commodity-with-prompt "Target commodity: ")))
(buffer (current-buffer))
(balance (with-temp-buffer
- (ledger-exec-ledger buffer (current-buffer) "cleared" account)
+ (apply 'ledger-exec-ledger buffer (current-buffer) "cleared" account
+ (when target-commodity (list "-X" target-commodity)))
(if (> (buffer-size) 0)
(buffer-substring-no-properties (point-min) (1- (point-max)))
(concat account " is empty.")))))