annotate lisp/calendar/cal-hebrew.el @ 14863:b0d0cd9b5905

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