changeset 93495:3851465fdd03

(calendar-hebrew-date-is-visible-p): Use calendar-nongregorian-visible-p.
author Glenn Morris <rgm@gnu.org>
date Tue, 01 Apr 2008 02:54:29 +0000
parents 101c1d082feb
children cdfc8242a666
files lisp/calendar/cal-hebrew.el
diffstat 1 files changed, 8 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/cal-hebrew.el	Tue Apr 01 02:47:40 2008 +0000
+++ b/lisp/calendar/cal-hebrew.el	Tue Apr 01 02:54:29 2008 +0000
@@ -266,7 +266,6 @@
   (or noecho (calendar-print-hebrew-date)))
 
 (defvar displayed-month)                ; from generate-calendar
-(defvar displayed-year)
 
 (defun calendar-hebrew-date-is-visible-p (month day)
   "Return non-nil if Hebrew MONTH DAY is visible in the calendar window.
@@ -302,30 +301,12 @@
              (if (<  9 month) (- month  9) (+ month 3))
              (if (<  8 month) (- month  8) (+ month 4))
              (if (<  7 month) (- month  7) (+ month 5))))
-      ;; This is the same as holiday-julian, except the test of which
-      ;; year to use is different.
-      (let* ((m1 displayed-month)
-             (y1 displayed-year)
-             (m2 displayed-month)
-             (y2 displayed-year)
-             (start-date (progn
-                           (increment-calendar-month m1 y1 -1)
-                           (calendar-absolute-from-gregorian (list m1 1 y1))))
-             (end-date (progn
-                         (increment-calendar-month m2 y2 1)
-                         (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))
-             ;; Hebrew new year is start of month 7.
-             ;; If hmonth >= 7, choose the higher year, y2.
-             (year (if (< 6 month) hebrew-y2 hebrew-y1))
-             (date (calendar-gregorian-from-absolute
-                    (calendar-absolute-from-hebrew (list month day year)))))
-        (if (calendar-date-is-visible-p date)
-            date))))
+      (calendar-nongregorian-visible-p
+       month day 'calendar-absolute-from-hebrew
+       'calendar-hebrew-from-absolute
+       ;; Hebrew new year is start of month 7.
+       ;; If hmonth >= 7, choose the higher year.
+       (lambda (m) (> m 6)))))
 
 ;;;###holiday-autoload
 (defun holiday-hebrew (month day string)
@@ -339,6 +320,8 @@
 ;; h-r-h-e should be called from holidays code.
 (declare-function holiday-filter-visible-calendar "holidays" (l))
 
+(defvar displayed-year)
+
 ;;;###holiday-autoload
 (defun holiday-rosh-hashanah-etc ()
   "List of dates related to Rosh Hashanah, as visible in calendar window."