From df88ee6189ebe41e828e7c41cb2cd4ce835bc309 Mon Sep 17 00:00:00 2001 From: Craig Earls Date: Fri, 5 Dec 2014 06:59:57 -0700 Subject: Tweak ledger-clean-up to attempt to find the exact you were at when you ordered the clean. --- lisp/ledger-mode.el | 17 ++++++++++++----- 1 file 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))) -- cgit v1.2.3