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