summaryrefslogtreecommitdiff
path: root/lisp/ldg-xact.el
blob: e1f165a7effa37094d8ad7d3730793dc617ffa46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
;; A sample entry sorting function, which works if entry dates are of
;; the form YYYY/mm/dd.

(defun ledger-sort ()
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (sort-subr
     nil
     (function
      (lambda ()
        (if (re-search-forward
             (concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+"
                     "\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)") nil t)
            (goto-char (match-beginning 0))
          (goto-char (point-max)))))
     (function
      (lambda ()
        (forward-paragraph))))))