summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-03-30 08:28:05 -0700
committerCraig Earls <enderw88@gmail.com>2013-03-30 08:28:05 -0700
commit9f25571accaa2a31afb28c7daa2dc4832e226383 (patch)
tree02cb75f804832e801dca3fc2a7a4c69713f41914 /lisp
parent44ae6e0f16fe8677f491487b948eeb5e8cc2998f (diff)
parent69c0927772f74fd0c45b1250c171e86cc205c76d (diff)
downloadfork-ledger-9f25571accaa2a31afb28c7daa2dc4832e226383.tar.gz
fork-ledger-9f25571accaa2a31afb28c7daa2dc4832e226383.tar.bz2
fork-ledger-9f25571accaa2a31afb28c7daa2dc4832e226383.zip
Merge branch 'next' into ledger-mode-automatic-transactions
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ldg-sort.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/ldg-sort.el b/lisp/ldg-sort.el
index ecb86371..45b55c47 100644
--- a/lisp/ldg-sort.el
+++ b/lisp/ldg-sort.el
@@ -64,13 +64,17 @@
(beginning-of-line)
(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)
"Sort the region from BEG to END in chronological order."
(interactive "r") ;; load beg and end from point and mark
;; automagically
(let ((new-beg beg)
(new-end end))
- (save-excursion
+ (save-excursion
(save-restriction
(goto-char beg)
(ledger-next-record-function) ;; make sure point is at the
@@ -88,7 +92,8 @@
(sort-subr
nil
'ledger-next-record-function
- 'ledger-end-record-function))))))
+ 'ledger-end-record-function
+ 'ledger-sort-startkey))))))
(defun ledger-sort-buffer ()
"Sort the entire buffer."