summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorMatus Goljer <matus.goljer@gmail.com>2015-09-19 13:57:13 +0200
committerMatus Goljer <matus.goljer@gmail.com>2015-09-19 13:57:13 +0200
commite6a2579f349d7935657d20344115bb6903ea707d (patch)
tree48b3980be60ab38bc3395b8af48acd6d7802d0e0 /lisp
parent88ad616d18b69eb03bc14eaa9ce6b32be90867a6 (diff)
downloadfork-ledger-e6a2579f349d7935657d20344115bb6903ea707d.tar.gz
fork-ledger-e6a2579f349d7935657d20344115bb6903ea707d.tar.bz2
fork-ledger-e6a2579f349d7935657d20344115bb6903ea707d.zip
Add a function to "dwim" align.
If no region is active, align the current transaction. If a region is active, align all postings in the region.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-post.el7
1 files changed, 7 insertions, 0 deletions
diff --git a/lisp/ledger-post.el b/lisp/ledger-post.el
index 21e856db..f648ea8f 100644
--- a/lisp/ledger-post.el
+++ b/lisp/ledger-post.el
@@ -146,6 +146,13 @@ at beginning of account"
(setq lines-left (not (eobp)))))
(setq inhibit-modification-hooks nil))))
+(defun ledger-post-align-dwim ()
+ "Align all the posting of the current xact the current region."
+ (interactive)
+ (if (use-region-p)
+ (call-interactively 'ledger-post-align-postings)
+ (call-interactively 'ledger-post-align-xact)))
+
(defun ledger-post-edit-amount ()
"Call 'calc-mode' and push the amount in the posting to the top of stack."
(interactive)