diff options
author | thdox <thdox@free.fr> | 2014-05-17 16:52:06 +0200 |
---|---|---|
committer | thdox <thdox@free.fr> | 2014-05-17 16:52:06 +0200 |
commit | d2db0f9102ac0a7a1a4d9c47e46ac2bba438fde1 (patch) | |
tree | 7d2a96dd5e6b2c7eb585c17956415fa7eeb3c32a /lisp/ledger-sort.el | |
parent | 35a36f33aa1a5eeb40a028bbab30cf75ec04dd54 (diff) | |
download | fork-ledger-d2db0f9102ac0a7a1a4d9c47e46ac2bba438fde1.tar.gz fork-ledger-d2db0f9102ac0a7a1a4d9c47e46ac2bba438fde1.tar.bz2 fork-ledger-d2db0f9102ac0a7a1a4d9c47e46ac2bba438fde1.zip |
Indent & untabify
M-x mark-whole-buffer
M-x indent-region
M-x mark-whole-buffer
M-x untabify
Diffstat (limited to 'lisp/ledger-sort.el')
-rw-r--r-- | lisp/ledger-sort.el | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/lisp/ledger-sort.el b/lisp/ledger-sort.el index d337cc4c..80472a35 100644 --- a/lisp/ledger-sort.el +++ b/lisp/ledger-sort.el @@ -30,7 +30,7 @@ "Move point to next transaction." (if (re-search-forward ledger-payee-any-status-regex nil t) (goto-char (match-beginning 0)) - (goto-char (point-max)))) + (goto-char (point-max)))) (defun ledger-end-record-function () "Move point to end of transaction." @@ -49,7 +49,7 @@ (save-excursion (goto-char (point-min)) (if (ledger-sort-find-start) - (delete-region (match-beginning 0) (match-end 0)))) + (delete-region (match-beginning 0) (match-end 0)))) (beginning-of-line) (insert "\n; Ledger-mode: Start sort\n\n")) @@ -58,7 +58,7 @@ (save-excursion (goto-char (point-min)) (if (ledger-sort-find-end) - (delete-region (match-beginning 0) (match-end 0)))) + (delete-region (match-beginning 0) (match-end 0)))) (beginning-of-line) (insert "\n; Ledger-mode: End sort\n\n")) @@ -71,34 +71,34 @@ (interactive "r") ;; load beg and end from point and mark ;; automagically (let ((new-beg beg) - (new-end end) - point-delta - (bounds (ledger-find-xact-extents (point))) - target-xact) + (new-end end) + point-delta + (bounds (ledger-find-xact-extents (point))) + target-xact) (setq point-delta (- (point) (car bounds))) (setq target-xact (buffer-substring (car bounds) (cadr bounds))) (setq inhibit-modification-hooks t) (save-excursion (save-restriction - (goto-char beg) - (ledger-next-record-function) ;; make sure point is at the - ;; beginning of a xact - (setq new-beg (point)) - (goto-char end) - (ledger-next-record-function) ;; make sure end of region is at - ;; the beginning of next record - ;; after the region - (setq new-end (point)) - (narrow-to-region new-beg new-end) - (goto-char new-beg) - - (let ((inhibit-field-text-motion t)) - (sort-subr - nil - 'ledger-next-record-function - 'ledger-end-record-function - 'ledger-sort-startkey)))) + (goto-char beg) + (ledger-next-record-function) ;; make sure point is at the + ;; beginning of a xact + (setq new-beg (point)) + (goto-char end) + (ledger-next-record-function) ;; make sure end of region is at + ;; the beginning of next record + ;; after the region + (setq new-end (point)) + (narrow-to-region new-beg new-end) + (goto-char new-beg) + + (let ((inhibit-field-text-motion t)) + (sort-subr + nil + 'ledger-next-record-function + 'ledger-end-record-function + 'ledger-sort-startkey)))) (goto-char (point-min)) (re-search-forward (regexp-quote target-xact)) @@ -109,17 +109,17 @@ "Sort the entire buffer." (interactive) (let (sort-start - sort-end) + sort-end) (save-excursion (goto-char (point-min)) (setq sort-start (ledger-sort-find-start) - sort-end (ledger-sort-find-end))) + sort-end (ledger-sort-find-end))) (ledger-sort-region (if sort-start - sort-start - (point-min)) - (if sort-end - sort-end - (point-max))))) + sort-start + (point-min)) + (if sort-end + sort-end + (point-max))))) (provide 'ledger-sort) |