+(defun mark-hebrew-calendar-date-pattern (month day year)
+ "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR.
+A value of 0 in any position is a wildcard."
+ (save-excursion
+ (set-buffer calendar-buffer)
+ (if (and (/= 0 month) (/= 0 day))
+ (if (/= 0 year)
+ ;; Fully specified Hebrew date.
+ (let ((date (calendar-gregorian-from-absolute
+ (calendar-absolute-from-hebrew
+ (list month day year)))))
+ (if (calendar-date-is-visible-p date)
+ (mark-visible-calendar-date date)))
+ ;; Month and day in any year--this taken from the holiday stuff.
+ (if (memq displayed-month;; This test is only to speed things up a
+ (list ;; bit; it works fine without the test too.
+ (if (< 11 month) (- month 11) (+ month 1))
+ (if (< 10 month) (- month 10) (+ month 2))
+ (if (< 9 month) (- month 9) (+ month 3))
+ (if (< 8 month) (- month 8) (+ month 4))
+ (if (< 7 month) (- month 7) (+ month 5))))
+ (let ((m1 displayed-month)
+ (y1 displayed-year)
+ (m2 displayed-month)
+ (y2 displayed-year)
+ (year))
+ (increment-calendar-month m1 y1 -1)
+ (increment-calendar-month m2 y2 1)
+ (let* ((start-date (calendar-absolute-from-gregorian
+ (list m1 1 y1)))
+ (end-date (calendar-absolute-from-gregorian
+ (list m2
+ (calendar-last-day-of-month m2 y2)
+ y2)))
+ (hebrew-start
+ (calendar-hebrew-from-absolute start-date))
+ (hebrew-end (calendar-hebrew-from-absolute end-date))
+ (hebrew-y1 (extract-calendar-year hebrew-start))
+ (hebrew-y2 (extract-calendar-year hebrew-end)))
+ (setq year (if (< 6 month) hebrew-y2 hebrew-y1))
+ (let ((date (calendar-gregorian-from-absolute
+ (calendar-absolute-from-hebrew
+ (list month day year)))))
+ (if (calendar-date-is-visible-p date)
+ (mark-visible-calendar-date date)))))))
+ ;; Not one of the simple cases--check all visible dates for match.
+ ;; Actually, the following code takes care of ALL of the cases, but
+ ;; it's much too slow to be used for the simple (common) cases.
+ (let ((m displayed-month)
+ (y displayed-year)
+ (first-date)
+ (last-date))
+ (increment-calendar-month m y -1)
+ (setq first-date
+ (calendar-absolute-from-gregorian
+ (list m 1 y)))
+ (increment-calendar-month m y 2)
+ (setq last-date
+ (calendar-absolute-from-gregorian
+ (list m (calendar-last-day-of-month m y) y)))
+ (calendar-for-loop date from first-date to last-date do
+ (let* ((h-date (calendar-hebrew-from-absolute date))
+ (h-month (extract-calendar-month h-date))
+ (h-day (extract-calendar-day h-date))
+ (h-year (extract-calendar-year h-date)))
+ (and (or (zerop month)
+ (= month h-month))
+ (or (zerop day)
+ (= day h-day))
+ (or (zerop year)
+ (= year h-year))
+ (mark-visible-calendar-date
+ (calendar-gregorian-from-absolute date)))))))))
+