 	    (between (eval day) 1 (ledger-schedule-days-in-month (eval month) (eval year))))
        (between (eval day) 1 31))  ;; no month specified, assume 31 days.
    `'(and ,(if (eval year)  
-		`(if (eq (nth 5 (decode-time date)) ,(eval year)) t)
-		`t)
+	       `(eq (nth 5 (decode-time date)) ,(eval year))
+	       `t)
 	   ,(if (eval month)
-		`(if (eq (nth 4 (decode-time date)) ,(eval month)) t)
+		`(eq (nth 4 (decode-time date)) ,(eval month))
 		`t)
 	   ,(if (eval day)
-		`(if (eq (nth 3 (decode-time date)) ,(eval day)) t)))
+		`(eq (nth 3 (decode-time date)) ,(eval day))))
    (error "ledger-schedule-constraint-numerical-date-macro: date out of range %S %S %S" (eval year) (eval month) (eval day))))
 
 

		       (,days-in-month (ledger-schedule-days-in-month 
					(nth 4 ,decoded) 
					(nth 5 ,decoded))))
		  (if (and (eq (nth 6 ,decoded) ,day-of-week)
			   (between  (nth 3 ,decoded) 
				     (+ ,days-in-month ,(* count 7)) 
				     (+ ,days-in-month ,(* (1+ count) 7))))
		      t
		      nil))))
	    (t
	     (error "COUNT out of range, COUNT=%S" count)))
      (error "Invalid argument to ledger-schedule-day-in-month-macro %S %S" 

;;
(defvar auto-items)

(defun ledger-schedule-test ( early horizon)
   (ledger-schedule-create-auto-buffer 
    (ledger-schedule-scan-transactions ledger-schedule-file) 
    early 
    horizon 
    (get-buffer "2013.ledger")))


(defun ledger-schedule-test-predict ()
