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