Mercurial > emacs
annotate lisp/calendar/cal-hebrew.el @ 92068:dd458038bf78
New file.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 22 Feb 2008 01:51:04 +0000 |
parents | 107ccd98fa12 |
children | 606f2d163a64 f82da83f1b8a |
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 |
79703 | 3 ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65143
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
13050 | 5 |
13051
0351b3061992
*** empty log message ***
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
13050
diff
changeset
|
6 ;; Author: Nachum Dershowitz <nachum@cs.uiuc.edu> |
13050 | 7 ;; Edward M. Reingold <reingold@cs.uiuc.edu> |
67465
a55ee709ec8d
Update copyright pending Emacs 22.
Glenn Morris <rgm@gnu.org>
parents:
65143
diff
changeset
|
8 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
13050 | 9 ;; Keywords: calendar |
10 ;; Human-Keywords: Hebrew calendar, calendar, diary | |
11 | |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
78216
93e11478c954
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
16 ;; the Free Software Foundation; either version 3, or (at your option) |
13050 | 17 ;; any later version. |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
13050 | 28 |
29 ;;; Commentary: | |
30 | |
31 ;; This collection of functions implements the features of calendar.el and | |
32 ;; diary.el that deal with the Hebrew calendar. | |
33 | |
20462
d179de7ad92e
Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents:
20267
diff
changeset
|
34 ;; Technical details of all the calendrical calculations can be found in |
61148
7f7db25577d9
Update reference to "Calendrical Calculations" book; there's a new edition.
Paul Eggert <eggert@twinsun.com>
parents:
54074
diff
changeset
|
35 ;; ``Calendrical Calculations: The Millennium Edition'' by Edward M. Reingold |
7f7db25577d9
Update reference to "Calendrical Calculations" book; there's a new edition.
Paul Eggert <eggert@twinsun.com>
parents:
54074
diff
changeset
|
36 ;; and Nachum Dershowitz, Cambridge University Press (2001). |
20462
d179de7ad92e
Add reference to new Calendrical Calculations book.
Paul Eggert <eggert@twinsun.com>
parents:
20267
diff
changeset
|
37 |
13050 | 38 ;;; Code: |
39 | |
65143
e461582f967a
(date, entry, number, original-date): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
40 (defvar date) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
41 (defvar displayed-month) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
42 (defvar displayed-year) |
65143
e461582f967a
(date, entry, number, original-date): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
43 (defvar entry) |
e461582f967a
(date, entry, number, original-date): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
44 (defvar number) |
e461582f967a
(date, entry, number, original-date): Add defvars.
Juanma Barranquero <lekktu@gmail.com>
parents:
64085
diff
changeset
|
45 (defvar original-date) |
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) | |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
239 (month (cdr (assoc-string |
24187
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 |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
246 (assoc-string |
24187
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
247 (car x) |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
248 (calendar-make-alist month-array) |
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
249 t)))) |
24187
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) |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
257 (calendar-make-alist month-array 1) t))) |
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 | |
86489
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
304 ;; h-r-h-e should be called from holidays code. |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
305 (declare-function holiday-filter-visible-calendar "holidays" (l)) |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
306 |
13050 | 307 (defun holiday-rosh-hashanah-etc () |
308 "List of dates related to Rosh Hashanah, as visible in calendar window." | |
309 (if (or (< displayed-month 8) | |
310 (> displayed-month 11)) | |
311 nil;; None of the dates is visible | |
312 (let* ((abs-r-h (calendar-absolute-from-hebrew | |
313 (list 7 1 (+ displayed-year 3761)))) | |
314 (mandatory | |
315 (list | |
316 (list (calendar-gregorian-from-absolute abs-r-h) | |
317 (format "Rosh HaShanah %d" (+ 3761 displayed-year))) | |
318 (list (calendar-gregorian-from-absolute (+ abs-r-h 9)) | |
319 "Yom Kippur") | |
320 (list (calendar-gregorian-from-absolute (+ abs-r-h 14)) | |
321 "Sukkot") | |
322 (list (calendar-gregorian-from-absolute (+ abs-r-h 21)) | |
323 "Shemini Atzeret") | |
324 (list (calendar-gregorian-from-absolute (+ abs-r-h 22)) | |
325 "Simchat Torah"))) | |
326 (optional | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
327 (list |
13050 | 328 (list (calendar-gregorian-from-absolute |
329 (calendar-dayname-on-or-before 6 (- abs-r-h 4))) | |
330 "Selichot (night)") | |
331 (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
|
332 "Erev Rosh HaShanah") |
13050 | 333 (list (calendar-gregorian-from-absolute (1+ abs-r-h)) |
334 "Rosh HaShanah (second day)") | |
335 (list (calendar-gregorian-from-absolute | |
336 (if (= (% abs-r-h 7) 4) (+ abs-r-h 3) (+ abs-r-h 2))) | |
337 "Tzom Gedaliah") | |
338 (list (calendar-gregorian-from-absolute | |
339 (calendar-dayname-on-or-before 6 (+ 7 abs-r-h))) | |
340 "Shabbat Shuvah") | |
341 (list (calendar-gregorian-from-absolute (+ abs-r-h 8)) | |
342 "Erev Yom Kippur") | |
343 (list (calendar-gregorian-from-absolute (+ abs-r-h 13)) | |
344 "Erev Sukkot") | |
345 (list (calendar-gregorian-from-absolute (+ abs-r-h 15)) | |
346 "Sukkot (second day)") | |
347 (list (calendar-gregorian-from-absolute (+ abs-r-h 16)) | |
348 "Hol Hamoed Sukkot (first day)") | |
349 (list (calendar-gregorian-from-absolute (+ abs-r-h 17)) | |
350 "Hol Hamoed Sukkot (second day)") | |
351 (list (calendar-gregorian-from-absolute (+ abs-r-h 18)) | |
352 "Hol Hamoed Sukkot (third day)") | |
353 (list (calendar-gregorian-from-absolute (+ abs-r-h 19)) | |
354 "Hol Hamoed Sukkot (fourth day)") | |
355 (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
|
356 "Hoshanah Rabbah"))) |
13050 | 357 (output-list |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
358 (holiday-filter-visible-calendar mandatory))) |
13050 | 359 (if all-hebrew-calendar-holidays |
360 (setq output-list | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
361 (append |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
362 (holiday-filter-visible-calendar optional) |
13050 | 363 output-list))) |
364 output-list))) | |
365 | |
366 (defun holiday-hanukkah () | |
367 "List of dates related to Hanukkah, as visible in calendar window." | |
368 (if (memq displayed-month;; This test is only to speed things up a bit; | |
369 '(10 11 12 1 2));; it works fine without the test too. | |
370 (let ((m displayed-month) | |
371 (y displayed-year)) | |
372 (increment-calendar-month m y 1) | |
373 (let* ((h-y (extract-calendar-year | |
374 (calendar-hebrew-from-absolute | |
375 (calendar-absolute-from-gregorian | |
376 (list m (calendar-last-day-of-month m y) y))))) | |
377 (abs-h (calendar-absolute-from-hebrew (list 9 25 h-y)))) | |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
378 (holiday-filter-visible-calendar |
13050 | 379 (list |
380 (list (calendar-gregorian-from-absolute (1- abs-h)) | |
381 "Erev Hanukkah") | |
382 (list (calendar-gregorian-from-absolute abs-h) | |
383 "Hanukkah (first day)") | |
384 (list (calendar-gregorian-from-absolute (1+ abs-h)) | |
385 "Hanukkah (second day)") | |
386 (list (calendar-gregorian-from-absolute (+ abs-h 2)) | |
387 "Hanukkah (third day)") | |
388 (list (calendar-gregorian-from-absolute (+ abs-h 3)) | |
389 "Hanukkah (fourth day)") | |
390 (list (calendar-gregorian-from-absolute (+ abs-h 4)) | |
391 "Hanukkah (fifth day)") | |
392 (list (calendar-gregorian-from-absolute (+ abs-h 5)) | |
393 "Hanukkah (sixth day)") | |
394 (list (calendar-gregorian-from-absolute (+ abs-h 6)) | |
395 "Hanukkah (seventh day)") | |
396 (list (calendar-gregorian-from-absolute (+ abs-h 7)) | |
397 "Hanukkah (eighth day)"))))))) | |
398 | |
399 (defun holiday-passover-etc () | |
400 "List of dates related to Passover, as visible in calendar window." | |
401 (if (< 7 displayed-month) | |
402 nil;; None of the dates is visible | |
403 (let* ((abs-p (calendar-absolute-from-hebrew | |
404 (list 1 15 (+ displayed-year 3760)))) | |
405 (mandatory | |
406 (list | |
407 (list (calendar-gregorian-from-absolute abs-p) | |
408 "Passover") | |
409 (list (calendar-gregorian-from-absolute (+ abs-p 50)) | |
410 "Shavuot"))) | |
411 (optional | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
412 (list |
13050 | 413 (list (calendar-gregorian-from-absolute |
414 (calendar-dayname-on-or-before 6 (- abs-p 43))) | |
415 "Shabbat Shekalim") | |
416 (list (calendar-gregorian-from-absolute | |
417 (calendar-dayname-on-or-before 6 (- abs-p 30))) | |
418 "Shabbat Zachor") | |
419 (list (calendar-gregorian-from-absolute | |
420 (if (= (% abs-p 7) 2) (- abs-p 33) (- abs-p 31))) | |
421 "Fast of Esther") | |
422 (list (calendar-gregorian-from-absolute (- abs-p 31)) | |
423 "Erev Purim") | |
424 (list (calendar-gregorian-from-absolute (- abs-p 30)) | |
425 "Purim") | |
426 (list (calendar-gregorian-from-absolute | |
427 (if (zerop (% abs-p 7)) (- abs-p 28) (- abs-p 29))) | |
428 "Shushan Purim") | |
429 (list (calendar-gregorian-from-absolute | |
430 (- (calendar-dayname-on-or-before 6 (- abs-p 14)) 7)) | |
431 "Shabbat Parah") | |
432 (list (calendar-gregorian-from-absolute | |
433 (calendar-dayname-on-or-before 6 (- abs-p 14))) | |
434 "Shabbat HaHodesh") | |
435 (list (calendar-gregorian-from-absolute | |
436 (calendar-dayname-on-or-before 6 (1- abs-p))) | |
437 "Shabbat HaGadol") | |
438 (list (calendar-gregorian-from-absolute (1- abs-p)) | |
439 "Erev Passover") | |
440 (list (calendar-gregorian-from-absolute (1+ abs-p)) | |
441 "Passover (second day)") | |
442 (list (calendar-gregorian-from-absolute (+ abs-p 2)) | |
443 "Hol Hamoed Passover (first day)") | |
444 (list (calendar-gregorian-from-absolute (+ abs-p 3)) | |
445 "Hol Hamoed Passover (second day)") | |
446 (list (calendar-gregorian-from-absolute (+ abs-p 4)) | |
447 "Hol Hamoed Passover (third day)") | |
448 (list (calendar-gregorian-from-absolute (+ abs-p 5)) | |
449 "Hol Hamoed Passover (fourth day)") | |
450 (list (calendar-gregorian-from-absolute (+ abs-p 6)) | |
451 "Passover (seventh day)") | |
452 (list (calendar-gregorian-from-absolute (+ abs-p 7)) | |
453 "Passover (eighth day)") | |
17694
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
454 (list (calendar-gregorian-from-absolute |
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
455 (if (zerop (% (+ abs-p 12) 7)) |
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
456 (+ abs-p 13) |
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
457 (+ abs-p 12))) |
13050 | 458 "Yom HaShoah") |
459 (list (calendar-gregorian-from-absolute | |
460 (if (zerop (% abs-p 7)) | |
461 (+ abs-p 18) | |
462 (if (= (% abs-p 7) 6) | |
463 (+ abs-p 19) | |
464 (+ abs-p 20)))) | |
465 "Yom HaAtzma'ut") | |
466 (list (calendar-gregorian-from-absolute (+ abs-p 33)) | |
467 "Lag BaOmer") | |
468 (list (calendar-gregorian-from-absolute (+ abs-p 43)) | |
22063
bf477b03b470
Fix mispelling.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
20462
diff
changeset
|
469 "Yom Yerushalaim") |
13050 | 470 (list (calendar-gregorian-from-absolute (+ abs-p 49)) |
471 "Erev Shavuot") | |
472 (list (calendar-gregorian-from-absolute (+ abs-p 51)) | |
473 "Shavuot (second day)"))) | |
474 (output-list | |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
475 (holiday-filter-visible-calendar mandatory))) |
13050 | 476 (if all-hebrew-calendar-holidays |
477 (setq output-list | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
478 (append |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
479 (holiday-filter-visible-calendar optional) |
13050 | 480 output-list))) |
481 output-list))) | |
482 | |
483 (defun holiday-tisha-b-av-etc () | |
484 "List of dates around Tisha B'Av, as visible in calendar window." | |
485 (if (or (< displayed-month 5) | |
486 (> displayed-month 9)) | |
487 nil;; None of the dates is visible | |
488 (let* ((abs-t-a (calendar-absolute-from-hebrew | |
489 (list 5 9 (+ displayed-year 3760))))) | |
490 | |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
491 (holiday-filter-visible-calendar |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
492 (list |
13050 | 493 (list (calendar-gregorian-from-absolute |
494 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21))) | |
495 "Tzom Tammuz") | |
496 (list (calendar-gregorian-from-absolute | |
497 (calendar-dayname-on-or-before 6 abs-t-a)) | |
498 "Shabbat Hazon") | |
499 (list (calendar-gregorian-from-absolute | |
500 (if (= (% abs-t-a 7) 6) (1+ abs-t-a) abs-t-a)) | |
501 "Tisha B'Av") | |
502 (list (calendar-gregorian-from-absolute | |
503 (calendar-dayname-on-or-before 6 (+ abs-t-a 7))) | |
504 "Shabbat Nahamu")))))) | |
505 | |
86489
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
506 ;; l-h-d-e should be called from diary code. |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
507 (declare-function add-to-diary-list "diary-lib" |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
508 (date string specifier &optional marker globcolor literal)) |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
509 |
13050 | 510 (defun list-hebrew-diary-entries () |
511 "Add any Hebrew date entries from the diary file to `diary-entries-list'. | |
512 Hebrew date diary entries must be prefaced by `hebrew-diary-entry-symbol' | |
513 \(normally an `H'). The same diary date forms govern the style of the Hebrew | |
514 calendar entries, except that the Hebrew month names must be spelled in full. | |
515 The Hebrew months are numbered from 1 to 13 with Nisan being 1, 12 being | |
516 Adar I and 13 being Adar II; you must use `Adar I' if you want Adar of a | |
517 common Hebrew year. If a Hebrew date diary entry begins with a | |
518 `diary-nonmarking-symbol', the entry will appear in the diary listing, but will | |
519 not be marked in the calendar. This function is provided for use with the | |
520 `nongregorian-diary-listing-hook'." | |
521 (if (< 0 number) | |
522 (let ((buffer-read-only nil) | |
523 (diary-modified (buffer-modified-p)) | |
524 (gdate original-date) | |
525 (mark (regexp-quote diary-nonmarking-symbol))) | |
82084
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
526 (dotimes (idummy number) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
527 (let* ((d diary-date-forms) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
528 (hdate (calendar-hebrew-from-absolute |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
529 (calendar-absolute-from-gregorian gdate))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
530 (month (extract-calendar-month hdate)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
531 (day (extract-calendar-day hdate)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
532 (year (extract-calendar-year hdate))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
533 (while d |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
534 (let* |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
535 ((date-form (if (equal (car (car d)) 'backup) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
536 (cdr (car d)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
537 (car d))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
538 (backup (equal (car (car d)) 'backup)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
539 (dayname |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
540 (format "%s\\|%s\\.?" |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
541 (calendar-day-name gdate) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
542 (calendar-day-name gdate 'abbrev))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
543 (calendar-month-name-array |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
544 calendar-hebrew-month-name-array-leap-year) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
545 (monthname |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
546 (concat |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
547 "\\*\\|" |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
548 (calendar-month-name month))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
549 (month (concat "\\*\\|0*" (int-to-string month))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
550 (day (concat "\\*\\|0*" (int-to-string day))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
551 (year |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
552 (concat |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
553 "\\*\\|0*" (int-to-string year) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
554 (if abbreviated-calendar-year |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
555 (concat "\\|" (int-to-string (% year 100))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
556 ""))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
557 (regexp |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
558 (concat |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
559 "\\(\\`\\|\^M\\|\n\\)" mark "?" |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
560 (regexp-quote hebrew-diary-entry-symbol) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
561 "\\(" |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
562 (mapconcat 'eval date-form "\\)\\(") |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
563 "\\)")) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
564 (case-fold-search t)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
565 (goto-char (point-min)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
566 (while (re-search-forward regexp nil t) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
567 (if backup (re-search-backward "\\<" nil t)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
568 (if (and (or (char-equal (preceding-char) ?\^M) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
569 (char-equal (preceding-char) ?\n)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
570 (not (looking-at " \\|\^I"))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
571 ;; Diary entry that consists only of date. |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
572 (backward-char 1) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
573 ;; Found a nonempty diary entry--make it visible and |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
574 ;; add it to the list. |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
575 (let ((entry-start (point)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
576 (date-start)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
577 (re-search-backward "\^M\\|\n\\|\\`") |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
578 (setq date-start (point)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
579 (re-search-forward "\^M\\|\n" nil t 2) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
580 (while (looking-at " \\|\^I") |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
581 (re-search-forward "\^M\\|\n" nil t)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
582 (backward-char 1) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
583 (subst-char-in-region date-start (point) ?\^M ?\n t) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
584 (add-to-diary-list |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
585 gdate |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
586 (buffer-substring-no-properties entry-start (point)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
587 (buffer-substring-no-properties |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
588 (1+ date-start) (1- entry-start)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
589 (copy-marker entry-start)))))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
590 (setq d (cdr d)))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
591 (setq gdate |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
592 (calendar-gregorian-from-absolute |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
593 (1+ (calendar-absolute-from-gregorian gdate))))) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
594 (set-buffer-modified-p diary-modified)) |
5f23cf0f35b8
(list-hebrew-diary-entries): Use dotimes rather than
Glenn Morris <rgm@gnu.org>
parents:
77279
diff
changeset
|
595 (goto-char (point-min)))) |
13050 | 596 |
597 (defun mark-hebrew-calendar-date-pattern (month day year) | |
598 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR. | |
599 A value of 0 in any position is a wildcard." | |
600 (save-excursion | |
601 (set-buffer calendar-buffer) | |
602 (if (and (/= 0 month) (/= 0 day)) | |
603 (if (/= 0 year) | |
604 ;; Fully specified Hebrew date. | |
605 (let ((date (calendar-gregorian-from-absolute | |
606 (calendar-absolute-from-hebrew | |
607 (list month day year))))) | |
608 (if (calendar-date-is-visible-p date) | |
609 (mark-visible-calendar-date date))) | |
610 ;; Month and day in any year--this taken from the holiday stuff. | |
611 (if (memq displayed-month;; This test is only to speed things up a | |
612 (list ;; bit; it works fine without the test too. | |
613 (if (< 11 month) (- month 11) (+ month 1)) | |
614 (if (< 10 month) (- month 10) (+ month 2)) | |
615 (if (< 9 month) (- month 9) (+ month 3)) | |
616 (if (< 8 month) (- month 8) (+ month 4)) | |
617 (if (< 7 month) (- month 7) (+ month 5)))) | |
618 (let ((m1 displayed-month) | |
619 (y1 displayed-year) | |
620 (m2 displayed-month) | |
621 (y2 displayed-year) | |
622 (year)) | |
623 (increment-calendar-month m1 y1 -1) | |
624 (increment-calendar-month m2 y2 1) | |
625 (let* ((start-date (calendar-absolute-from-gregorian | |
626 (list m1 1 y1))) | |
627 (end-date (calendar-absolute-from-gregorian | |
628 (list m2 | |
629 (calendar-last-day-of-month m2 y2) | |
630 y2))) | |
631 (hebrew-start | |
632 (calendar-hebrew-from-absolute start-date)) | |
633 (hebrew-end (calendar-hebrew-from-absolute end-date)) | |
634 (hebrew-y1 (extract-calendar-year hebrew-start)) | |
635 (hebrew-y2 (extract-calendar-year hebrew-end))) | |
636 (setq year (if (< 6 month) hebrew-y2 hebrew-y1)) | |
637 (let ((date (calendar-gregorian-from-absolute | |
638 (calendar-absolute-from-hebrew | |
639 (list month day year))))) | |
640 (if (calendar-date-is-visible-p date) | |
641 (mark-visible-calendar-date date))))))) | |
642 ;; Not one of the simple cases--check all visible dates for match. | |
643 ;; Actually, the following code takes care of ALL of the cases, but | |
644 ;; it's much too slow to be used for the simple (common) cases. | |
645 (let ((m displayed-month) | |
646 (y displayed-year) | |
647 (first-date) | |
648 (last-date)) | |
649 (increment-calendar-month m y -1) | |
650 (setq first-date | |
651 (calendar-absolute-from-gregorian | |
652 (list m 1 y))) | |
653 (increment-calendar-month m y 2) | |
654 (setq last-date | |
655 (calendar-absolute-from-gregorian | |
656 (list m (calendar-last-day-of-month m y) y))) | |
657 (calendar-for-loop date from first-date to last-date do | |
658 (let* ((h-date (calendar-hebrew-from-absolute date)) | |
659 (h-month (extract-calendar-month h-date)) | |
660 (h-day (extract-calendar-day h-date)) | |
661 (h-year (extract-calendar-year h-date))) | |
662 (and (or (zerop month) | |
663 (= month h-month)) | |
664 (or (zerop day) | |
665 (= day h-day)) | |
666 (or (zerop year) | |
667 (= year h-year)) | |
668 (mark-visible-calendar-date | |
669 (calendar-gregorian-from-absolute date))))))))) | |
670 | |
86489
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
671 (declare-function diary-name-pattern "diary-lib" |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
672 (string-array &optional abbrev-array paren)) |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
673 |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
674 (declare-function mark-calendar-days-named "diary-lib" |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
675 (dayname &optional color)) |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
676 |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
677 (defun mark-hebrew-diary-entries () |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
678 "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
|
679 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
|
680 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
|
681 \(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
|
682 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
|
683 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
|
684 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
|
685 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
|
686 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
|
687 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
|
688 (let ((d diary-date-forms)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
689 (while d |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
690 (let* |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
691 ((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
|
692 (cdr (car d)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
693 (car d)));; ignore 'backup directive |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
694 (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
|
695 calendar-day-abbrev-array)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
696 (monthname |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
697 (format "%s\\|\\*" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
698 (diary-name-pattern |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
699 calendar-hebrew-month-name-array-leap-year))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
700 (month "[0-9]+\\|\\*") |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
701 (day "[0-9]+\\|\\*") |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
702 (year "[0-9]+\\|\\*") |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
703 (l (length date-form)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
704 (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
|
705 (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
|
706 (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
|
707 (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
|
708 (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
|
709 (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
|
710 (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
|
711 (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
|
712 (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
|
713 (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
|
714 (regexp |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
715 (concat |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
716 "\\(\\`\\|\^M\\|\n\\)" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
717 (regexp-quote hebrew-diary-entry-symbol) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
718 "\\(" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
719 (mapconcat 'eval date-form "\\)\\(") |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
720 "\\)")) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
721 (case-fold-search t)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
722 (goto-char (point-min)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
723 (while (re-search-forward regexp nil t) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
724 (let* ((dd-name |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
725 (if d-name-pos |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
726 (buffer-substring |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
727 (match-beginning d-name-pos) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
728 (match-end d-name-pos)))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
729 (mm-name |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
730 (if m-name-pos |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
731 (buffer-substring |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
732 (match-beginning m-name-pos) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
733 (match-end m-name-pos)))) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61148
diff
changeset
|
734 (mm (string-to-number |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
735 (if m-pos |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
736 (buffer-substring |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
737 (match-beginning m-pos) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
738 (match-end m-pos)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
739 ""))) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61148
diff
changeset
|
740 (dd (string-to-number |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
741 (if d-pos |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
742 (buffer-substring |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
743 (match-beginning d-pos) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
744 (match-end d-pos)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
745 ""))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
746 (y-str (if y-pos |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
747 (buffer-substring |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
748 (match-beginning y-pos) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
749 (match-end y-pos)))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
750 (yy (if (not y-str) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
751 0 |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
752 (if (and (= (length y-str) 2) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
753 abbreviated-calendar-year) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
754 (let* ((current-y |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
755 (extract-calendar-year |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
756 (calendar-hebrew-from-absolute |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
757 (calendar-absolute-from-gregorian |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
758 (calendar-current-date))))) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61148
diff
changeset
|
759 (y (+ (string-to-number y-str) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
760 (* 100 (/ current-y 100))))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
761 (if (> (- y current-y) 50) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
762 (- y 100) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
763 (if (> (- current-y y) 50) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
764 (+ y 100) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
765 y))) |
62402
a7e02ef1e3d6
Replace `string-to-int' by `string-to-number'.
Juanma Barranquero <lekktu@gmail.com>
parents:
61148
diff
changeset
|
766 (string-to-number y-str))))) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
767 (if dd-name |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
768 (mark-calendar-days-named |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
769 (cdr (assoc-string dd-name |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
770 (calendar-make-alist |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
771 calendar-day-name-array |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
772 0 nil calendar-day-abbrev-array) t))) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
773 (if mm-name |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
774 (setq mm |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
775 (if (string-equal mm-name "*") 0 |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
776 (cdr |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
777 (assoc-string |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
778 mm-name |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
779 (calendar-make-alist |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
780 calendar-hebrew-month-name-array-leap-year) t))))) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
781 (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
|
782 (setq d (cdr d))))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
783 |
13050 | 784 (defun insert-hebrew-diary-entry (arg) |
785 "Insert a diary entry. | |
786 For the Hebrew date corresponding to the date indicated by point. | |
787 Prefix arg will make the entry nonmarking." | |
788 (interactive "P") | |
789 (let* ((calendar-month-name-array | |
790 calendar-hebrew-month-name-array-leap-year)) | |
791 (make-diary-entry | |
792 (concat | |
793 hebrew-diary-entry-symbol | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
794 (calendar-date-string |
13050 | 795 (calendar-hebrew-from-absolute |
796 (calendar-absolute-from-gregorian | |
797 (calendar-cursor-to-date t))) | |
798 nil t)) | |
799 arg))) | |
800 | |
801 (defun insert-monthly-hebrew-diary-entry (arg) | |
802 "Insert a monthly diary entry. | |
803 For the day of the Hebrew month corresponding to the date indicated by point. | |
804 Prefix arg will make the entry nonmarking." | |
805 (interactive "P") | |
806 (let* ((calendar-date-display-form | |
807 (if european-calendar-style '(day " * ") '("* " day ))) | |
808 (calendar-month-name-array | |
809 calendar-hebrew-month-name-array-leap-year)) | |
810 (make-diary-entry | |
811 (concat | |
812 hebrew-diary-entry-symbol | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
813 (calendar-date-string |
13050 | 814 (calendar-hebrew-from-absolute |
815 (calendar-absolute-from-gregorian | |
816 (calendar-cursor-to-date t))))) | |
817 arg))) | |
818 | |
819 (defun insert-yearly-hebrew-diary-entry (arg) | |
820 "Insert an annual diary entry. | |
821 For the day of the Hebrew year corresponding to the date indicated by point. | |
822 Prefix arg will make the entry nonmarking." | |
823 (interactive "P") | |
824 (let* ((calendar-date-display-form | |
825 (if european-calendar-style | |
826 '(day " " monthname) | |
827 '(monthname " " day))) | |
828 (calendar-month-name-array | |
829 calendar-hebrew-month-name-array-leap-year)) | |
830 (make-diary-entry | |
831 (concat | |
832 hebrew-diary-entry-symbol | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
833 (calendar-date-string |
13050 | 834 (calendar-hebrew-from-absolute |
835 (calendar-absolute-from-gregorian | |
836 (calendar-cursor-to-date t))))) | |
837 arg))) | |
838 | |
839 ;;;###autoload | |
840 (defun list-yahrzeit-dates (death-date start-year end-year) | |
841 "List Yahrzeit dates for *Gregorian* DEATH-DATE from START-YEAR to END-YEAR. | |
842 When called interactively from the calendar window, the date of death is taken | |
843 from the cursor position." | |
844 (interactive | |
845 (let* ((death-date | |
846 (if (equal (current-buffer) (get-buffer calendar-buffer)) | |
847 (calendar-cursor-to-date) | |
848 (let* ((today (calendar-current-date)) | |
849 (year (calendar-read | |
850 "Year of death (>0): " | |
851 '(lambda (x) (> x 0)) | |
852 (int-to-string (extract-calendar-year today)))) | |
853 (month-array calendar-month-name-array) | |
854 (completion-ignore-case t) | |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
855 (month (cdr (assoc-string |
24187
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
856 (completing-read |
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
857 "Month of death (name): " |
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
858 (mapcar 'list (append month-array nil)) |
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
859 nil t) |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
860 (calendar-make-alist month-array 1) t))) |
13050 | 861 (last (calendar-last-day-of-month month year)) |
862 (day (calendar-read | |
863 (format "Day of death (1-%d): " last) | |
864 '(lambda (x) (and (< 0 x) (<= x last)))))) | |
865 (list month day year)))) | |
866 (death-year (extract-calendar-year death-date)) | |
867 (start-year (calendar-read | |
868 (format "Starting year of Yahrzeit table (>%d): " | |
869 death-year) | |
870 '(lambda (x) (> x death-year)) | |
871 (int-to-string (1+ death-year)))) | |
872 (end-year (calendar-read | |
873 (format "Ending year of Yahrzeit table (>=%d): " | |
874 start-year) | |
875 '(lambda (x) (>= x start-year))))) | |
876 (list death-date start-year end-year))) | |
877 (message "Computing yahrzeits...") | |
878 (let* ((yahrzeit-buffer "*Yahrzeits*") | |
879 (h-date (calendar-hebrew-from-absolute | |
880 (calendar-absolute-from-gregorian death-date))) | |
881 (h-month (extract-calendar-month h-date)) | |
882 (h-day (extract-calendar-day h-date)) | |
883 (h-year (extract-calendar-year h-date))) | |
884 (set-buffer (get-buffer-create yahrzeit-buffer)) | |
885 (setq buffer-read-only nil) | |
886 (calendar-set-mode-line | |
887 (format "Yahrzeit dates for %s = %s" | |
888 (calendar-date-string death-date) | |
889 (let ((calendar-month-name-array | |
890 (if (hebrew-calendar-leap-year-p h-year) | |
891 calendar-hebrew-month-name-array-leap-year | |
892 calendar-hebrew-month-name-array-common-year))) | |
893 (calendar-date-string h-date nil t)))) | |
894 (erase-buffer) | |
895 (goto-char (point-min)) | |
896 (calendar-for-loop i from start-year to end-year do | |
897 (insert | |
898 (calendar-date-string | |
899 (calendar-gregorian-from-absolute | |
900 (hebrew-calendar-yahrzeit | |
901 h-date | |
902 (extract-calendar-year | |
903 (calendar-hebrew-from-absolute | |
904 (calendar-absolute-from-gregorian (list 1 1 i))))))) "\n")) | |
905 (goto-char (point-min)) | |
906 (set-buffer-modified-p nil) | |
907 (setq buffer-read-only t) | |
908 (display-buffer yahrzeit-buffer) | |
909 (message "Computing yahrzeits...done"))) | |
910 | |
911 (defun diary-hebrew-date () | |
912 "Hebrew calendar equivalent of date diary entry." | |
913 (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date))) | |
914 | |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
915 (defun diary-omer (&optional mark) |
13050 | 916 "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
|
917 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
|
918 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
919 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
|
920 use when highlighting the day in the calendar." |
13050 | 921 (let* ((passover |
922 (calendar-absolute-from-hebrew | |
923 (list 1 15 (+ (extract-calendar-year date) 3760)))) | |
924 (omer (- (calendar-absolute-from-gregorian date) passover)) | |
925 (week (/ omer 7)) | |
926 (day (% omer 7))) | |
927 (if (and (> omer 0) (< omer 50)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
928 (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
|
929 (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
|
930 omer |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
931 (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
|
932 "" |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
933 (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
|
934 week |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
935 (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
|
936 (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
|
937 "" |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
938 (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
|
939 day (if (= day 1) "" "s")))))))))) |
13050 | 940 |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
941 (defun diary-yahrzeit (death-month death-day death-year &optional mark) |
13050 | 942 "Yahrzeit diary entry--entry applies if date is yahrzeit or the day before. |
943 Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary entry is assumed | |
944 to be the name of the person. Date of death is on the *civil* calendar; | |
945 although the date of death is specified by the civil calendar, the proper | |
946 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
|
947 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
|
948 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
949 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
|
950 use when highlighting the day in the calendar." |
13050 | 951 (let* ((h-date (calendar-hebrew-from-absolute |
952 (calendar-absolute-from-gregorian | |
953 (if european-calendar-style | |
954 (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
|
955 (list death-month death-day death-year))))) |
13050 | 956 (h-month (extract-calendar-month h-date)) |
957 (h-day (extract-calendar-day h-date)) | |
958 (h-year (extract-calendar-year h-date)) | |
959 (d (calendar-absolute-from-gregorian date)) | |
960 (yr (extract-calendar-year (calendar-hebrew-from-absolute d))) | |
961 (diff (- yr h-year)) | |
962 (y (hebrew-calendar-yahrzeit h-date yr))) | |
963 (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
|
964 (cons mark |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
965 (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
|
966 entry |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
967 (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
|
968 diff |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
969 (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
|
970 ((= (% 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
|
971 ((= (% 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
|
972 (t "th"))))))) |
13050 | 973 |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
974 (defun diary-rosh-hodesh (&optional mark) |
13050 | 975 "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
|
976 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
|
977 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
978 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
|
979 use when highlighting the day in the calendar." |
13050 | 980 (let* ((d (calendar-absolute-from-gregorian date)) |
981 (h-date (calendar-hebrew-from-absolute d)) | |
982 (h-month (extract-calendar-month h-date)) | |
983 (h-day (extract-calendar-day h-date)) | |
984 (h-year (extract-calendar-year h-date)) | |
985 (leap-year (hebrew-calendar-leap-year-p h-year)) | |
986 (last-day (hebrew-calendar-last-day-of-month h-month h-year)) | |
987 (h-month-names | |
988 (if leap-year | |
989 calendar-hebrew-month-name-array-leap-year | |
990 calendar-hebrew-month-name-array-common-year)) | |
991 (this-month (aref h-month-names (1- h-month))) | |
992 (h-yesterday (extract-calendar-day | |
993 (calendar-hebrew-from-absolute (1- d))))) | |
994 (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
|
995 (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
|
996 (format |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
997 "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
|
998 (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
|
999 (format |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1000 "%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
|
1001 ;; 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
|
1002 ;; 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
|
1003 ;; 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
|
1004 (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
|
1005 (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
|
1006 (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
|
1007 this-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 (= (% d 7) 6) ;; Saturday--check for Shabbat Mevarchim |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
1009 (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
|
1010 (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
|
1011 (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
|
1012 (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
|
1013 (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
|
1014 (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
|
1015 h-year)) |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1016 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
|
1017 (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
|
1018 ((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
|
1019 (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
|
1020 (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
|
1021 (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
|
1022 "tomorrow" |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1023 (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
|
1024 (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
|
1025 (% (- 30 h-day) 7)))))) |
13050 | 1026 (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
|
1027 (cons mark |
e82d42ccd30b
(diary-rosh-hodesh): Cons MARK on in the third case.
Richard M. Stallman <rms@gnu.org>
parents:
46619
diff
changeset
|
1028 (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
|
1029 (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
|
1030 (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
|
1031 (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
|
1032 h-year)) |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1033 0 h-month))))))))) |
13050 | 1034 |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1035 (defvar hebrew-calendar-parashiot-names |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1036 ["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
|
1037 "Vayetze" "Vayishlah" "Vayeshev" "Mikketz" "Vayiggash" "Vayhi" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1038 "Shemoth" "Vaera" "Bo" "Beshallah" "Yithro" "Mishpatim" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1039 "Terumah" "Tetzavveh" "Ki Tissa" "Vayakhel" "Pekudei" "Vayikra" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1040 "Tzav" "Shemini" "Tazria" "Metzora" "Aharei Moth" "Kedoshim" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1041 "Emor" "Behar" "Behukkotai" "Bemidbar" "Naso" "Behaalot'cha" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1042 "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
|
1043 "Masei" "Devarim" "Vaethanan" "Ekev" "Reeh" "Shofetim" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1044 "Ki Tetze" "Ki Tavo" "Nitzavim" "Vayelech" "Haazinu"] |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1045 "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
|
1046 |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1047 (defun hebrew-calendar-parasha-name (p) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1048 "Name(s) corresponding to parasha P." |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1049 (if (arrayp p);; combined parasha |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1050 (format "%s/%s" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1051 (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
|
1052 (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
|
1053 (aref hebrew-calendar-parashiot-names p))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
1054 |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1055 (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
|
1056 "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
|
1057 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
1058 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
|
1059 use when highlighting the day in the calendar." |
13050 | 1060 (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
|
1061 (if (= (% d 7) 6) ;; Saturday |
13050 | 1062 (let* |
1063 ((h-year (extract-calendar-year | |
1064 (calendar-hebrew-from-absolute d))) | |
13674
67da41b74267
(holiday-rosh-hashanah-etc): Fix misspelled var.
Paul Eggert <eggert@twinsun.com>
parents:
13052
diff
changeset
|
1065 (rosh-hashanah |
13050 | 1066 (calendar-absolute-from-hebrew (list 7 1 h-year))) |
1067 (passover | |
1068 (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
|
1069 (rosh-hashanah-day |
67da41b74267
(holiday-rosh-hashanah-etc): Fix misspelled var.
Paul Eggert <eggert@twinsun.com>
parents:
13052
diff
changeset
|
1070 (aref calendar-day-name-array (% rosh-hashanah 7))) |
13050 | 1071 (passover-day |
1072 (aref calendar-day-name-array (% passover 7))) | |
1073 (long-h (hebrew-calendar-long-heshvan-p h-year)) | |
1074 (short-k (hebrew-calendar-short-kislev-p h-year)) | |
1075 (type (cond ((and long-h (not short-k)) "complete") | |
1076 ((and (not long-h) short-k) "incomplete") | |
1077 (t "regular"))) | |
1078 (year-format | |
1079 (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
|
1080 (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
|
1081 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
|
1082 (first-saturday ;; of Hebrew year |
13674
67da41b74267
(holiday-rosh-hashanah-etc): Fix misspelled var.
Paul Eggert <eggert@twinsun.com>
parents:
13052
diff
changeset
|
1083 (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
|
1084 (saturday ;; which Saturday of the Hebrew year |
13050 | 1085 (/ (- d first-saturday) 7)) |
1086 (parasha (aref year-format saturday))) | |
1087 (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
|
1088 (cons mark |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1089 (format |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1090 "Parashat %s" |
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
1091 (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
|
1092 (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
|
1093 (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
|
1094 (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
|
1095 (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
|
1096 (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
|
1097 (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
|
1098 (hebrew-calendar-parasha-name parasha))))))))) |
13050 | 1099 |
1100 ;; The seven ordinary year types (keviot) | |
1101 | |
1102 (defconst hebrew-calendar-year-Saturday-incomplete-Sunday | |
1103 [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] | |
1104 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] | |
1105 43 44 45 46 47 48 49 50] | |
1106 "The structure of the parashiot. | |
1107 Hebrew year starts on Saturday, is `incomplete' (Heshvan and Kislev each have | |
1108 29 days), and has Passover start on Sunday.") | |
1109 | |
1110 (defconst hebrew-calendar-year-Saturday-complete-Tuesday | |
1111 [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] | |
1112 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] | |
1113 43 44 45 46 47 48 49 [50 51]] | |
1114 "The structure of the parashiot. | |
1115 Hebrew year that starts on Saturday, is `complete' (Heshvan and Kislev each | |
1116 have 30 days), and has Passover start on Tuesday.") | |
1117 | |
1118 (defconst hebrew-calendar-year-Monday-incomplete-Tuesday | |
1119 [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] | |
1120 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] | |
1121 43 44 45 46 47 48 49 [50 51]] | |
1122 "The structure of the parashiot. | |
1123 Hebrew year that starts on Monday, is `incomplete' (Heshvan and Kislev each | |
1124 have 29 days), and has Passover start on Tuesday.") | |
1125 | |
1126 (defconst hebrew-calendar-year-Monday-complete-Thursday | |
1127 [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] | |
1128 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36) | |
1129 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
1130 "The structure of the parashiot. | |
1131 Hebrew year that starts on Monday, is `complete' (Heshvan and Kislev each have | |
1132 30 days), and has Passover start on Thursday.") | |
1133 | |
1134 (defconst hebrew-calendar-year-Tuesday-regular-Thursday | |
1135 [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] | |
1136 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36) | |
1137 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
1138 "The structure of the parashiot. | |
1139 Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29 days and | |
1140 Kislev has 30 days), and has Passover start on Thursday.") | |
1141 | |
1142 (defconst hebrew-calendar-year-Thursday-regular-Saturday | |
1143 [52 nil nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21 22] 23 | |
1144 24 nil (nil . 25) (25 . [26 27]) ([26 27] . [28 29]) ([28 29] . 30) | |
1145 (30 . 31) ([31 32] . 32) 33 34 35 36 37 38 39 40 [41 42] 43 44 45 46 47 48 | |
1146 49 50] | |
1147 "The structure of the parashiot. | |
1148 Hebrew year that starts on Thursday, is `regular' (Heshvan has 29 days and | |
1149 Kislev has 30 days), and has Passover start on Saturday.") | |
1150 | |
1151 (defconst hebrew-calendar-year-Thursday-complete-Sunday | |
1152 [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 | |
1153 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] | |
1154 43 44 45 46 47 48 49 50] | |
1155 "The structure of the parashiot. | |
1156 Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev each | |
1157 have 30 days), and has Passover start on Sunday.") | |
1158 | |
1159 ;; The seven leap year types (keviot) | |
1160 | |
1161 (defconst hebrew-calendar-year-Saturday-incomplete-Tuesday | |
1162 [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 | |
1163 23 24 25 26 27 nil 28 29 30 31 32 33 34 35 36 37 38 39 40 [41 42] | |
1164 43 44 45 46 47 48 49 [50 51]] | |
1165 "The structure of the parashiot. | |
1166 Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev each | |
1167 have 29 days), and has Passover start on Tuesday.") | |
1168 | |
1169 (defconst hebrew-calendar-year-Saturday-complete-Thursday | |
1170 [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 | |
1171 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36) | |
1172 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
1173 "The structure of the parashiot. | |
1174 Hebrew year that starts on Saturday, is `complete' (Heshvan and Kislev each | |
1175 have 30 days), and has Passover start on Thursday.") | |
1176 | |
1177 (defconst hebrew-calendar-year-Monday-incomplete-Thursday | |
1178 [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 | |
1179 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36) | |
1180 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
1181 "The structure of the parashiot. | |
1182 Hebrew year that starts on Monday, is `incomplete' (Heshvan and Kislev each | |
1183 have 29 days), and has Passover start on Thursday.") | |
1184 | |
1185 (defconst hebrew-calendar-year-Monday-complete-Saturday | |
1186 [51 52 nil 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | |
1187 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32) | |
1188 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39) | |
1189 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50] | |
1190 "The structure of the parashiot. | |
1191 Hebrew year that starts on Monday, is `complete' (Heshvan and Kislev each have | |
1192 30 days), and has Passover start on Saturday.") | |
1193 | |
1194 (defconst hebrew-calendar-year-Tuesday-regular-Saturday | |
1195 [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 | |
1196 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32) | |
1197 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39) | |
1198 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50] | |
1199 "The structure of the parashiot. | |
1200 Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29 days and | |
1201 Kislev has 30 days), and has Passover start on Saturday.") | |
1202 | |
1203 (defconst hebrew-calendar-year-Thursday-incomplete-Sunday | |
1204 [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 | |
1205 23 24 25 26 27 28 nil 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
1206 43 44 45 46 47 48 49 50] | |
1207 "The structure of the parashiot. | |
1208 Hebrew year that starts on Thursday, is `incomplete' (Heshvan and Kislev both | |
1209 have 29 days), and has Passover start on Sunday.") | |
1210 | |
1211 (defconst hebrew-calendar-year-Thursday-complete-Tuesday | |
1212 [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 | |
1213 23 24 25 26 27 28 nil 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
1214 43 44 45 46 47 48 49 [50 51]] | |
1215 "The structure of the parashiot. | |
1216 Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev both | |
1217 have 30 days), and has Passover start on Tuesday.") | |
1218 | |
1219 (provide 'cal-hebrew) | |
1220 | |
52401 | 1221 ;;; arch-tag: aaab6718-7712-42ac-a32d-28fe1f944f3c |
13050 | 1222 ;;; cal-hebrew.el ends here |