Fix bug 937 maintain sort order of xact on the same actual date.
This commit is contained in:
parent
7fea9d21fb
commit
69c0927772
1 changed files with 7 additions and 2 deletions
|
|
@ -64,13 +64,17 @@
|
||||||
(beginning-of-line)
|
(beginning-of-line)
|
||||||
(insert "\n; Ledger-mode: End sort\n\n"))
|
(insert "\n; Ledger-mode: End sort\n\n"))
|
||||||
|
|
||||||
|
(defun ledger-sort-startkey ()
|
||||||
|
"Return the actual date so the sort-subr doesn't sort onthe entire first line."
|
||||||
|
(buffer-substring-no-properties (point) (+ 10 (point))))
|
||||||
|
|
||||||
(defun ledger-sort-region (beg end)
|
(defun ledger-sort-region (beg end)
|
||||||
"Sort the region from BEG to END in chronological order."
|
"Sort the region from BEG to END in chronological order."
|
||||||
(interactive "r") ;; load beg and end from point and mark
|
(interactive "r") ;; load beg and end from point and mark
|
||||||
;; automagically
|
;; automagically
|
||||||
(let ((new-beg beg)
|
(let ((new-beg beg)
|
||||||
(new-end end))
|
(new-end end))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-restriction
|
(save-restriction
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(ledger-next-record-function) ;; make sure point is at the
|
(ledger-next-record-function) ;; make sure point is at the
|
||||||
|
|
@ -88,7 +92,8 @@
|
||||||
(sort-subr
|
(sort-subr
|
||||||
nil
|
nil
|
||||||
'ledger-next-record-function
|
'ledger-next-record-function
|
||||||
'ledger-end-record-function))))))
|
'ledger-end-record-function
|
||||||
|
'ledger-sort-startkey))))))
|
||||||
|
|
||||||
(defun ledger-sort-buffer ()
|
(defun ledger-sort-buffer ()
|
||||||
"Sort the entire buffer."
|
"Sort the entire buffer."
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue