summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-04-04 12:34:16 -0700
committerCraig Earls <enderw88@gmail.com>2013-04-04 12:34:16 -0700
commit2547894586b4fffb9782794e42ae62f1631d36ee (patch)
tree8adc7cfa74de77b34514a955ffb5e4db204200a5 /lisp
parent063b027fbbed83c0ccd9a43dff97204590a07f02 (diff)
downloadfork-ledger-2547894586b4fffb9782794e42ae62f1631d36ee.tar.gz
fork-ledger-2547894586b4fffb9782794e42ae62f1631d36ee.tar.bz2
fork-ledger-2547894586b4fffb9782794e42ae62f1631d36ee.zip
Fix next-account so that status markers can be manually entered into a buffer when auto alignment is on.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ldg-post.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/ldg-post.el b/lisp/ldg-post.el
index 88387fd1..18a70b1a 100644
--- a/lisp/ldg-post.el
+++ b/lisp/ldg-post.el
@@ -136,13 +136,17 @@ at beginning of account"
(if (> end (point))
(when (re-search-forward ledger-account-any-status-regex (1+ end) t)
;; the 1+ is to make sure we can catch the newline
- (goto-char (match-beginning 2))
+ (if (match-beginning 1)
+ (goto-char (match-beginning 1))
+ (goto-char (match-beginning 2)))
(current-column))))
(defun ledger-post-align-postings (&optional beg end)
"Align all accounts and amounts within region, if there is no
region align the posting on the current line."
(interactive)
+ (assert (eq major-mode 'ledger-mode))
+
(save-excursion
(if (or (not (mark))
(not (use-region-p)))
@@ -245,7 +249,7 @@ BEG, END, and LEN control how far it can align."
(defun ledger-post-setup ()
"Configure `ledger-mode' to auto-align postings."
(add-hook 'after-change-functions 'ledger-post-maybe-align t t)
- (add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil))))
+ (add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil)) t t))
(defun ledger-post-read-account-with-prompt (prompt)