From 9c68082d8971e38f7feb48b61a9ff43f02c1fa13 Mon Sep 17 00:00:00 2001 From: Glenn Morris Date: Sat, 8 Mar 2008 21:34:30 +0000 Subject: [PATCH] Formatting changes only. --- lisp/calendar/cal-hebrew.el | 181 ++++++++++++++++++------------------ 1 file changed, 93 insertions(+), 88 deletions(-) diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el index d9b1be4ceef..6463a9e2081 100644 --- a/lisp/calendar/cal-hebrew.el +++ b/lisp/calendar/cal-hebrew.el @@ -59,37 +59,37 @@ (defun hebrew-calendar-elapsed-days (year) "Days from Sun. prior to start of Hebrew calendar to mean conjunction of Tishri of Hebrew YEAR." (let* ((months-elapsed - (+ (* 235 (/ (1- year) 19));; Months in complete cycles so far. - (* 12 (% (1- year) 19)) ;; Regular months in this cycle - (/ (1+ (* 7 (% (1- year) 19))) 19)));; Leap months this cycle + (+ (* 235 (/ (1- year) 19)) ; months in complete cycles so far + (* 12 (% (1- year) 19)) ; regular months in this cycle + (/ (1+ (* 7 (% (1- year) 19))) 19))) ; leap months this cycle (parts-elapsed (+ 204 (* 793 (% months-elapsed 1080)))) (hours-elapsed (+ 5 (* 12 months-elapsed) (* 793 (/ months-elapsed 1080)) (/ parts-elapsed 1080))) - (parts ;; Conjunction parts + (parts ; conjunction parts (+ (* 1080 (% hours-elapsed 24)) (% parts-elapsed 1080))) - (day ;; Conjunction day + (day ; conjunction day (+ 1 (* 29 months-elapsed) (/ hours-elapsed 24))) (alternative-day - (if (or (>= parts 19440) ;; If the new moon is at or after midday, - (and (= (% day 7) 2);; ...or is on a Tuesday... - (>= parts 9924) ;; at 9 hours, 204 parts or later... - (not (hebrew-calendar-leap-year-p year)));; of a - ;; common year, - (and (= (% day 7) 1);; ...or is on a Monday... - (>= parts 16789) ;; at 15 hours, 589 parts or later... - (hebrew-calendar-leap-year-p (1- year))));; at the end - ;; of a leap year - ;; Then postpone Rosh HaShanah one day + (if (or (>= parts 19440) ; if the new moon is at or after midday + (and (= (% day 7) 2) ; ...or is on a Tuesday... + (>= parts 9924) ; at 9 hours, 204 parts or later... + ;; of a common year... + (not (hebrew-calendar-leap-year-p year))) + (and (= (% day 7) 1) ; ...or is on a Monday... + (>= parts 16789) ; at 15 hours, 589 parts or later... + ;; at the end of a leap year. + (hebrew-calendar-leap-year-p (1- year)))) + ;; Then postpone Rosh HaShanah one day. (1+ day) - ;; Else + ;; Else: day))) - (if ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday - (memq (% alternative-day 7) (list 0 3 5)) - ;; Then postpone it one (more) day and return + ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday + (if (memq (% alternative-day 7) (list 0 3 5)) + ;; Then postpone it one (more) day and return. (1+ alternative-day) - ;; Else return + ;; Else return. alternative-day))) (defun hebrew-calendar-days-in-year (year) @@ -121,21 +121,21 @@ Gregorian date Sunday, December 31, 1 BC." (let* ((month (extract-calendar-month date)) (day (extract-calendar-day date)) (year (extract-calendar-year date))) - (+ day ;; Days so far this month. - (if (< month 7);; before Tishri - ;; Then add days in prior months this year before and after Nisan + (+ day ; days so far this month + (if (< month 7) ; before Tishri + ;; Then add days in prior months this year before and after Nisan. (+ (calendar-sum m 7 (<= m (hebrew-calendar-last-month-of-year year)) (hebrew-calendar-last-day-of-month m year)) (calendar-sum m 1 (< m month) (hebrew-calendar-last-day-of-month m year))) - ;; Else add days in prior months this year + ;; Else add days in prior months this year. (calendar-sum m 7 (< m month) (hebrew-calendar-last-day-of-month m year))) - (hebrew-calendar-elapsed-days year);; Days in prior years. - -1373429))) ;; Days elapsed before absolute date 1. + (hebrew-calendar-elapsed-days year) ; days in prior years + -1373429))) ; days elapsed before absolute date 1 (defun calendar-hebrew-from-absolute (date) "Compute the Hebrew date (month day year) corresponding to absolute DATE. @@ -200,19 +200,19 @@ Driven by the variable `calendar-date-display-form'." (= death-day 30) (not (hebrew-calendar-long-heshvan-p (1+ death-year)))) (1- (calendar-absolute-from-hebrew (list 9 1 year)))) - ;; If it's Kislev 30 it depends on the first anniversary; if - ;; that was not Kislev 30, use the day before Teveth 1. + ;; If it's Kislev 30 it depends on the first anniversary; if that + ;; was not Kislev 30, use the day before Teveth 1. ((and (= death-month 9) (= death-day 30) (hebrew-calendar-short-kislev-p (1+ death-year))) (1- (calendar-absolute-from-hebrew (list 10 1 year)))) - ;; If it's Adar II, use the same day in last month of - ;; year (Adar or Adar II). + ;; If it's Adar II, use the same day in last month of year (Adar + ;; or Adar II). ((= death-month 13) (calendar-absolute-from-hebrew (list (hebrew-calendar-last-month-of-year year) death-day year))) - ;; If it's the 30th in Adar I and year is not a leap year - ;; (so Adar has only 29 days), use the last day in Shevat. + ;; If it's the 30th in Adar I and year is not a leap year (so + ;; Adar has only 29 days), use the last day in Shevat. ((and (= death-day 30) (= death-month 12) (not (hebrew-calendar-leap-year-p year))) @@ -272,8 +272,9 @@ Driven by the variable `calendar-date-display-form'." If MONTH, DAY (Hebrew) is visible, the value returned is corresponding Gregorian date in the form of the list (((month day year) STRING)). Returns nil if it is not visible in the current calendar window." - (if (memq displayed-month;; This test is only to speed things up a bit; - (list ;; it works fine without the test too. + ;; This test is only to speed things up a bit; it works fine without it. + (if (memq displayed-month + (list (if (< 11 month) (- month 11) (+ month 1)) (if (< 10 month) (- month 10) (+ month 2)) (if (< 9 month) (- month 9) (+ month 3)) @@ -308,7 +309,7 @@ nil if it is not visible in the current calendar window." "List of dates related to Rosh Hashanah, as visible in calendar window." (if (or (< displayed-month 8) (> displayed-month 11)) - nil;; None of the dates is visible + nil ; none of the dates is visible (let* ((abs-r-h (calendar-absolute-from-hebrew (list 7 1 (+ displayed-year 3761)))) (mandatory @@ -365,41 +366,42 @@ nil if it is not visible in the current calendar window." (defun holiday-hanukkah () "List of dates related to Hanukkah, as visible in calendar window." - (if (memq displayed-month;; This test is only to speed things up a bit; - '(10 11 12 1 2));; it works fine without the test too. - (let ((m displayed-month) - (y displayed-year)) - (increment-calendar-month m y 1) - (let* ((h-y (extract-calendar-year - (calendar-hebrew-from-absolute - (calendar-absolute-from-gregorian - (list m (calendar-last-day-of-month m y) y))))) - (abs-h (calendar-absolute-from-hebrew (list 9 25 h-y)))) - (holiday-filter-visible-calendar - (list - (list (calendar-gregorian-from-absolute (1- abs-h)) - "Erev Hanukkah") - (list (calendar-gregorian-from-absolute abs-h) - "Hanukkah (first day)") - (list (calendar-gregorian-from-absolute (1+ abs-h)) - "Hanukkah (second day)") - (list (calendar-gregorian-from-absolute (+ abs-h 2)) - "Hanukkah (third day)") - (list (calendar-gregorian-from-absolute (+ abs-h 3)) - "Hanukkah (fourth day)") - (list (calendar-gregorian-from-absolute (+ abs-h 4)) - "Hanukkah (fifth day)") - (list (calendar-gregorian-from-absolute (+ abs-h 5)) - "Hanukkah (sixth day)") - (list (calendar-gregorian-from-absolute (+ abs-h 6)) - "Hanukkah (seventh day)") - (list (calendar-gregorian-from-absolute (+ abs-h 7)) - "Hanukkah (eighth day)"))))))) + ;; This test is only to speed things up a bit, it works fine without it. + (if (memq displayed-month + '(10 11 12 1 2)) + (let ((m displayed-month) + (y displayed-year)) + (increment-calendar-month m y 1) + (let* ((h-y (extract-calendar-year + (calendar-hebrew-from-absolute + (calendar-absolute-from-gregorian + (list m (calendar-last-day-of-month m y) y))))) + (abs-h (calendar-absolute-from-hebrew (list 9 25 h-y)))) + (holiday-filter-visible-calendar + (list + (list (calendar-gregorian-from-absolute (1- abs-h)) + "Erev Hanukkah") + (list (calendar-gregorian-from-absolute abs-h) + "Hanukkah (first day)") + (list (calendar-gregorian-from-absolute (1+ abs-h)) + "Hanukkah (second day)") + (list (calendar-gregorian-from-absolute (+ abs-h 2)) + "Hanukkah (third day)") + (list (calendar-gregorian-from-absolute (+ abs-h 3)) + "Hanukkah (fourth day)") + (list (calendar-gregorian-from-absolute (+ abs-h 4)) + "Hanukkah (fifth day)") + (list (calendar-gregorian-from-absolute (+ abs-h 5)) + "Hanukkah (sixth day)") + (list (calendar-gregorian-from-absolute (+ abs-h 6)) + "Hanukkah (seventh day)") + (list (calendar-gregorian-from-absolute (+ abs-h 7)) + "Hanukkah (eighth day)"))))))) (defun holiday-passover-etc () "List of dates related to Passover, as visible in calendar window." (if (< 7 displayed-month) - nil;; None of the dates is visible + nil ; none of the dates is visible (let* ((abs-p (calendar-absolute-from-hebrew (list 1 15 (+ displayed-year 3760)))) (mandatory @@ -484,7 +486,7 @@ nil if it is not visible in the current calendar window." "List of dates around Tisha B'Av, as visible in calendar window." (if (or (< displayed-month 5) (> displayed-month 9)) - nil;; None of the dates is visible + nil ; none of the dates is visible (let* ((abs-t-a (calendar-absolute-from-hebrew (list 5 9 (+ displayed-year 3760))))) @@ -568,10 +570,10 @@ not be marked in the calendar. This function is provided for use with the (if (and (or (char-equal (preceding-char) ?\^M) (char-equal (preceding-char) ?\n)) (not (looking-at " \\|\^I"))) - ;; Diary entry that consists only of date. + ;; Diary entry that consists only of date. (backward-char 1) - ;; Found a nonempty diary entry--make it visible and - ;; add it to the list. + ;; Found a nonempty diary entry--make it visible and + ;; add it to the list. (let ((entry-start (point)) (date-start)) (re-search-backward "\^M\\|\n\\|\\`") @@ -608,8 +610,10 @@ A value of 0 in any position is a wildcard." (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. + ;; This test is only to speed things up a bit, it works + ;; fine without it. + (if (memq displayed-month + (list (if (< 11 month) (- month 11) (+ month 1)) (if (< 10 month) (- month 10) (+ month 2)) (if (< 9 month) (- month 9) (+ month 3)) @@ -690,7 +694,7 @@ is provided for use as part of the nongregorian-diary-marking-hook." (let* ((date-form (if (equal (car (car d)) 'backup) (cdr (car d)) - (car d)));; ignore 'backup directive + (car d))) ; ignore 'backup directive (dayname (diary-name-pattern calendar-day-name-array calendar-day-abbrev-array)) (monthname @@ -998,14 +1002,14 @@ use when highlighting the day in the calendar." (if (= h-day 30) (format "%s (first day)" - ;; next month must be in the same year since this + ;; Next month must be in the same year since this ;; month can't be the last month of the year since ;; it has 30 days (aref h-month-names h-month)) (if (= h-yesterday 30) (format "%s (second day)" this-month) this-month)))) - (if (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim + (if (= (% d 7) 6) ; Saturday--check for Shabbat Mevarchim (cons mark (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) (format "Mevarchim Rosh Hodesh %s (%s)" @@ -1046,7 +1050,7 @@ use when highlighting the day in the calendar." (defun hebrew-calendar-parasha-name (p) "Name(s) corresponding to parasha P." - (if (arrayp p);; combined parasha + (if (arrayp p) ; combined parasha (format "%s/%s" (aref hebrew-calendar-parashiot-names (aref p 0)) (aref hebrew-calendar-parashiot-names (aref p 1))) @@ -1058,7 +1062,7 @@ use when highlighting the day in the calendar." An optional parameter MARK specifies a face or single-character string to use when highlighting the day in the calendar." (let ((d (calendar-absolute-from-gregorian date))) - (if (= (% d 7) 6) ;; Saturday + (if (= (% d 7) 6) ; Saturday (let* ((h-year (extract-calendar-year (calendar-hebrew-from-absolute d))) @@ -1077,28 +1081,30 @@ use when highlighting the day in the calendar." (t "regular"))) (year-format (symbol-value - (intern (format "hebrew-calendar-year-%s-%s-%s" ;; keviah + (intern (format "hebrew-calendar-year-%s-%s-%s" ; keviah rosh-hashanah-day type passover-day)))) - (first-saturday ;; of Hebrew year + (first-saturday ; of Hebrew year (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah))) - (saturday ;; which Saturday of the Hebrew year + (saturday ; which Saturday of the Hebrew year (/ (- d first-saturday) 7)) (parasha (aref year-format saturday))) (if parasha (cons mark (format "Parashat %s" - (if (listp parasha) ;; Israel differs from diaspora + (if (listp parasha) ; Israel differs from diaspora (if (car parasha) (format "%s (diaspora), %s (Israel)" - (hebrew-calendar-parasha-name (car parasha)) - (hebrew-calendar-parasha-name (cdr parasha))) + (hebrew-calendar-parasha-name + (car parasha)) + (hebrew-calendar-parasha-name + (cdr parasha))) (format "%s (Israel)" - (hebrew-calendar-parasha-name (cdr parasha)))) + (hebrew-calendar-parasha-name + (cdr parasha)))) (hebrew-calendar-parasha-name parasha))))))))) -;; The seven ordinary year types (keviot) - +;; The seven ordinary year types (keviot). (defconst hebrew-calendar-year-Saturday-incomplete-Sunday [nil 52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] @@ -1156,8 +1162,7 @@ Kislev has 30 days), and has Passover start on Saturday.") Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev each have 30 days), and has Passover start on Sunday.") -;; The seven leap year types (keviot) - +;; The seven leap year types (keviot). (defconst hebrew-calendar-year-Saturday-incomplete-Tuesday [nil 52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 nil 28 29 30 31 32 33 34 35 36 37 38 39 40 [41 42] -- 2.39.2