aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2008-04-01 02:54:29 +0000
committerGlenn Morris2008-04-01 02:54:29 +0000
commit2f264ff695541003296f9a0f6fe94f72228a58f2 (patch)
treeb81d68d3f150ded383ccb8cda08c7936a5de3e3d
parentd600b86560dcd44fb6708fd0f5350d65a364fcb0 (diff)
downloademacs-2f264ff695541003296f9a0f6fe94f72228a58f2.tar.gz
emacs-2f264ff695541003296f9a0f6fe94f72228a58f2.zip
(calendar-hebrew-date-is-visible-p): Use calendar-nongregorian-visible-p.
-rw-r--r--lisp/calendar/cal-hebrew.el33
1 files changed, 8 insertions, 25 deletions
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el
index 1e8646efa77..d84087734e9 100644
--- a/lisp/calendar/cal-hebrew.el
+++ b/lisp/calendar/cal-hebrew.el
@@ -266,7 +266,6 @@ Reads a year, month, and day."
266 (or noecho (calendar-print-hebrew-date))) 266 (or noecho (calendar-print-hebrew-date)))
267 267
268(defvar displayed-month) ; from generate-calendar 268(defvar displayed-month) ; from generate-calendar
269(defvar displayed-year)
270 269
271(defun calendar-hebrew-date-is-visible-p (month day) 270(defun calendar-hebrew-date-is-visible-p (month day)
272 "Return non-nil if Hebrew MONTH DAY is visible in the calendar window. 271 "Return non-nil if Hebrew MONTH DAY is visible in the calendar window.
@@ -302,30 +301,12 @@ Returns the corresponding Gregorian date."
302 (if (< 9 month) (- month 9) (+ month 3)) 301 (if (< 9 month) (- month 9) (+ month 3))
303 (if (< 8 month) (- month 8) (+ month 4)) 302 (if (< 8 month) (- month 8) (+ month 4))
304 (if (< 7 month) (- month 7) (+ month 5)))) 303 (if (< 7 month) (- month 7) (+ month 5))))
305 ;; This is the same as holiday-julian, except the test of which 304 (calendar-nongregorian-visible-p
306 ;; year to use is different. 305 month day 'calendar-absolute-from-hebrew
307 (let* ((m1 displayed-month) 306 'calendar-hebrew-from-absolute
308 (y1 displayed-year) 307 ;; Hebrew new year is start of month 7.
309 (m2 displayed-month) 308 ;; If hmonth >= 7, choose the higher year.
310 (y2 displayed-year) 309 (lambda (m) (> m 6)))))
311 (start-date (progn
312 (increment-calendar-month m1 y1 -1)
313 (calendar-absolute-from-gregorian (list m1 1 y1))))
314 (end-date (progn
315 (increment-calendar-month m2 y2 1)
316 (calendar-absolute-from-gregorian
317 (list m2 (calendar-last-day-of-month m2 y2) y2))))
318 (hebrew-start (calendar-hebrew-from-absolute start-date))
319 (hebrew-end (calendar-hebrew-from-absolute end-date))
320 (hebrew-y1 (extract-calendar-year hebrew-start))
321 (hebrew-y2 (extract-calendar-year hebrew-end))
322 ;; Hebrew new year is start of month 7.
323 ;; If hmonth >= 7, choose the higher year, y2.
324 (year (if (< 6 month) hebrew-y2 hebrew-y1))
325 (date (calendar-gregorian-from-absolute
326 (calendar-absolute-from-hebrew (list month day year)))))
327 (if (calendar-date-is-visible-p date)
328 date))))
329 310
330;;;###holiday-autoload 311;;;###holiday-autoload
331(defun holiday-hebrew (month day string) 312(defun holiday-hebrew (month day string)
@@ -339,6 +320,8 @@ nil if it is not visible in the current calendar window."
339;; h-r-h-e should be called from holidays code. 320;; h-r-h-e should be called from holidays code.
340(declare-function holiday-filter-visible-calendar "holidays" (l)) 321(declare-function holiday-filter-visible-calendar "holidays" (l))
341 322
323(defvar displayed-year)
324
342;;;###holiday-autoload 325;;;###holiday-autoload
343(defun holiday-rosh-hashanah-etc () 326(defun holiday-rosh-hashanah-etc ()
344 "List of dates related to Rosh Hashanah, as visible in calendar window." 327 "List of dates related to Rosh Hashanah, as visible in calendar window."