 	    (and (> ,target-day ,day1)
 		 (< ,target-day ,day2))))))
 
+
 (defun ledger-auto-is-holiday (date)
   "Return true if DATE is a holiday.")
 
 (defun ledger-auto-scan-transactions (auto-file)
+  (interactive "fFile name: ")
   (let ((xact-list (list)))
-    (save-excursion
-      (find-file auto-file)
+    (with-current-buffer
+	(find-file-noselect auto-file)
       (goto-char (point-min))
       (while (re-search-forward "^\\[\\(.*\\)\\] " nil t)
 	(let ((date-descriptor "")

  "Take a date descriptor string and return a function that
returns true if the date meets the requirements"
  (with-temp-buffer
    (let (pos)
      (insert descriptor-string)
      (goto-char (point-min))
      (replace-string "[" "(")
      (goto-char (point-min))
      (replace-string "]" ")")
      (goto-char (point-max))
      (while (re-search-backward 
	      (concat "\\([0-9]+\\|[\*]\\)/"  ;; Year slot
		      "\\([\*EO]\\|[0-9]+\\)/" ;; Month slot
		      "\\([\*]\\|\\([0-9][0-9]\\)\\|"
		      "\\([0-5]"
		      "\\(\\(Su\\)\\|"

      (error "Invalid argument to ledger-auto-day-in-month-macro %S %S" 
	     count 
	     day-of-week)))

(defmacro ledger-auto-constrain-numerical-date-macro (year month day)
  "Return a function of date that is only true if all constraints are met.
A nil constraint matches any input, a numerical entry must match that field 
of date."
  ;; Do bounds checking to make sure the incoming date constraint is sane
  (if 
   (if (eval month) ;; if we have a month
       (and (between (eval month) 1 12) ;; make sure it is between 1
					;; and twelve and the number
					;; of days are ok
	    (between (eval day) 1 (ledger-auto-days-in-month (eval month) (eval year))))
       (between (eval day) 1 31))  ;; no month specified, assume 31 days.
   `#'(lambda (date)
	(and ,(if (eval year)  
		  `(if (eq (nth 5 (decode-time date)) ,(eval year)) t)
		  `t)
	     ,(if (eval month)
		  `(if (eq (nth 4 (decode-time date)) ,(eval month)) t)
		  `t)
	     ,(if (eval day)
		  `(if (eq (nth 3 (decode-time date)) ,(eval day)) t))))
   (error "ledger-auto-constraint-numerical-date-macro: date out of range %S %S %S" (eval year) (eval month) (eval day))))



(defmacro ledger-auto-constrain-every-count-day-macro (day-of-week skip start-date)
  "Return a form that is true for every DAY skipping SKIP, starting on START.
For example every second Friday, regardless of month."
  (let ((start-day (nth 6 (decode-time (eval start-date)))))
