summaryrefslogtreecommitdiff
path: root/lisp/ldg-sort.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/ldg-sort.el')
-rw-r--r--lisp/ldg-sort.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/ldg-sort.el b/lisp/ldg-sort.el
index 8a1d9573..361eead8 100644
--- a/lisp/ldg-sort.el
+++ b/lisp/ldg-sort.el
@@ -19,10 +19,15 @@
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
;; MA 02111-1307, USA.
-;; A sample entry sorting function, which works if entry dates are of
-;; the form YYYY/mm/dd.
+
+
+;;; Commentary:
+;;
+
+;;; Code:
(defun ledger-next-record-function ()
+ "Move point to next transaction."
(if (re-search-forward
(concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+"
"\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)") nil t)
@@ -30,9 +35,11 @@
(goto-char (point-max))))
(defun ledger-end-record-function ()
+ "Move point to end of transaction."
(forward-paragraph))
(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)
@@ -57,8 +64,10 @@
'ledger-end-record-function))))))
(defun ledger-sort-buffer ()
+ "Sort the entire buffer."
(interactive)
(ledger-sort-region (point-min) (point-max)))
+(provide 'ldg-sort)
-(provide 'ldg-sort) \ No newline at end of file
+;;; ldg-sort.el ends here