summaryrefslogtreecommitdiff
path: root/lisp/ldg-xact.el
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2010-04-12 22:32:12 -0400
committerJohn Wiegley <johnw@newartisans.com>2010-04-12 22:32:12 -0400
commitbd8e6686f2a1d837b3c4427dfce218b6e720268e (patch)
tree7c6bdf6326a4e13bc215fc33c5493a59c06bb67e /lisp/ldg-xact.el
parenteb99efd2dd3738126ba285ba48c022425ae6d5dd (diff)
downloadledger-bd8e6686f2a1d837b3c4427dfce218b6e720268e.tar.gz
ledger-bd8e6686f2a1d837b3c4427dfce218b6e720268e.tar.bz2
ledger-bd8e6686f2a1d837b3c4427dfce218b6e720268e.zip
Broke up the old ledger.el into several submodules
Diffstat (limited to 'lisp/ldg-xact.el')
-rw-r--r--lisp/ldg-xact.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/lisp/ldg-xact.el b/lisp/ldg-xact.el
new file mode 100644
index 00000000..5945632a
--- /dev/null
+++ b/lisp/ldg-xact.el
@@ -0,0 +1,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))))))
+