Undo previous change.
[emacs.git] / lisp / calendar / cal-hebrew.el
blobcd4eaa1d13ee3d4d2ed8cf6a84be9fb5912ca9c0
1 ;;; cal-hebrew.el --- calendar functions for the Hebrew calendar
3 ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 ;; Free Software Foundation, Inc.
6 ;; Author: Nachum Dershowitz <nachum@cs.uiuc.edu>
7 ;; Edward M. Reingold <reingold@cs.uiuc.edu>
8 ;; Maintainer: Glenn Morris <rgm@gnu.org>
9 ;; Keywords: calendar
10 ;; Human-Keywords: Hebrew calendar, calendar, diary
12 ;; This file is part of GNU Emacs.
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 3, or (at your option)
17 ;; any later version.
19 ;; GNU Emacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with GNU Emacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
27 ;; Boston, MA 02110-1301, USA.
29 ;;; Commentary:
31 ;; This collection of functions implements the features of calendar.el and
32 ;; diary.el that deal with the Hebrew calendar.
34 ;; Technical details of all the calendrical calculations can be found in
35 ;; ``Calendrical Calculations: The Millennium Edition'' by Edward M. Reingold
36 ;; and Nachum Dershowitz, Cambridge University Press (2001).
38 ;;; Code:
40 (defvar date)
41 (defvar displayed-month)
42 (defvar displayed-year)
43 (defvar entry)
44 (defvar number)
45 (defvar original-date)
47 (require 'calendar)
48 (eval-when-compile
49 (require 'holidays))
51 (defun hebrew-calendar-leap-year-p (year)
52 "t if YEAR is a Hebrew calendar leap year."
53 (< (% (1+ (* 7 year)) 19) 7))
55 (defun hebrew-calendar-last-month-of-year (year)
56 "The last month of the Hebrew calendar YEAR."
57 (if (hebrew-calendar-leap-year-p year)
59 12))
61 (defun hebrew-calendar-elapsed-days (year)
62 "Days from Sun. prior to start of Hebrew calendar to mean conjunction of Tishri of Hebrew YEAR."
63 (let* ((months-elapsed
64 (+ (* 235 (/ (1- year) 19));; Months in complete cycles so far.
65 (* 12 (% (1- year) 19)) ;; Regular months in this cycle
66 (/ (1+ (* 7 (% (1- year) 19))) 19)));; Leap months this cycle
67 (parts-elapsed (+ 204 (* 793 (% months-elapsed 1080))))
68 (hours-elapsed (+ 5
69 (* 12 months-elapsed)
70 (* 793 (/ months-elapsed 1080))
71 (/ parts-elapsed 1080)))
72 (parts ;; Conjunction parts
73 (+ (* 1080 (% hours-elapsed 24)) (% parts-elapsed 1080)))
74 (day ;; Conjunction day
75 (+ 1 (* 29 months-elapsed) (/ hours-elapsed 24)))
76 (alternative-day
77 (if (or (>= parts 19440) ;; If the new moon is at or after midday,
78 (and (= (% day 7) 2);; ...or is on a Tuesday...
79 (>= parts 9924) ;; at 9 hours, 204 parts or later...
80 (not (hebrew-calendar-leap-year-p year)));; of a
81 ;; common year,
82 (and (= (% day 7) 1);; ...or is on a Monday...
83 (>= parts 16789) ;; at 15 hours, 589 parts or later...
84 (hebrew-calendar-leap-year-p (1- year))));; at the end
85 ;; of a leap year
86 ;; Then postpone Rosh HaShanah one day
87 (1+ day)
88 ;; Else
89 day)))
90 (if ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday
91 (memq (% alternative-day 7) (list 0 3 5))
92 ;; Then postpone it one (more) day and return
93 (1+ alternative-day)
94 ;; Else return
95 alternative-day)))
97 (defun hebrew-calendar-days-in-year (year)
98 "Number of days in Hebrew YEAR."
99 (- (hebrew-calendar-elapsed-days (1+ year))
100 (hebrew-calendar-elapsed-days year)))
102 (defun hebrew-calendar-long-heshvan-p (year)
103 "t if Heshvan is long in Hebrew YEAR."
104 (= (% (hebrew-calendar-days-in-year year) 10) 5))
106 (defun hebrew-calendar-short-kislev-p (year)
107 "t if Kislev is short in Hebrew YEAR."
108 (= (% (hebrew-calendar-days-in-year year) 10) 3))
110 (defun hebrew-calendar-last-day-of-month (month year)
111 "The last day of MONTH in YEAR."
112 (if (or (memq month (list 2 4 6 10 13))
113 (and (= month 12) (not (hebrew-calendar-leap-year-p year)))
114 (and (= month 8) (not (hebrew-calendar-long-heshvan-p year)))
115 (and (= month 9) (hebrew-calendar-short-kislev-p year)))
117 30))
119 (defun calendar-absolute-from-hebrew (date)
120 "Absolute date of Hebrew DATE.
121 The absolute date is the number of days elapsed since the (imaginary)
122 Gregorian date Sunday, December 31, 1 BC."
123 (let* ((month (extract-calendar-month date))
124 (day (extract-calendar-day date))
125 (year (extract-calendar-year date)))
126 (+ day ;; Days so far this month.
127 (if (< month 7);; before Tishri
128 ;; Then add days in prior months this year before and after Nisan
129 (+ (calendar-sum
130 m 7 (<= m (hebrew-calendar-last-month-of-year year))
131 (hebrew-calendar-last-day-of-month m year))
132 (calendar-sum
133 m 1 (< m month)
134 (hebrew-calendar-last-day-of-month m year)))
135 ;; Else add days in prior months this year
136 (calendar-sum
137 m 7 (< m month)
138 (hebrew-calendar-last-day-of-month m year)))
139 (hebrew-calendar-elapsed-days year);; Days in prior years.
140 -1373429))) ;; Days elapsed before absolute date 1.
142 (defun calendar-hebrew-from-absolute (date)
143 "Compute the Hebrew date (month day year) corresponding to absolute DATE.
144 The absolute date is the number of days elapsed since the (imaginary)
145 Gregorian date Sunday, December 31, 1 BC."
146 (let* ((greg-date (calendar-gregorian-from-absolute date))
147 (month (aref [9 10 11 12 1 2 3 4 7 7 7 8]
148 (1- (extract-calendar-month greg-date))))
149 (day)
150 (year (+ 3760 (extract-calendar-year greg-date))))
151 (while (>= date (calendar-absolute-from-hebrew (list 7 1 (1+ year))))
152 (setq year (1+ year)))
153 (let ((length (hebrew-calendar-last-month-of-year year)))
154 (while (> date
155 (calendar-absolute-from-hebrew
156 (list month
157 (hebrew-calendar-last-day-of-month month year)
158 year)))
159 (setq month (1+ (% month length)))))
160 (setq day (1+
161 (- date (calendar-absolute-from-hebrew (list month 1 year)))))
162 (list month day year)))
164 (defvar calendar-hebrew-month-name-array-common-year
165 ["Nisan" "Iyar" "Sivan" "Tammuz" "Av" "Elul" "Tishri"
166 "Heshvan" "Kislev" "Teveth" "Shevat" "Adar"]
167 "Array of strings giving the names of the Hebrew months in a common year.")
169 (defvar calendar-hebrew-month-name-array-leap-year
170 ["Nisan" "Iyar" "Sivan" "Tammuz" "Av" "Elul" "Tishri"
171 "Heshvan" "Kislev" "Teveth" "Shevat" "Adar I" "Adar II"]
172 "Array of strings giving the names of the Hebrew months in a leap year.")
174 (defun calendar-hebrew-date-string (&optional date)
175 "String of Hebrew date before sunset of Gregorian DATE.
176 Defaults to today's date if DATE is not given.
177 Driven by the variable `calendar-date-display-form'."
178 (let* ((hebrew-date (calendar-hebrew-from-absolute
179 (calendar-absolute-from-gregorian
180 (or date (calendar-current-date)))))
181 (calendar-month-name-array
182 (if (hebrew-calendar-leap-year-p (extract-calendar-year hebrew-date))
183 calendar-hebrew-month-name-array-leap-year
184 calendar-hebrew-month-name-array-common-year)))
185 (calendar-date-string hebrew-date nil t)))
187 (defun calendar-print-hebrew-date ()
188 "Show the Hebrew calendar equivalent of the date under the cursor."
189 (interactive)
190 (message "Hebrew date (until sunset): %s"
191 (calendar-hebrew-date-string (calendar-cursor-to-date t))))
193 (defun hebrew-calendar-yahrzeit (death-date year)
194 "Absolute date of the anniversary of Hebrew DEATH-DATE in Hebrew YEAR."
195 (let* ((death-day (extract-calendar-day death-date))
196 (death-month (extract-calendar-month death-date))
197 (death-year (extract-calendar-year death-date)))
198 (cond
199 ;; If it's Heshvan 30 it depends on the first anniversary; if
200 ;; that was not Heshvan 30, use the day before Kislev 1.
201 ((and (= death-month 8)
202 (= death-day 30)
203 (not (hebrew-calendar-long-heshvan-p (1+ death-year))))
204 (1- (calendar-absolute-from-hebrew (list 9 1 year))))
205 ;; If it's Kislev 30 it depends on the first anniversary; if
206 ;; that was not Kislev 30, use the day before Teveth 1.
207 ((and (= death-month 9)
208 (= death-day 30)
209 (hebrew-calendar-short-kislev-p (1+ death-year)))
210 (1- (calendar-absolute-from-hebrew (list 10 1 year))))
211 ;; If it's Adar II, use the same day in last month of
212 ;; year (Adar or Adar II).
213 ((= death-month 13)
214 (calendar-absolute-from-hebrew
215 (list (hebrew-calendar-last-month-of-year year) death-day year)))
216 ;; If it's the 30th in Adar I and year is not a leap year
217 ;; (so Adar has only 29 days), use the last day in Shevat.
218 ((and (= death-day 30)
219 (= death-month 12)
220 (not (hebrew-calendar-leap-year-p year)))
221 (calendar-absolute-from-hebrew (list 11 30 year)))
222 ;; In all other cases, use the normal anniversary of the date of death.
223 (t (calendar-absolute-from-hebrew
224 (list death-month death-day year))))))
226 (defun calendar-goto-hebrew-date (date &optional noecho)
227 "Move cursor to Hebrew DATE; echo Hebrew date unless NOECHO is t."
228 (interactive
229 (let* ((today (calendar-current-date))
230 (year (calendar-read
231 "Hebrew calendar year (>3760): "
232 '(lambda (x) (> x 3760))
233 (int-to-string
234 (extract-calendar-year
235 (calendar-hebrew-from-absolute
236 (calendar-absolute-from-gregorian today))))))
237 (month-array (if (hebrew-calendar-leap-year-p year)
238 calendar-hebrew-month-name-array-leap-year
239 calendar-hebrew-month-name-array-common-year))
240 (completion-ignore-case t)
241 (month (cdr (assoc-string
242 (completing-read
243 "Hebrew calendar month name: "
244 (mapcar 'list (append month-array nil))
245 (if (= year 3761)
246 '(lambda (x)
247 (let ((m (cdr
248 (assoc-string
249 (car x)
250 (calendar-make-alist month-array)
251 t))))
252 (< 0
253 (calendar-absolute-from-hebrew
254 (list m
255 (hebrew-calendar-last-day-of-month
256 m year)
257 year))))))
259 (calendar-make-alist month-array 1) t)))
260 (last (hebrew-calendar-last-day-of-month month year))
261 (first (if (and (= year 3761) (= month 10))
262 18 1))
263 (day (calendar-read
264 (format "Hebrew calendar day (%d-%d): "
265 first last)
266 '(lambda (x) (and (<= first x) (<= x last))))))
267 (list (list month day year))))
268 (calendar-goto-date (calendar-gregorian-from-absolute
269 (calendar-absolute-from-hebrew date)))
270 (or noecho (calendar-print-hebrew-date)))
272 (defun holiday-hebrew (month day string)
273 "Holiday on MONTH, DAY (Hebrew) called STRING.
274 If MONTH, DAY (Hebrew) is visible, the value returned is corresponding
275 Gregorian date in the form of the list (((month day year) STRING)). Returns
276 nil if it is not visible in the current calendar window."
277 (if (memq displayed-month;; This test is only to speed things up a bit;
278 (list ;; it works fine without the test too.
279 (if (< 11 month) (- month 11) (+ month 1))
280 (if (< 10 month) (- month 10) (+ month 2))
281 (if (< 9 month) (- month 9) (+ month 3))
282 (if (< 8 month) (- month 8) (+ month 4))
283 (if (< 7 month) (- month 7) (+ month 5))))
284 (let ((m1 displayed-month)
285 (y1 displayed-year)
286 (m2 displayed-month)
287 (y2 displayed-year)
288 (year))
289 (increment-calendar-month m1 y1 -1)
290 (increment-calendar-month m2 y2 1)
291 (let* ((start-date (calendar-absolute-from-gregorian
292 (list m1 1 y1)))
293 (end-date (calendar-absolute-from-gregorian
294 (list m2 (calendar-last-day-of-month m2 y2) y2)))
295 (hebrew-start (calendar-hebrew-from-absolute start-date))
296 (hebrew-end (calendar-hebrew-from-absolute end-date))
297 (hebrew-y1 (extract-calendar-year hebrew-start))
298 (hebrew-y2 (extract-calendar-year hebrew-end)))
299 (setq year (if (< 6 month) hebrew-y2 hebrew-y1))
300 (let ((date (calendar-gregorian-from-absolute
301 (calendar-absolute-from-hebrew
302 (list month day year)))))
303 (if (calendar-date-is-visible-p date)
304 (list (list date string))))))))
306 (defun holiday-rosh-hashanah-etc ()
307 "List of dates related to Rosh Hashanah, as visible in calendar window."
308 (if (or (< displayed-month 8)
309 (> displayed-month 11))
310 nil;; None of the dates is visible
311 (let* ((abs-r-h (calendar-absolute-from-hebrew
312 (list 7 1 (+ displayed-year 3761))))
313 (mandatory
314 (list
315 (list (calendar-gregorian-from-absolute abs-r-h)
316 (format "Rosh HaShanah %d" (+ 3761 displayed-year)))
317 (list (calendar-gregorian-from-absolute (+ abs-r-h 9))
318 "Yom Kippur")
319 (list (calendar-gregorian-from-absolute (+ abs-r-h 14))
320 "Sukkot")
321 (list (calendar-gregorian-from-absolute (+ abs-r-h 21))
322 "Shemini Atzeret")
323 (list (calendar-gregorian-from-absolute (+ abs-r-h 22))
324 "Simchat Torah")))
325 (optional
326 (list
327 (list (calendar-gregorian-from-absolute
328 (calendar-dayname-on-or-before 6 (- abs-r-h 4)))
329 "Selichot (night)")
330 (list (calendar-gregorian-from-absolute (1- abs-r-h))
331 "Erev Rosh HaShanah")
332 (list (calendar-gregorian-from-absolute (1+ abs-r-h))
333 "Rosh HaShanah (second day)")
334 (list (calendar-gregorian-from-absolute
335 (if (= (% abs-r-h 7) 4) (+ abs-r-h 3) (+ abs-r-h 2)))
336 "Tzom Gedaliah")
337 (list (calendar-gregorian-from-absolute
338 (calendar-dayname-on-or-before 6 (+ 7 abs-r-h)))
339 "Shabbat Shuvah")
340 (list (calendar-gregorian-from-absolute (+ abs-r-h 8))
341 "Erev Yom Kippur")
342 (list (calendar-gregorian-from-absolute (+ abs-r-h 13))
343 "Erev Sukkot")
344 (list (calendar-gregorian-from-absolute (+ abs-r-h 15))
345 "Sukkot (second day)")
346 (list (calendar-gregorian-from-absolute (+ abs-r-h 16))
347 "Hol Hamoed Sukkot (first day)")
348 (list (calendar-gregorian-from-absolute (+ abs-r-h 17))
349 "Hol Hamoed Sukkot (second day)")
350 (list (calendar-gregorian-from-absolute (+ abs-r-h 18))
351 "Hol Hamoed Sukkot (third day)")
352 (list (calendar-gregorian-from-absolute (+ abs-r-h 19))
353 "Hol Hamoed Sukkot (fourth day)")
354 (list (calendar-gregorian-from-absolute (+ abs-r-h 20))
355 "Hoshanah Rabbah")))
356 (output-list
357 (holiday-filter-visible-calendar mandatory)))
358 (if all-hebrew-calendar-holidays
359 (setq output-list
360 (append
361 (holiday-filter-visible-calendar optional)
362 output-list)))
363 output-list)))
365 (defun holiday-hanukkah ()
366 "List of dates related to Hanukkah, as visible in calendar window."
367 (if (memq displayed-month;; This test is only to speed things up a bit;
368 '(10 11 12 1 2));; it works fine without the test too.
369 (let ((m displayed-month)
370 (y displayed-year))
371 (increment-calendar-month m y 1)
372 (let* ((h-y (extract-calendar-year
373 (calendar-hebrew-from-absolute
374 (calendar-absolute-from-gregorian
375 (list m (calendar-last-day-of-month m y) y)))))
376 (abs-h (calendar-absolute-from-hebrew (list 9 25 h-y))))
377 (holiday-filter-visible-calendar
378 (list
379 (list (calendar-gregorian-from-absolute (1- abs-h))
380 "Erev Hanukkah")
381 (list (calendar-gregorian-from-absolute abs-h)
382 "Hanukkah (first day)")
383 (list (calendar-gregorian-from-absolute (1+ abs-h))
384 "Hanukkah (second day)")
385 (list (calendar-gregorian-from-absolute (+ abs-h 2))
386 "Hanukkah (third day)")
387 (list (calendar-gregorian-from-absolute (+ abs-h 3))
388 "Hanukkah (fourth day)")
389 (list (calendar-gregorian-from-absolute (+ abs-h 4))
390 "Hanukkah (fifth day)")
391 (list (calendar-gregorian-from-absolute (+ abs-h 5))
392 "Hanukkah (sixth day)")
393 (list (calendar-gregorian-from-absolute (+ abs-h 6))
394 "Hanukkah (seventh day)")
395 (list (calendar-gregorian-from-absolute (+ abs-h 7))
396 "Hanukkah (eighth day)")))))))
398 (defun holiday-passover-etc ()
399 "List of dates related to Passover, as visible in calendar window."
400 (if (< 7 displayed-month)
401 nil;; None of the dates is visible
402 (let* ((abs-p (calendar-absolute-from-hebrew
403 (list 1 15 (+ displayed-year 3760))))
404 (mandatory
405 (list
406 (list (calendar-gregorian-from-absolute abs-p)
407 "Passover")
408 (list (calendar-gregorian-from-absolute (+ abs-p 50))
409 "Shavuot")))
410 (optional
411 (list
412 (list (calendar-gregorian-from-absolute
413 (calendar-dayname-on-or-before 6 (- abs-p 43)))
414 "Shabbat Shekalim")
415 (list (calendar-gregorian-from-absolute
416 (calendar-dayname-on-or-before 6 (- abs-p 30)))
417 "Shabbat Zachor")
418 (list (calendar-gregorian-from-absolute
419 (if (= (% abs-p 7) 2) (- abs-p 33) (- abs-p 31)))
420 "Fast of Esther")
421 (list (calendar-gregorian-from-absolute (- abs-p 31))
422 "Erev Purim")
423 (list (calendar-gregorian-from-absolute (- abs-p 30))
424 "Purim")
425 (list (calendar-gregorian-from-absolute
426 (if (zerop (% abs-p 7)) (- abs-p 28) (- abs-p 29)))
427 "Shushan Purim")
428 (list (calendar-gregorian-from-absolute
429 (- (calendar-dayname-on-or-before 6 (- abs-p 14)) 7))
430 "Shabbat Parah")
431 (list (calendar-gregorian-from-absolute
432 (calendar-dayname-on-or-before 6 (- abs-p 14)))
433 "Shabbat HaHodesh")
434 (list (calendar-gregorian-from-absolute
435 (calendar-dayname-on-or-before 6 (1- abs-p)))
436 "Shabbat HaGadol")
437 (list (calendar-gregorian-from-absolute (1- abs-p))
438 "Erev Passover")
439 (list (calendar-gregorian-from-absolute (1+ abs-p))
440 "Passover (second day)")
441 (list (calendar-gregorian-from-absolute (+ abs-p 2))
442 "Hol Hamoed Passover (first day)")
443 (list (calendar-gregorian-from-absolute (+ abs-p 3))
444 "Hol Hamoed Passover (second day)")
445 (list (calendar-gregorian-from-absolute (+ abs-p 4))
446 "Hol Hamoed Passover (third day)")
447 (list (calendar-gregorian-from-absolute (+ abs-p 5))
448 "Hol Hamoed Passover (fourth day)")
449 (list (calendar-gregorian-from-absolute (+ abs-p 6))
450 "Passover (seventh day)")
451 (list (calendar-gregorian-from-absolute (+ abs-p 7))
452 "Passover (eighth day)")
453 (list (calendar-gregorian-from-absolute
454 (if (zerop (% (+ abs-p 12) 7))
455 (+ abs-p 13)
456 (+ abs-p 12)))
457 "Yom HaShoah")
458 (list (calendar-gregorian-from-absolute
459 (if (zerop (% abs-p 7))
460 (+ abs-p 18)
461 (if (= (% abs-p 7) 6)
462 (+ abs-p 19)
463 (+ abs-p 20))))
464 "Yom HaAtzma'ut")
465 (list (calendar-gregorian-from-absolute (+ abs-p 33))
466 "Lag BaOmer")
467 (list (calendar-gregorian-from-absolute (+ abs-p 43))
468 "Yom Yerushalaim")
469 (list (calendar-gregorian-from-absolute (+ abs-p 49))
470 "Erev Shavuot")
471 (list (calendar-gregorian-from-absolute (+ abs-p 51))
472 "Shavuot (second day)")))
473 (output-list
474 (holiday-filter-visible-calendar mandatory)))
475 (if all-hebrew-calendar-holidays
476 (setq output-list
477 (append
478 (holiday-filter-visible-calendar optional)
479 output-list)))
480 output-list)))
482 (defun holiday-tisha-b-av-etc ()
483 "List of dates around Tisha B'Av, as visible in calendar window."
484 (if (or (< displayed-month 5)
485 (> displayed-month 9))
486 nil;; None of the dates is visible
487 (let* ((abs-t-a (calendar-absolute-from-hebrew
488 (list 5 9 (+ displayed-year 3760)))))
490 (holiday-filter-visible-calendar
491 (list
492 (list (calendar-gregorian-from-absolute
493 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21)))
494 "Tzom Tammuz")
495 (list (calendar-gregorian-from-absolute
496 (calendar-dayname-on-or-before 6 abs-t-a))
497 "Shabbat Hazon")
498 (list (calendar-gregorian-from-absolute
499 (if (= (% abs-t-a 7) 6) (1+ abs-t-a) abs-t-a))
500 "Tisha B'Av")
501 (list (calendar-gregorian-from-absolute
502 (calendar-dayname-on-or-before 6 (+ abs-t-a 7)))
503 "Shabbat Nahamu"))))))
505 (defun list-hebrew-diary-entries ()
506 "Add any Hebrew date entries from the diary file to `diary-entries-list'.
507 Hebrew date diary entries must be prefaced by `hebrew-diary-entry-symbol'
508 \(normally an `H'). The same diary date forms govern the style of the Hebrew
509 calendar entries, except that the Hebrew month names must be spelled in full.
510 The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being
511 Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a
512 common Hebrew year. If a Hebrew date diary entry begins with a
513 `diary-nonmarking-symbol', the entry will appear in the diary listing, but will
514 not be marked in the calendar. This function is provided for use with the
515 `nongregorian-diary-listing-hook'."
516 (if (< 0 number)
517 (let ((buffer-read-only nil)
518 (diary-modified (buffer-modified-p))
519 (gdate original-date)
520 (mark (regexp-quote diary-nonmarking-symbol)))
521 (dotimes (idummy number)
522 (let* ((d diary-date-forms)
523 (hdate (calendar-hebrew-from-absolute
524 (calendar-absolute-from-gregorian gdate)))
525 (month (extract-calendar-month hdate))
526 (day (extract-calendar-day hdate))
527 (year (extract-calendar-year hdate)))
528 (while d
529 (let*
530 ((date-form (if (equal (car (car d)) 'backup)
531 (cdr (car d))
532 (car d)))
533 (backup (equal (car (car d)) 'backup))
534 (dayname
535 (format "%s\\|%s\\.?"
536 (calendar-day-name gdate)
537 (calendar-day-name gdate 'abbrev)))
538 (calendar-month-name-array
539 calendar-hebrew-month-name-array-leap-year)
540 (monthname
541 (concat
542 "\\*\\|"
543 (calendar-month-name month)))
544 (month (concat "\\*\\|0*" (int-to-string month)))
545 (day (concat "\\*\\|0*" (int-to-string day)))
546 (year
547 (concat
548 "\\*\\|0*" (int-to-string year)
549 (if abbreviated-calendar-year
550 (concat "\\|" (int-to-string (% year 100)))
551 "")))
552 (regexp
553 (concat
554 "\\(\\`\\|\^M\\|\n\\)" mark "?"
555 (regexp-quote hebrew-diary-entry-symbol)
556 "\\("
557 (mapconcat 'eval date-form "\\)\\(")
558 "\\)"))
559 (case-fold-search t))
560 (goto-char (point-min))
561 (while (re-search-forward regexp nil t)
562 (if backup (re-search-backward "\\<" nil t))
563 (if (and (or (char-equal (preceding-char) ?\^M)
564 (char-equal (preceding-char) ?\n))
565 (not (looking-at " \\|\^I")))
566 ;; Diary entry that consists only of date.
567 (backward-char 1)
568 ;; Found a nonempty diary entry--make it visible and
569 ;; add it to the list.
570 (let ((entry-start (point))
571 (date-start))
572 (re-search-backward "\^M\\|\n\\|\\`")
573 (setq date-start (point))
574 (re-search-forward "\^M\\|\n" nil t 2)
575 (while (looking-at " \\|\^I")
576 (re-search-forward "\^M\\|\n" nil t))
577 (backward-char 1)
578 (subst-char-in-region date-start (point) ?\^M ?\n t)
579 (add-to-diary-list
580 gdate
581 (buffer-substring-no-properties entry-start (point))
582 (buffer-substring-no-properties
583 (1+ date-start) (1- entry-start))
584 (copy-marker entry-start))))))
585 (setq d (cdr d))))
586 (setq gdate
587 (calendar-gregorian-from-absolute
588 (1+ (calendar-absolute-from-gregorian gdate)))))
589 (set-buffer-modified-p diary-modified))
590 (goto-char (point-min))))
592 (defun mark-hebrew-calendar-date-pattern (month day year)
593 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR.
594 A value of 0 in any position is a wildcard."
595 (save-excursion
596 (set-buffer calendar-buffer)
597 (if (and (/= 0 month) (/= 0 day))
598 (if (/= 0 year)
599 ;; Fully specified Hebrew date.
600 (let ((date (calendar-gregorian-from-absolute
601 (calendar-absolute-from-hebrew
602 (list month day year)))))
603 (if (calendar-date-is-visible-p date)
604 (mark-visible-calendar-date date)))
605 ;; Month and day in any year--this taken from the holiday stuff.
606 (if (memq displayed-month;; This test is only to speed things up a
607 (list ;; bit; it works fine without the test too.
608 (if (< 11 month) (- month 11) (+ month 1))
609 (if (< 10 month) (- month 10) (+ month 2))
610 (if (< 9 month) (- month 9) (+ month 3))
611 (if (< 8 month) (- month 8) (+ month 4))
612 (if (< 7 month) (- month 7) (+ month 5))))
613 (let ((m1 displayed-month)
614 (y1 displayed-year)
615 (m2 displayed-month)
616 (y2 displayed-year)
617 (year))
618 (increment-calendar-month m1 y1 -1)
619 (increment-calendar-month m2 y2 1)
620 (let* ((start-date (calendar-absolute-from-gregorian
621 (list m1 1 y1)))
622 (end-date (calendar-absolute-from-gregorian
623 (list m2
624 (calendar-last-day-of-month m2 y2)
625 y2)))
626 (hebrew-start
627 (calendar-hebrew-from-absolute start-date))
628 (hebrew-end (calendar-hebrew-from-absolute end-date))
629 (hebrew-y1 (extract-calendar-year hebrew-start))
630 (hebrew-y2 (extract-calendar-year hebrew-end)))
631 (setq year (if (< 6 month) hebrew-y2 hebrew-y1))
632 (let ((date (calendar-gregorian-from-absolute
633 (calendar-absolute-from-hebrew
634 (list month day year)))))
635 (if (calendar-date-is-visible-p date)
636 (mark-visible-calendar-date date)))))))
637 ;; Not one of the simple cases--check all visible dates for match.
638 ;; Actually, the following code takes care of ALL of the cases, but
639 ;; it's much too slow to be used for the simple (common) cases.
640 (let ((m displayed-month)
641 (y displayed-year)
642 (first-date)
643 (last-date))
644 (increment-calendar-month m y -1)
645 (setq first-date
646 (calendar-absolute-from-gregorian
647 (list m 1 y)))
648 (increment-calendar-month m y 2)
649 (setq last-date
650 (calendar-absolute-from-gregorian
651 (list m (calendar-last-day-of-month m y) y)))
652 (calendar-for-loop date from first-date to last-date do
653 (let* ((h-date (calendar-hebrew-from-absolute date))
654 (h-month (extract-calendar-month h-date))
655 (h-day (extract-calendar-day h-date))
656 (h-year (extract-calendar-year h-date)))
657 (and (or (zerop month)
658 (= month h-month))
659 (or (zerop day)
660 (= day h-day))
661 (or (zerop year)
662 (= year h-year))
663 (mark-visible-calendar-date
664 (calendar-gregorian-from-absolute date)))))))))
666 (defun mark-hebrew-diary-entries ()
667 "Mark days in the calendar window that have Hebrew date diary entries.
668 Each entry in diary-file (or included files) visible in the calendar window
669 is marked. Hebrew date entries are prefaced by a hebrew-diary-entry-symbol
670 \(normally an `H'). The same diary-date-forms govern the style of the Hebrew
671 calendar entries, except that the Hebrew month names must be spelled in full.
672 The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being
673 Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a
674 common Hebrew year. Hebrew date diary entries that begin with a
675 diary-nonmarking symbol will not be marked in the calendar. This function
676 is provided for use as part of the nongregorian-diary-marking-hook."
677 (let ((d diary-date-forms))
678 (while d
679 (let*
680 ((date-form (if (equal (car (car d)) 'backup)
681 (cdr (car d))
682 (car d)));; ignore 'backup directive
683 (dayname (diary-name-pattern calendar-day-name-array
684 calendar-day-abbrev-array))
685 (monthname
686 (format "%s\\|\\*"
687 (diary-name-pattern
688 calendar-hebrew-month-name-array-leap-year)))
689 (month "[0-9]+\\|\\*")
690 (day "[0-9]+\\|\\*")
691 (year "[0-9]+\\|\\*")
692 (l (length date-form))
693 (d-name-pos (- l (length (memq 'dayname date-form))))
694 (d-name-pos (if (/= l d-name-pos) (+ 2 d-name-pos)))
695 (m-name-pos (- l (length (memq 'monthname date-form))))
696 (m-name-pos (if (/= l m-name-pos) (+ 2 m-name-pos)))
697 (d-pos (- l (length (memq 'day date-form))))
698 (d-pos (if (/= l d-pos) (+ 2 d-pos)))
699 (m-pos (- l (length (memq 'month date-form))))
700 (m-pos (if (/= l m-pos) (+ 2 m-pos)))
701 (y-pos (- l (length (memq 'year date-form))))
702 (y-pos (if (/= l y-pos) (+ 2 y-pos)))
703 (regexp
704 (concat
705 "\\(\\`\\|\^M\\|\n\\)"
706 (regexp-quote hebrew-diary-entry-symbol)
707 "\\("
708 (mapconcat 'eval date-form "\\)\\(")
709 "\\)"))
710 (case-fold-search t))
711 (goto-char (point-min))
712 (while (re-search-forward regexp nil t)
713 (let* ((dd-name
714 (if d-name-pos
715 (buffer-substring
716 (match-beginning d-name-pos)
717 (match-end d-name-pos))))
718 (mm-name
719 (if m-name-pos
720 (buffer-substring
721 (match-beginning m-name-pos)
722 (match-end m-name-pos))))
723 (mm (string-to-number
724 (if m-pos
725 (buffer-substring
726 (match-beginning m-pos)
727 (match-end m-pos))
728 "")))
729 (dd (string-to-number
730 (if d-pos
731 (buffer-substring
732 (match-beginning d-pos)
733 (match-end d-pos))
734 "")))
735 (y-str (if y-pos
736 (buffer-substring
737 (match-beginning y-pos)
738 (match-end y-pos))))
739 (yy (if (not y-str)
741 (if (and (= (length y-str) 2)
742 abbreviated-calendar-year)
743 (let* ((current-y
744 (extract-calendar-year
745 (calendar-hebrew-from-absolute
746 (calendar-absolute-from-gregorian
747 (calendar-current-date)))))
748 (y (+ (string-to-number y-str)
749 (* 100 (/ current-y 100)))))
750 (if (> (- y current-y) 50)
751 (- y 100)
752 (if (> (- current-y y) 50)
753 (+ y 100)
754 y)))
755 (string-to-number y-str)))))
756 (if dd-name
757 (mark-calendar-days-named
758 (cdr (assoc-string dd-name
759 (calendar-make-alist
760 calendar-day-name-array
761 0 nil calendar-day-abbrev-array) t)))
762 (if mm-name
763 (setq mm
764 (if (string-equal mm-name "*") 0
765 (cdr
766 (assoc-string
767 mm-name
768 (calendar-make-alist
769 calendar-hebrew-month-name-array-leap-year) t)))))
770 (mark-hebrew-calendar-date-pattern mm dd yy)))))
771 (setq d (cdr d)))))
773 (defun insert-hebrew-diary-entry (arg)
774 "Insert a diary entry.
775 For the Hebrew date corresponding to the date indicated by point.
776 Prefix arg will make the entry nonmarking."
777 (interactive "P")
778 (let* ((calendar-month-name-array
779 calendar-hebrew-month-name-array-leap-year))
780 (make-diary-entry
781 (concat
782 hebrew-diary-entry-symbol
783 (calendar-date-string
784 (calendar-hebrew-from-absolute
785 (calendar-absolute-from-gregorian
786 (calendar-cursor-to-date t)))
787 nil t))
788 arg)))
790 (defun insert-monthly-hebrew-diary-entry (arg)
791 "Insert a monthly diary entry.
792 For the day of the Hebrew month corresponding to the date indicated by point.
793 Prefix arg will make the entry nonmarking."
794 (interactive "P")
795 (let* ((calendar-date-display-form
796 (if european-calendar-style '(day " * ") '("* " day )))
797 (calendar-month-name-array
798 calendar-hebrew-month-name-array-leap-year))
799 (make-diary-entry
800 (concat
801 hebrew-diary-entry-symbol
802 (calendar-date-string
803 (calendar-hebrew-from-absolute
804 (calendar-absolute-from-gregorian
805 (calendar-cursor-to-date t)))))
806 arg)))
808 (defun insert-yearly-hebrew-diary-entry (arg)
809 "Insert an annual diary entry.
810 For the day of the Hebrew year corresponding to the date indicated by point.
811 Prefix arg will make the entry nonmarking."
812 (interactive "P")
813 (let* ((calendar-date-display-form
814 (if european-calendar-style
815 '(day " " monthname)
816 '(monthname " " day)))
817 (calendar-month-name-array
818 calendar-hebrew-month-name-array-leap-year))
819 (make-diary-entry
820 (concat
821 hebrew-diary-entry-symbol
822 (calendar-date-string
823 (calendar-hebrew-from-absolute
824 (calendar-absolute-from-gregorian
825 (calendar-cursor-to-date t)))))
826 arg)))
828 ;;;###autoload
829 (defun list-yahrzeit-dates (death-date start-year end-year)
830 "List Yahrzeit dates for *Gregorian* DEATH-DATE from START-YEAR to END-YEAR.
831 When called interactively from the calendar window, the date of death is taken
832 from the cursor position."
833 (interactive
834 (let* ((death-date
835 (if (equal (current-buffer) (get-buffer calendar-buffer))
836 (calendar-cursor-to-date)
837 (let* ((today (calendar-current-date))
838 (year (calendar-read
839 "Year of death (>0): "
840 '(lambda (x) (> x 0))
841 (int-to-string (extract-calendar-year today))))
842 (month-array calendar-month-name-array)
843 (completion-ignore-case t)
844 (month (cdr (assoc-string
845 (completing-read
846 "Month of death (name): "
847 (mapcar 'list (append month-array nil))
848 nil t)
849 (calendar-make-alist month-array 1) t)))
850 (last (calendar-last-day-of-month month year))
851 (day (calendar-read
852 (format "Day of death (1-%d): " last)
853 '(lambda (x) (and (< 0 x) (<= x last))))))
854 (list month day year))))
855 (death-year (extract-calendar-year death-date))
856 (start-year (calendar-read
857 (format "Starting year of Yahrzeit table (>%d): "
858 death-year)
859 '(lambda (x) (> x death-year))
860 (int-to-string (1+ death-year))))
861 (end-year (calendar-read
862 (format "Ending year of Yahrzeit table (>=%d): "
863 start-year)
864 '(lambda (x) (>= x start-year)))))
865 (list death-date start-year end-year)))
866 (message "Computing yahrzeits...")
867 (let* ((yahrzeit-buffer "*Yahrzeits*")
868 (h-date (calendar-hebrew-from-absolute
869 (calendar-absolute-from-gregorian death-date)))
870 (h-month (extract-calendar-month h-date))
871 (h-day (extract-calendar-day h-date))
872 (h-year (extract-calendar-year h-date)))
873 (set-buffer (get-buffer-create yahrzeit-buffer))
874 (setq buffer-read-only nil)
875 (calendar-set-mode-line
876 (format "Yahrzeit dates for %s = %s"
877 (calendar-date-string death-date)
878 (let ((calendar-month-name-array
879 (if (hebrew-calendar-leap-year-p h-year)
880 calendar-hebrew-month-name-array-leap-year
881 calendar-hebrew-month-name-array-common-year)))
882 (calendar-date-string h-date nil t))))
883 (erase-buffer)
884 (goto-char (point-min))
885 (calendar-for-loop i from start-year to end-year do
886 (insert
887 (calendar-date-string
888 (calendar-gregorian-from-absolute
889 (hebrew-calendar-yahrzeit
890 h-date
891 (extract-calendar-year
892 (calendar-hebrew-from-absolute
893 (calendar-absolute-from-gregorian (list 1 1 i))))))) "\n"))
894 (goto-char (point-min))
895 (set-buffer-modified-p nil)
896 (setq buffer-read-only t)
897 (display-buffer yahrzeit-buffer)
898 (message "Computing yahrzeits...done")))
900 (defun diary-hebrew-date ()
901 "Hebrew calendar equivalent of date diary entry."
902 (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date)))
904 (defun diary-omer (&optional mark)
905 "Omer count diary entry.
906 Entry applies if date is within 50 days after Passover.
908 An optional parameter MARK specifies a face or single-character string to
909 use when highlighting the day in the calendar."
910 (let* ((passover
911 (calendar-absolute-from-hebrew
912 (list 1 15 (+ (extract-calendar-year date) 3760))))
913 (omer (- (calendar-absolute-from-gregorian date) passover))
914 (week (/ omer 7))
915 (day (% omer 7)))
916 (if (and (> omer 0) (< omer 50))
917 (cons mark
918 (format "Day %d%s of the omer (until sunset)"
919 omer
920 (if (zerop week)
922 (format ", that is, %d week%s%s"
923 week
924 (if (= week 1) "" "s")
925 (if (zerop day)
927 (format " and %d day%s"
928 day (if (= day 1) "" "s"))))))))))
930 (defun diary-yahrzeit (death-month death-day death-year &optional mark)
931 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before.
932 Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed
933 to be the name of the person. Date of death is on the *civil* calendar;
934 although the date of death is specified by the civil calendar, the proper
935 Hebrew calendar yahrzeit is determined. If `european-calendar-style' is t, the
936 order of the parameters is changed to DEATH-DAY, DEATH-MONTH, DEATH-YEAR.
938 An optional parameter MARK specifies a face or single-character string to
939 use when highlighting the day in the calendar."
940 (let* ((h-date (calendar-hebrew-from-absolute
941 (calendar-absolute-from-gregorian
942 (if european-calendar-style
943 (list death-day death-month death-year)
944 (list death-month death-day death-year)))))
945 (h-month (extract-calendar-month h-date))
946 (h-day (extract-calendar-day h-date))
947 (h-year (extract-calendar-year h-date))
948 (d (calendar-absolute-from-gregorian date))
949 (yr (extract-calendar-year (calendar-hebrew-from-absolute d)))
950 (diff (- yr h-year))
951 (y (hebrew-calendar-yahrzeit h-date yr)))
952 (if (and (> diff 0) (or (= y d) (= y (1+ d))))
953 (cons mark
954 (format "Yahrzeit of %s%s: %d%s anniversary"
955 entry
956 (if (= y d) "" " (evening)")
957 diff
958 (cond ((= (% diff 10) 1) "st")
959 ((= (% diff 10) 2) "nd")
960 ((= (% diff 10) 3) "rd")
961 (t "th")))))))
963 (defun diary-rosh-hodesh (&optional mark)
964 "Rosh Hodesh diary entry.
965 Entry applies if date is Rosh Hodesh, the day before, or the Saturday before.
967 An optional parameter MARK specifies a face or single-character string to
968 use when highlighting the day in the calendar."
969 (let* ((d (calendar-absolute-from-gregorian date))
970 (h-date (calendar-hebrew-from-absolute d))
971 (h-month (extract-calendar-month h-date))
972 (h-day (extract-calendar-day h-date))
973 (h-year (extract-calendar-year h-date))
974 (leap-year (hebrew-calendar-leap-year-p h-year))
975 (last-day (hebrew-calendar-last-day-of-month h-month h-year))
976 (h-month-names
977 (if leap-year
978 calendar-hebrew-month-name-array-leap-year
979 calendar-hebrew-month-name-array-common-year))
980 (this-month (aref h-month-names (1- h-month)))
981 (h-yesterday (extract-calendar-day
982 (calendar-hebrew-from-absolute (1- d)))))
983 (if (or (= h-day 30) (and (= h-day 1) (/= h-month 7)))
984 (cons mark
985 (format
986 "Rosh Hodesh %s"
987 (if (= h-day 30)
988 (format
989 "%s (first day)"
990 ;; next month must be in the same year since this
991 ;; month can't be the last month of the year since
992 ;; it has 30 days
993 (aref h-month-names h-month))
994 (if (= h-yesterday 30)
995 (format "%s (second day)" this-month)
996 this-month))))
997 (if (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim
998 (cons mark
999 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day))
1000 (format "Mevarchim Rosh Hodesh %s (%s)"
1001 (aref h-month-names
1002 (if (= h-month
1003 (hebrew-calendar-last-month-of-year
1004 h-year))
1005 0 h-month))
1006 (aref calendar-day-name-array (- 29 h-day))))
1007 ((and (< h-day 30) (> h-day 22) (= 30 last-day))
1008 (format "Mevarchim Rosh Hodesh %s (%s-%s)"
1009 (aref h-month-names h-month)
1010 (if (= h-day 29)
1011 "tomorrow"
1012 (aref calendar-day-name-array (- 29 h-day)))
1013 (aref calendar-day-name-array
1014 (% (- 30 h-day) 7))))))
1015 (if (and (= h-day 29) (/= h-month 6))
1016 (cons mark
1017 (format "Erev Rosh Hodesh %s"
1018 (aref h-month-names
1019 (if (= h-month
1020 (hebrew-calendar-last-month-of-year
1021 h-year))
1022 0 h-month)))))))))
1024 (defvar hebrew-calendar-parashiot-names
1025 ["Bereshith" "Noah" "Lech L'cha" "Vayera" "Hayei Sarah" "Toledoth"
1026 "Vayetze" "Vayishlah" "Vayeshev" "Mikketz" "Vayiggash" "Vayhi"
1027 "Shemoth" "Vaera" "Bo" "Beshallah" "Yithro" "Mishpatim"
1028 "Terumah" "Tetzavveh" "Ki Tissa" "Vayakhel" "Pekudei" "Vayikra"
1029 "Tzav" "Shemini" "Tazria" "Metzora" "Aharei Moth" "Kedoshim"
1030 "Emor" "Behar" "Behukkotai" "Bemidbar" "Naso" "Behaalot'cha"
1031 "Shelah L'cha" "Korah" "Hukkath" "Balak" "Pinhas" "Mattoth"
1032 "Masei" "Devarim" "Vaethanan" "Ekev" "Reeh" "Shofetim"
1033 "Ki Tetze" "Ki Tavo" "Nitzavim" "Vayelech" "Haazinu"]
1034 "The names of the parashiot in the Torah.")
1036 (defun hebrew-calendar-parasha-name (p)
1037 "Name(s) corresponding to parasha P."
1038 (if (arrayp p);; combined parasha
1039 (format "%s/%s"
1040 (aref hebrew-calendar-parashiot-names (aref p 0))
1041 (aref hebrew-calendar-parashiot-names (aref p 1)))
1042 (aref hebrew-calendar-parashiot-names p)))
1044 (defun diary-parasha (&optional mark)
1045 "Parasha diary entry--entry applies if date is a Saturday.
1047 An optional parameter MARK specifies a face or single-character string to
1048 use when highlighting the day in the calendar."
1049 (let ((d (calendar-absolute-from-gregorian date)))
1050 (if (= (% d 7) 6) ;; Saturday
1051 (let*
1052 ((h-year (extract-calendar-year
1053 (calendar-hebrew-from-absolute d)))
1054 (rosh-hashanah
1055 (calendar-absolute-from-hebrew (list 7 1 h-year)))
1056 (passover
1057 (calendar-absolute-from-hebrew (list 1 15 h-year)))
1058 (rosh-hashanah-day
1059 (aref calendar-day-name-array (% rosh-hashanah 7)))
1060 (passover-day
1061 (aref calendar-day-name-array (% passover 7)))
1062 (long-h (hebrew-calendar-long-heshvan-p h-year))
1063 (short-k (hebrew-calendar-short-kislev-p h-year))
1064 (type (cond ((and long-h (not short-k)) "complete")
1065 ((and (not long-h) short-k) "incomplete")
1066 (t "regular")))
1067 (year-format
1068 (symbol-value
1069 (intern (format "hebrew-calendar-year-%s-%s-%s" ;; keviah
1070 rosh-hashanah-day type passover-day))))
1071 (first-saturday ;; of Hebrew year
1072 (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah)))
1073 (saturday ;; which Saturday of the Hebrew year
1074 (/ (- d first-saturday) 7))
1075 (parasha (aref year-format saturday)))
1076 (if parasha
1077 (cons mark
1078 (format
1079 "Parashat %s"
1080 (if (listp parasha) ;; Israel differs from diaspora
1081 (if (car parasha)
1082 (format "%s (diaspora), %s (Israel)"
1083 (hebrew-calendar-parasha-name (car parasha))
1084 (hebrew-calendar-parasha-name (cdr parasha)))
1085 (format "%s (Israel)"
1086 (hebrew-calendar-parasha-name (cdr parasha))))
1087 (hebrew-calendar-parasha-name parasha)))))))))
1089 ;; The seven ordinary year types (keviot)
1091 (defconst hebrew-calendar-year-Saturday-incomplete-Sunday
1092 [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]
1093 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42]
1094 43 44 45 46 47 48 49 50]
1095 "The structure of the parashiot.
1096 Hebrew year starts on Saturday, is `incomplete' (Heshvan and Kislev each have
1097 29 days), and has Passover start on Sunday.")
1099 (defconst hebrew-calendar-year-Saturday-complete-Tuesday
1100 [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]
1101 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42]
1102 43 44 45 46 47 48 49 [50 51]]
1103 "The structure of the parashiot.
1104 Hebrew year that starts on Saturday, is `complete' (Heshvan and Kislev each
1105 have 30 days), and has Passover start on Tuesday.")
1107 (defconst hebrew-calendar-year-Monday-incomplete-Tuesday
1108 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22]
1109 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42]
1110 43 44 45 46 47 48 49 [50 51]]
1111 "The structure of the parashiot.
1112 Hebrew year that starts on Monday, is `incomplete' (Heshvan and Kislev each
1113 have 29 days), and has Passover start on Tuesday.")
1115 (defconst hebrew-calendar-year-Monday-complete-Thursday
1116 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22]
1117 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36)
1118 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1119 "The structure of the parashiot.
1120 Hebrew year that starts on Monday, is `complete' (Heshvan and Kislev each have
1121 30 days), and has Passover start on Thursday.")
1123 (defconst hebrew-calendar-year-Tuesday-regular-Thursday
1124 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22]
1125 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36)
1126 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1127 "The structure of the parashiot.
1128 Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29 days and
1129 Kislev has 30 days), and has Passover start on Thursday.")
1131 (defconst hebrew-calendar-year-Thursday-regular-Saturday
1132 [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
1133 24 nil (nil . 25) (25 . [26 27]) ([26 27] . [28 29]) ([28 29] . 30)
1134 (30 . 31) ([31 32] . 32) 33 34 35 36 37 38 39 40 [41 42] 43 44 45 46 47 48
1135 49 50]
1136 "The structure of the parashiot.
1137 Hebrew year that starts on Thursday, is `regular' (Heshvan has 29 days and
1138 Kislev has 30 days), and has Passover start on Saturday.")
1140 (defconst hebrew-calendar-year-Thursday-complete-Sunday
1141 [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
1142 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42]
1143 43 44 45 46 47 48 49 50]
1144 "The structure of the parashiot.
1145 Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev each
1146 have 30 days), and has Passover start on Sunday.")
1148 ;; The seven leap year types (keviot)
1150 (defconst hebrew-calendar-year-Saturday-incomplete-Tuesday
1151 [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
1152 23 24 25 26 27 nil 28 29 30 31 32 33 34 35 36 37 38 39 40 [41 42]
1153 43 44 45 46 47 48 49 [50 51]]
1154 "The structure of the parashiot.
1155 Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev each
1156 have 29 days), and has Passover start on Tuesday.")
1158 (defconst hebrew-calendar-year-Saturday-complete-Thursday
1159 [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
1160 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36)
1161 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1162 "The structure of the parashiot.
1163 Hebrew year that starts on Saturday, is `complete' (Heshvan and Kislev each
1164 have 30 days), and has Passover start on Thursday.")
1166 (defconst hebrew-calendar-year-Monday-incomplete-Thursday
1167 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1168 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36)
1169 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]]
1170 "The structure of the parashiot.
1171 Hebrew year that starts on Monday, is `incomplete' (Heshvan and Kislev each
1172 have 29 days), and has Passover start on Thursday.")
1174 (defconst hebrew-calendar-year-Monday-complete-Saturday
1175 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1176 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32)
1177 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39)
1178 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50]
1179 "The structure of the parashiot.
1180 Hebrew year that starts on Monday, is `complete' (Heshvan and Kislev each have
1181 30 days), and has Passover start on Saturday.")
1183 (defconst hebrew-calendar-year-Tuesday-regular-Saturday
1184 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
1185 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32)
1186 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39)
1187 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50]
1188 "The structure of the parashiot.
1189 Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29 days and
1190 Kislev has 30 days), and has Passover start on Saturday.")
1192 (defconst hebrew-calendar-year-Thursday-incomplete-Sunday
1193 [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
1194 23 24 25 26 27 28 nil 29 30 31 32 33 34 35 36 37 38 39 40 41 42
1195 43 44 45 46 47 48 49 50]
1196 "The structure of the parashiot.
1197 Hebrew year that starts on Thursday, is `incomplete' (Heshvan and Kislev both
1198 have 29 days), and has Passover start on Sunday.")
1200 (defconst hebrew-calendar-year-Thursday-complete-Tuesday
1201 [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
1202 23 24 25 26 27 28 nil 29 30 31 32 33 34 35 36 37 38 39 40 41 42
1203 43 44 45 46 47 48 49 [50 51]]
1204 "The structure of the parashiot.
1205 Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev both
1206 have 30 days), and has Passover start on Tuesday.")
1208 (provide 'cal-hebrew)
1210 ;;; arch-tag: aaab6718-7712-42ac-a32d-28fe1f944f3c
1211 ;;; cal-hebrew.el ends here