diff options
author | Craig Earls <enderw88@gmail.com> | 2013-03-02 20:21:46 -0700 |
---|---|---|
committer | Craig Earls <enderw88@gmail.com> | 2013-03-02 20:21:46 -0700 |
commit | 4c608cccd0c6f06f403882dcca36cb62a40178a2 (patch) | |
tree | 9faa792c6e4477ff5c52435a5b9cd384c1081c79 /lisp/ldg-sort.el | |
parent | b3971e8bedcfde7c9c2c1bbb7460915aa6ca0731 (diff) | |
parent | 4810da9398809fc090c7f044d3545050a465d2bb (diff) | |
download | fork-ledger-4c608cccd0c6f06f403882dcca36cb62a40178a2.tar.gz fork-ledger-4c608cccd0c6f06f403882dcca36cb62a40178a2.tar.bz2 fork-ledger-4c608cccd0c6f06f403882dcca36cb62a40178a2.zip |
Merge branch 'next' into ledger-mode-automatic-transactions
Diffstat (limited to 'lisp/ldg-sort.el')
-rw-r--r-- | lisp/ldg-sort.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/ldg-sort.el b/lisp/ldg-sort.el index 361eead8..cc036492 100644 --- a/lisp/ldg-sort.el +++ b/lisp/ldg-sort.el @@ -54,8 +54,8 @@ ;; the beginning of next record ;; after the region (setq new-end (point)) - (narrow-to-region beg end) - (goto-char (point-min)) + (narrow-to-region new-beg new-end) + (goto-char new-beg) (let ((inhibit-field-text-motion t)) (sort-subr @@ -66,7 +66,14 @@ (defun ledger-sort-buffer () "Sort the entire buffer." (interactive) - (ledger-sort-region (point-min) (point-max))) + (let ((sort-start (point-min)) + (sort-end (point-max))) + (goto-char (point-min)) + (if (re-search-forward ";.*Ledger-mode:.*Start sort" nil t) + (set 'sort-start (match-end 0))) + (if (re-search-forward ";.*Ledger-mode:.*End sort" nil t) + (set 'sort-end (match-end 0))) + (ledger-sort-region sort-start sort-end))) (provide 'ldg-sort) |