 	  (ledger-reconcile-toggle))))
     (goto-char (point-min))))
 
+(defun ledger-reconcile-refresh ()
+  (interactive)
+  (let ((inhibit-read-only t)
+	(line (count-lines (point-min) (point))))
+    (erase-buffer)
+    (ledger-do-reconcile)
+    (set-buffer-modified-p t)
+    (goto-char (point-min))
+    (forward-line line)))
+
+(defun ledger-reconcile-refresh-after-save ()
+  (let ((buf (get-buffer "*Reconcile*")))
+    (if buf
+	(with-current-buffer buf
+	  (ledger-reconcile-refresh)
+	  (set-buffer-modified-p nil)))))
+
 (defun ledger-reconcile-add ()
   (interactive)
   (with-current-buffer ledger-buf
     (call-interactively #'ledger-add-entry))
-  (let ((inhibit-read-only t))
-    (erase-buffer)
-    (ledger-do-reconcile)
-    (set-buffer-modified-p t)))
+  (ledger-reconcile-refresh))
 
 (defun ledger-reconcile-delete ()
   (interactive)

      (delete-region (point) (1+ (line-end-position)))
      (set-buffer-modified-p t))))

(defun ledger-reconcile-save ()
  (interactive)
  (with-current-buffer ledger-buf
    (save-buffer))
  (set-buffer-modified-p nil)
  (ledger-display-balance))

(defun ledger-do-reconcile ()
  (let* ((buf ledger-buf)

(define-derived-mode ledger-reconcile-mode text-mode "Reconcile"
  "A mode for reconciling ledger entries."
  (let ((map (make-sparse-keymap)))
    (define-key map [(control ?m)] 'ledger-reconcile-visit)
    (define-key map [return] 'ledger-reconcile-visit)
    (define-key map [(control ?c) (control ?c)] 'ledger-reconcile-finish)
    (define-key map [(control ?c) (control ?r)] 'ledger-auto-reconcile)
    (define-key map [(control ?x) (control ?s)] 'ledger-reconcile-save)
    (define-key map [(control ?l)] 'ledger-reconcile-refresh)
    (define-key map [? ] 'ledger-reconcile-toggle)
    (define-key map [?a] 'ledger-reconcile-add)
    (define-key map [?d] 'ledger-reconcile-delete)
