diff options
author | Craig Earls <enderw88@gmail.com> | 2014-09-13 18:20:03 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2014-09-13 18:20:03 -0700 |
commit | 7846e7c17ae31fdf71bea093e7410b90e284c04d (patch) | |
tree | 47958b5897fcb3c05613889d219cf7bcf1a0214d /lisp/ledger-sort.el | |
parent | 84dc532b0688431d0964736f6a5d7b3804b5e903 (diff) | |
download | fork-ledger-7846e7c17ae31fdf71bea093e7410b90e284c04d.tar.gz fork-ledger-7846e7c17ae31fdf71bea093e7410b90e284c04d.tar.bz2 fork-ledger-7846e7c17ae31fdf71bea093e7410b90e284c04d.zip |
All navigation functions moved to ledger-navigate.
Reduce several overlapping functions.
Diffstat (limited to 'lisp/ledger-sort.el')
-rw-r--r-- | lisp/ledger-sort.el | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/lisp/ledger-sort.el b/lisp/ledger-sort.el index 41f8af3c..1ac125a9 100644 --- a/lisp/ledger-sort.el +++ b/lisp/ledger-sort.el @@ -26,36 +26,36 @@ ;;; Code: -(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)) - (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 xact." - (interactive) - (ledger-next-record-function) - (backward-char) - (end-of-line) - (point)) +;; (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)) +;; (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 xact." +;; (interactive) +;; (ledger-navigate-next-xact) +;; (backward-char) +;; (end-of-line) +;; (point)) (defun ledger-sort-find-start () (if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t) @@ -94,7 +94,7 @@ (let ((new-beg beg) (new-end end) point-delta - (bounds (ledger-find-xact-extents (point))) + (bounds (ledger-navigate-find-xact-extents (point))) target-xact) (setq point-delta (- (point) (car bounds))) @@ -104,10 +104,10 @@ (save-restriction (goto-char beg) ;; make sure point is at the beginning of a xact - (ledger-next-record-function) + (ledger-navigate-next-xact-or-directive) (setq new-beg (point)) (goto-char end) - (ledger-next-record-function) + (ledger-navigate-next-xact-or-directive) ;; make sure end of region is at the beginning of next record ;; after the region (setq new-end (point)) @@ -117,8 +117,8 @@ (let ((inhibit-field-text-motion t)) (sort-subr nil - 'ledger-next-record-function - 'ledger-end-record-function + 'ledger-navigate-next-xact-or-directive + 'ledger-navigate-end-of-xact 'ledger-sort-startkey)))) (goto-char (point-min)) |