summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2015-09-21 07:41:33 -0700
committerCraig Earls <enderw88@gmail.com>2015-09-21 07:41:33 -0700
commit5f2f8e50b3a8464c58857c334ee10027693c4f78 (patch)
tree751250d9943e5d67d7c4bc8204e74e08297d87a4 /lisp
parentfd6fabbedcea479b2af7c166bb977ac51c317317 (diff)
parent1995a7e0ac748f6709e5051780468361bfee654d (diff)
downloadfork-ledger-5f2f8e50b3a8464c58857c334ee10027693c4f78.tar.gz
fork-ledger-5f2f8e50b3a8464c58857c334ee10027693c4f78.tar.bz2
fork-ledger-5f2f8e50b3a8464c58857c334ee10027693c4f78.zip
Merge pull request #431 from Fuco1/add-dwim-align
Add dwim align Thank you.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ledger-mode.el1
-rw-r--r--lisp/ledger-post.el7
2 files changed, 8 insertions, 0 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index f2eb4b21..30f25dfc 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -285,6 +285,7 @@ With a prefix argument, remove the effective date."
(define-key map [(meta ?p)] 'ledger-navigate-prev-xact-or-directive)
(define-key map [(meta ?n)] 'ledger-navigate-next-xact-or-directive)
+ (define-key map [(meta ?q)] 'ledger-post-align-dwim)
map)
"Keymap for `ledger-mode'.")
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)