summaryrefslogtreecommitdiff
path: root/lisp/ldg-xact.el
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2013-02-01 10:19:47 -0700
committerCraig Earls <enderw88@gmail.com>2013-02-01 10:19:47 -0700
commit0675208a63837b0ce6802b5124bb90514f07b5e0 (patch)
tree38fbb5bd4c1a922b356529554d8ceae5bb3001aa /lisp/ldg-xact.el
parent844b614af7a74ac52b6a63406af2a49485d178da (diff)
downloadledger-0675208a63837b0ce6802b5124bb90514f07b5e0.tar.gz
ledger-0675208a63837b0ce6802b5124bb90514f07b5e0.tar.bz2
ledger-0675208a63837b0ce6802b5124bb90514f07b5e0.zip
Add regional sort facility to ledger mode
C-c C-s now bound to ledger-sort-region. ledger-sort-region is smart and find the beginning of the first xact within the region and the beginning of the first xact AFTER the region so that it can keep posing structure intact
Diffstat (limited to 'lisp/ldg-xact.el')
-rw-r--r--lisp/ldg-xact.el26
1 files changed, 0 insertions, 26 deletions
diff --git a/lisp/ldg-xact.el b/lisp/ldg-xact.el
index 8907f58e..1df7d79a 100644
--- a/lisp/ldg-xact.el
+++ b/lisp/ldg-xact.el
@@ -22,32 +22,6 @@
;; A sample entry sorting function, which works if entry dates are of
;; the form YYYY/mm/dd.
-(defun ledger-next-record-function ()
- (if (re-search-forward
- (concat "^[0-9/.=-]+\\(\\s-+\\*\\)?\\(\\s-+(.*?)\\)?\\s-+"
- "\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)") nil t)
- (goto-char (match-beginning 0))
- (goto-char (point-max))))
-
-(defun ledger-end-record-function ()
- (forward-paragraph))
-
-(defun ledger-sort-region (beg end)
- (interactive "r") ;load beg and end from point and mark automagically
- (save-excursion
- (save-restriction
- (narrow-to-region beg end)
- (goto-char (point-min))
- (message "%s %s %s" beg end (point-min))
- (let ((inhibit-field-text-motion t))
- (sort-subr
- nil
- 'ledger-next-record-function
- 'ledger-end-record-function)))))
-
-(defun ledger-sort-buffer ()
- (interactive)
- (ledger-sort-region (point-min) (point-max)))
(provide 'ldg-xact) \ No newline at end of file