diff options
author | Craig Earls <enderw88@gmail.com> | 2013-03-25 23:50:26 -0400 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-03-25 23:50:26 -0400 |
commit | b947bae1a8bf9a9ca326db46d8f5c907bedc3f1c (patch) | |
tree | 5f49ed854f67039341d8f641b54dff5c550984d3 /lisp/ldg-post.el | |
parent | bc7a885eb711f4a6cf83d8e7701d90f0079e0359 (diff) | |
download | fork-ledger-b947bae1a8bf9a9ca326db46d8f5c907bedc3f1c.tar.gz fork-ledger-b947bae1a8bf9a9ca326db46d8f5c907bedc3f1c.tar.bz2 fork-ledger-b947bae1a8bf9a9ca326db46d8f5c907bedc3f1c.zip |
Fix align-postings to deal with being at end of buffer
Diffstat (limited to 'lisp/ldg-post.el')
-rw-r--r-- | lisp/ldg-post.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el index 5ac97893..702518d3 100644 --- a/lisp/ldg-post.el +++ b/lisp/ldg-post.el @@ -186,7 +186,8 @@ region align the posting on the current line." (end-region (if end end (if mark-first (point-marker) (mark-marker)))) - acc-col amt-offset acc-adjust) + acc-col amt-offset acc-adjust + (lines-left 1)) ;; Condition point and mark to the beginning and end of lines (goto-char end-region) (setq end-region (copy-marker (line-end-position))) @@ -195,7 +196,8 @@ region align the posting on the current line." (setq begin-region (copy-marker (line-beginning-position)))) (while (or (setq acc-col (ledger-next-account (end-of-line-or-region end-region))) - (< (point) (marker-position end-region))) + (and (< (point) (marker-position end-region)) + (> lines-left 0))) (when acc-col (setq acc-adjust (- ledger-post-account-alignment-column acc-col)) (if (/= acc-adjust 0) @@ -207,7 +209,7 @@ region align the posting on the current line." (current-column)))) (if (/= amt-adjust 0) (ledger-post-adjust amt-adjust))))) - (forward-line)) + (setq lines-left (forward-line))) (if has-align-hook (add-hook 'after-change-functions 'ledger-post-maybe-align t t))))) |