summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Earls <enderw88@gmail.com>2014-12-05 06:59:57 -0700
committerCraig Earls <enderw88@gmail.com>2014-12-05 06:59:57 -0700
commitdf88ee6189ebe41e828e7c41cb2cd4ce835bc309 (patch)
treec6e3ed4f10b62347e8c037e1b0b1a5b752350d68
parentbb38cda880f8abeb75570246b79935e437741afa (diff)
downloadfork-ledger-df88ee6189ebe41e828e7c41cb2cd4ce835bc309.tar.gz
fork-ledger-df88ee6189ebe41e828e7c41cb2cd4ce835bc309.tar.bz2
fork-ledger-df88ee6189ebe41e828e7c41cb2cd4ce835bc309.zip
Tweak ledger-clean-up to attempt to find the exact you were at when you ordered the clean.
-rw-r--r--lisp/ledger-mode.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/ledger-mode.el b/lisp/ledger-mode.el
index a3e2cb29..e53b23bf 100644
--- a/lisp/ledger-mode.el
+++ b/lisp/ledger-mode.el
@@ -226,12 +226,19 @@ With a prefix argument, remove the effective date."
(replace-match "\n\n")))
(defun ledger-mode-clean-buffer ()
- "Indent, remove multiple linfe feeds and sort the buffer."
+ "Indent, remove multiple line feeds and sort the buffer."
(interactive)
- (untabify (point-min) (point-max))
- (ledger-sort-buffer)
- (ledger-post-align-postings (point-min) (point-max))
- (ledger-mode-remove-extra-lines))
+ (ledger-navigate-beginning-of-xact)
+ (beginning-of-line)
+ (let ((target (buffer-substring (point) (progn
+ (end-of-line)
+ (point)))))
+ (untabify (point-min) (point-max))
+ (ledger-sort-buffer)
+ (ledger-post-align-postings (point-min) (point-max))
+ (ledger-mode-remove-extra-lines)
+ (goto-char (point-min))
+ (search-forward target)))
(defvar ledger-mode-map
(let ((map (make-sparse-keymap)))