summaryrefslogtreecommitdiff
path: root/lisp/ledger-sort.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-09-13 17:11:40 -0700
committerCraig Earls <enderw88@gmail.com>2014-09-13 17:11:40 -0700
commit84dc532b0688431d0964736f6a5d7b3804b5e903 (patch)
treecf9ecfedd64df4be947fabeb4d6872256810df5f /lisp/ledger-sort.el
parent20dd0b706a2536d16b3719667351cb8ff3ce009f (diff)
downloadfork-ledger-84dc532b0688431d0964736f6a5d7b3804b5e903.tar.gz
fork-ledger-84dc532b0688431d0964736f6a5d7b3804b5e903.tar.bz2
fork-ledger-84dc532b0688431d0964736f6a5d7b3804b5e903.zip
everything appears to work with no empty lines between xacts.
Diffstat (limited to 'lisp/ledger-sort.el')
-rw-r--r--lisp/ledger-sort.el25
1 files changed, 21 insertions, 4 deletions
diff --git a/lisp/ledger-sort.el b/lisp/ledger-sort.el
index 10018149..41f8af3c 100644
--- a/lisp/ledger-sort.el
+++ b/lisp/ledger-sort.el
@@ -28,17 +28,34 @@
(defun ledger-next-record-function ()
"Move point to next transaction."
+ ;; make sure we actually move to the next xact, even if we are the
+ ;; beginning of one now.
(if (looking-at ledger-payee-any-status-regex)
- (forward-line)) ;; make sure we actually move to the next xact,
- ;; even if we are the beginning of one now.
+ (forward-line))
(if (re-search-forward ledger-payee-any-status-regex nil t)
(goto-char (match-beginning 0))
(goto-char (point-max))))
+(defun ledger-prev-record-function ()
+ "Move point to beginning of previous xact."
+ (ledger-beginning-record-function)
+ (re-search-backward ledger-xact-start-regex nil t))
+
+(defun ledger-beginning-record-function ()
+ "Move point to the beginning of the current xact"
+ (interactive)
+ (unless (looking-at ledger-xact-start-regex)
+ (re-search-backward ledger-xact-start-regex nil t)
+ (beginning-of-line))
+ (point))
+
(defun ledger-end-record-function ()
- "Move point to end of transaction."
+ "Move point to end of xact."
+ (interactive)
(ledger-next-record-function)
- (backward-char))
+ (backward-char)
+ (end-of-line)
+ (point))
(defun ledger-sort-find-start ()
(if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t)