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