     (define-key map [(control ?c) (control ?c)] 'ledger-post-pick-account)
     (define-key map [(control ?c) (control ?e)] 'ledger-post-edit-amount))
   (if ledger-post-auto-adjust-amounts
-      (add-hook 'after-change-functions 'ledger-post-maybe-align t t)))
+      (add-hook 'after-change-functions 'ledger-post-maybe-align t t))
+  (add-hook 'after-save-hook #'(lambda () (setq ledger-post-current-list nil))))
 
 (add-hook 'ledger-mode-hook 'ledger-post-setup)
 

  :type 'boolean
  :group 'ledger-post)

(declare-function iswitchb-read-buffer "iswitchb"
                  (prompt &optional default require-match start matches-set))
(defvar iswitchb-temp-buflist)

(defvar ledger-post-current-list nil)

(defun ledger-post-find-all ()
  (let ((origin (point))
	(ledger-post-list nil)
	account-path elements)
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward
	      "^[ \t]+\\([*!]\\s-+\\)?[[(]?\\(.+?\\)\\(\t\\|\n\\| [ \t]\\)" nil t)
	(unless (and (>= origin (match-beginning 0))
		     (< origin (match-end 0)))
	  (setq account-path (match-string-no-properties 2))
	  (unless (string-match "\\`\\s-*;" account-path)
	    (add-to-list 'ledger-post-list account-path))))
      (setq ledger-post-current-list
	    (nreverse ledger-post-list)))))

(defun ledger-post-completing-read (prompt choices)
  "Use iswitchb as a completing-read replacement to choose from choices.
PROMPT is a string to prompt with.  CHOICES is a list of strings
to choose from."
  (let* ((iswitchb-use-virtual-buffers nil)
	 (iswitchb-make-buflist-hook
	  (lambda ()
	    (setq iswitchb-temp-buflist choices))))
    (iswitchb-read-buffer prompt)))

(defun ledger-post-pick-account ()
  (interactive)
  (let* ((account
	  (ledger-post-completing-read "Account: "
					  (or ledger-post-current-list
					      (ledger-post-find-all))))
	 (account-len (length account))
	 (pos (point)))
    (goto-char (line-beginning-position))
    (when (re-search-forward ledger-post-line-regexp (line-end-position) t)
      (let ((existing-len (length (match-string 3))))
	(goto-char (match-beginning 3))
	(delete-region (match-beginning 3) (match-end 3))
	(insert account)
	(cond
	 ((> existing-len account-len)

  (interactive)
  (goto-char (line-beginning-position))
  (when (re-search-forward ledger-post-line-regexp (line-end-position) t)
    (goto-char (match-end ledger-regex-post-line-group-account))
    (when (re-search-forward "[-.,0-9]+" (line-end-position) t)
      (let ((val (match-string 0)))
	(goto-char (match-beginning 0))
