    (equal file "<stdin>")
    (equal file "/dev/stdin")))
 
+(defun ledger-reconcile-get-buffer (where)
+;  (when (is-stdin (car where))
+;    ledger-buf))
+  (if (bufferp (car where))
+      (car where)
+      (error "buffer not set")))
+
+
 (defun ledger-reconcile-toggle ()
   (interactive)
   (let ((where (get-text-property (point) 'where))
         (account ledger-acct)
         (inhibit-read-only t)
         cleared)
-    (when (is-stdin (car where))
-      (with-current-buffer ledger-buf
+;    (when (is-stdin (car where))
+;      (with-current-buffer ledger-buf
+    (when (ledger-reconcile-get-buffer where)
+      (with-current-buffer (ledger-reconcile-get-buffer where)
 	(goto-char (cdr where))
 	(setq cleared (ledger-toggle-current-entry)))
-					;remove the existing face and add the new face
+	;remove the existing face and add the new face
       (remove-text-properties (line-beginning-position)
 			      (line-end-position)
 			      (list 'face))

(defun ledger-reconcile-delete ()
  (interactive)
  (let ((where (get-text-property (point) 'where)))
    (when (is-stdin (car where))
      (with-current-buffer ledger-buf
        (goto-char (cdr where))
        (ledger-delete-current-entry))
      (let ((inhibit-read-only t))

    (if ledger-fold-on-reconcile
	(ledger-occur-quit-buffer buf))))

(defun ledger-marker-where-xact-is (emacs-xact)
  "find the position of the xact in the ledger-buf buffer using
   the emacs output from ledger, return the buffer and a marker
   to the beginning of the xact in that buffer"
  (let ((buf (if (is-stdin (nth 0 emacs-xact))
		 ledger-buf
		 (find-file-noselect (nth 0 emacs-xact)))))
    (with-current-buffer buf 
      (cons
       buf
       (save-excursion
	 (goto-line (nth 1 emacs-xact))
	 (point-marker))))))

(defun ledger-do-reconcile ()
  "get the uncleared transactions in the account and display them
