Mercurial > emacs
annotate lisp/calendar/cal-hebrew.el @ 93384:dc87cb6ec6a6
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Sat, 29 Mar 2008 13:53:02 +0000 |
parents | 5fce742bc681 |
children | b705f66a40fc |
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 |
92611
297952467e34
(mark-hebrew-calendar-date-pattern): Use zerop.
Glenn Morris <rgm@gnu.org>
parents:
92583
diff
changeset
|
3 ;; Copyright (C) 1995, 1997, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
297952467e34
(mark-hebrew-calendar-date-pattern): Use zerop.
Glenn Morris <rgm@gnu.org>
parents:
92583
diff
changeset
|
4 ;; 2008 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 | |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
40 (require 'calendar) |
13050 | 41 |
42 (defun hebrew-calendar-leap-year-p (year) | |
92667 | 43 "Non-nil if YEAR is a Hebrew calendar leap year." |
13050 | 44 (< (% (1+ (* 7 year)) 19) 7)) |
45 | |
46 (defun hebrew-calendar-last-month-of-year (year) | |
47 "The last month of the Hebrew calendar YEAR." | |
48 (if (hebrew-calendar-leap-year-p year) | |
49 13 | |
50 12)) | |
51 | |
52 (defun hebrew-calendar-elapsed-days (year) | |
92667 | 53 "Days from Sunday before start of Hebrew calendar to mean conjunction of Tishri of Hebrew YEAR." |
13050 | 54 (let* ((months-elapsed |
92658 | 55 (+ (* 235 (/ (1- year) 19)) ; months in complete cycles so far |
56 (* 12 (% (1- year) 19)) ; regular months in this cycle | |
57 (/ (1+ (* 7 (% (1- year) 19))) 19))) ; leap months this cycle | |
13050 | 58 (parts-elapsed (+ 204 (* 793 (% months-elapsed 1080)))) |
59 (hours-elapsed (+ 5 | |
60 (* 12 months-elapsed) | |
61 (* 793 (/ months-elapsed 1080)) | |
62 (/ parts-elapsed 1080))) | |
92852 | 63 (parts ; conjunction parts |
13050 | 64 (+ (* 1080 (% hours-elapsed 24)) (% parts-elapsed 1080))) |
92852 | 65 (day ; conjunction day |
13050 | 66 (+ 1 (* 29 months-elapsed) (/ hours-elapsed 24))) |
67 (alternative-day | |
92658 | 68 (if (or (>= parts 19440) ; if the new moon is at or after midday |
92852 | 69 (and (= (% day 7) 2) ; ...or is on a Tuesday... |
92658 | 70 (>= parts 9924) ; at 9 hours, 204 parts or later... |
92852 | 71 ;; of a common year... |
92658 | 72 (not (hebrew-calendar-leap-year-p year))) |
92852 | 73 (and (= (% day 7) 1) ; ...or is on a Monday... |
92658 | 74 (>= parts 16789) ; at 15 hours, 589 parts or later... |
92852 | 75 ;; at the end of a leap year. |
92658 | 76 (hebrew-calendar-leap-year-p (1- year)))) |
92852 | 77 ;; Then postpone Rosh HaShanah one day. |
13050 | 78 (1+ day) |
92852 | 79 ;; Else: |
13050 | 80 day))) |
92658 | 81 ;; If Rosh HaShanah would occur on Sunday, Wednesday, or Friday |
82 (if (memq (% alternative-day 7) (list 0 3 5)) | |
92852 | 83 ;; Then postpone it one (more) day and return. |
13050 | 84 (1+ alternative-day) |
92658 | 85 ;; Else return. |
13050 | 86 alternative-day))) |
87 | |
88 (defun hebrew-calendar-days-in-year (year) | |
89 "Number of days in Hebrew YEAR." | |
90 (- (hebrew-calendar-elapsed-days (1+ year)) | |
91 (hebrew-calendar-elapsed-days year))) | |
92 | |
93 (defun hebrew-calendar-long-heshvan-p (year) | |
92667 | 94 "Non-nil if Heshvan is long in Hebrew YEAR." |
13050 | 95 (= (% (hebrew-calendar-days-in-year year) 10) 5)) |
96 | |
97 (defun hebrew-calendar-short-kislev-p (year) | |
92667 | 98 "Non-nil if Kislev is short in Hebrew YEAR." |
13050 | 99 (= (% (hebrew-calendar-days-in-year year) 10) 3)) |
100 | |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
101 (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
|
102 "The last day of MONTH in YEAR." |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
103 (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
|
104 (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
|
105 (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
|
106 (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
|
107 29 |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
108 30)) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
109 |
13050 | 110 (defun calendar-absolute-from-hebrew (date) |
111 "Absolute date of Hebrew DATE. | |
112 The absolute date is the number of days elapsed since the (imaginary) | |
113 Gregorian date Sunday, December 31, 1 BC." | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
114 (let ((month (extract-calendar-month date)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
115 (day (extract-calendar-day date)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
116 (year (extract-calendar-year date))) |
92852 | 117 (+ day ; days so far this month |
118 (if (< month 7) ; before Tishri | |
119 ;; Then add days in prior months this year before and after Nisan. | |
13050 | 120 (+ (calendar-sum |
121 m 7 (<= m (hebrew-calendar-last-month-of-year year)) | |
122 (hebrew-calendar-last-day-of-month m year)) | |
123 (calendar-sum | |
124 m 1 (< m month) | |
125 (hebrew-calendar-last-day-of-month m year))) | |
92852 | 126 ;; Else add days in prior months this year. |
13050 | 127 (calendar-sum |
128 m 7 (< m month) | |
129 (hebrew-calendar-last-day-of-month m year))) | |
92852 | 130 (hebrew-calendar-elapsed-days year) ; days in prior years |
131 -1373429))) ; days elapsed before absolute date 1 | |
13050 | 132 |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
133 (defun calendar-hebrew-from-absolute (date) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
134 "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
|
135 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
|
136 Gregorian date Sunday, December 31, 1 BC." |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
137 (let* ((greg-date (calendar-gregorian-from-absolute date)) |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
138 (year (+ 3760 (extract-calendar-year greg-date))) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
139 (month (aref [9 10 11 12 1 2 3 4 7 7 7 8] |
92852 | 140 (1- (extract-calendar-month greg-date)))) |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
141 day) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
142 (while (>= date (calendar-absolute-from-hebrew (list 7 1 (1+ year)))) |
92852 | 143 (setq year (1+ year))) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
144 (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
|
145 (while (> date |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
146 (calendar-absolute-from-hebrew |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
147 (list month |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
148 (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
|
149 year))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
150 (setq month (1+ (% month length))))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
151 (setq day (1+ |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
152 (- 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
|
153 (list month day year))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
154 |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
155 (defconst calendar-hebrew-month-name-array-common-year |
13050 | 156 ["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
|
157 "Heshvan" "Kislev" "Teveth" "Shevat" "Adar"] |
92852 | 158 "Array of strings giving the names of the Hebrew months in a common year.") |
13050 | 159 |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
160 (defconst calendar-hebrew-month-name-array-leap-year |
13050 | 161 ["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
|
162 "Heshvan" "Kislev" "Teveth" "Shevat" "Adar I" "Adar II"] |
92852 | 163 "Array of strings giving the names of the Hebrew months in a leap year.") |
13050 | 164 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
165 ;;;###cal-autoload |
13050 | 166 (defun calendar-hebrew-date-string (&optional date) |
167 "String of Hebrew date before sunset of Gregorian DATE. | |
168 Defaults to today's date if DATE is not given. | |
169 Driven by the variable `calendar-date-display-form'." | |
170 (let* ((hebrew-date (calendar-hebrew-from-absolute | |
171 (calendar-absolute-from-gregorian | |
172 (or date (calendar-current-date))))) | |
173 (calendar-month-name-array | |
174 (if (hebrew-calendar-leap-year-p (extract-calendar-year hebrew-date)) | |
175 calendar-hebrew-month-name-array-leap-year | |
176 calendar-hebrew-month-name-array-common-year))) | |
177 (calendar-date-string hebrew-date nil t))) | |
178 | |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
179 ;;;###cal-autoload |
13050 | 180 (defun calendar-print-hebrew-date () |
181 "Show the Hebrew calendar equivalent of the date under the cursor." | |
182 (interactive) | |
183 (message "Hebrew date (until sunset): %s" | |
184 (calendar-hebrew-date-string (calendar-cursor-to-date t)))) | |
185 | |
186 (defun hebrew-calendar-yahrzeit (death-date year) | |
187 "Absolute date of the anniversary of Hebrew DEATH-DATE in Hebrew YEAR." | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
188 (let ((death-day (extract-calendar-day death-date)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
189 (death-month (extract-calendar-month death-date)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
190 (death-year (extract-calendar-year death-date))) |
13050 | 191 (cond |
192 ;; If it's Heshvan 30 it depends on the first anniversary; if | |
193 ;; that was not Heshvan 30, use the day before Kislev 1. | |
194 ((and (= death-month 8) | |
195 (= death-day 30) | |
196 (not (hebrew-calendar-long-heshvan-p (1+ death-year)))) | |
197 (1- (calendar-absolute-from-hebrew (list 9 1 year)))) | |
92658 | 198 ;; If it's Kislev 30 it depends on the first anniversary; if that |
199 ;; was not Kislev 30, use the day before Teveth 1. | |
13050 | 200 ((and (= death-month 9) |
201 (= death-day 30) | |
202 (hebrew-calendar-short-kislev-p (1+ death-year))) | |
203 (1- (calendar-absolute-from-hebrew (list 10 1 year)))) | |
92658 | 204 ;; If it's Adar II, use the same day in last month of year (Adar |
205 ;; or Adar II). | |
13050 | 206 ((= death-month 13) |
207 (calendar-absolute-from-hebrew | |
208 (list (hebrew-calendar-last-month-of-year year) death-day year))) | |
92658 | 209 ;; If it's the 30th in Adar I and year is not a leap year (so |
210 ;; Adar has only 29 days), use the last day in Shevat. | |
13050 | 211 ((and (= death-day 30) |
212 (= death-month 12) | |
213 (not (hebrew-calendar-leap-year-p year))) | |
214 (calendar-absolute-from-hebrew (list 11 30 year))) | |
215 ;; In all other cases, use the normal anniversary of the date of death. | |
216 (t (calendar-absolute-from-hebrew | |
217 (list death-month death-day year)))))) | |
218 | |
93183
6f66ef366e35
(calendar-hebrew-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93025
diff
changeset
|
219 (defun calendar-hebrew-read-date () |
6f66ef366e35
(calendar-hebrew-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93025
diff
changeset
|
220 "Interactively read the arguments for a Hebrew date command. |
6f66ef366e35
(calendar-hebrew-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93025
diff
changeset
|
221 Reads a year, month, and day." |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
222 (let* ((today (calendar-current-date)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
223 (year (calendar-read |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
224 "Hebrew calendar year (>3760): " |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
225 (lambda (x) (> x 3760)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
226 (int-to-string |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
227 (extract-calendar-year |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
228 (calendar-hebrew-from-absolute |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
229 (calendar-absolute-from-gregorian today)))))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
230 (month-array (if (hebrew-calendar-leap-year-p year) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
231 calendar-hebrew-month-name-array-leap-year |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
232 calendar-hebrew-month-name-array-common-year)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
233 (completion-ignore-case t) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
234 (month (cdr (assoc-string |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
235 (completing-read |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
236 "Hebrew calendar month name: " |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
237 (mapcar 'list (append month-array nil)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
238 (if (= year 3761) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
239 (lambda (x) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
240 (let ((m (cdr |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
241 (assoc-string |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
242 (car x) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
243 (calendar-make-alist month-array) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
244 t)))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
245 (< 0 |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
246 (calendar-absolute-from-hebrew |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
247 (list m |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
248 (hebrew-calendar-last-day-of-month |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
249 m year) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
250 year)))))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
251 t) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
252 (calendar-make-alist month-array 1) t))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
253 (last (hebrew-calendar-last-day-of-month month year)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
254 (first (if (and (= year 3761) (= month 10)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
255 18 1)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
256 (day (calendar-read |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
257 (format "Hebrew calendar day (%d-%d): " |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
258 first last) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
259 (lambda (x) (and (<= first x) (<= x last)))))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
260 (list (list month day year)))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
261 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
262 ;;;###cal-autoload |
13050 | 263 (defun calendar-goto-hebrew-date (date &optional noecho) |
92918
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
264 "Move cursor to Hebrew DATE; echo Hebrew date unless NOECHO is non-nil." |
93183
6f66ef366e35
(calendar-hebrew-read-date): New name for
Glenn Morris <rgm@gnu.org>
parents:
93025
diff
changeset
|
265 (interactive (calendar-hebrew-read-date)) |
13050 | 266 (calendar-goto-date (calendar-gregorian-from-absolute |
267 (calendar-absolute-from-hebrew date))) | |
268 (or noecho (calendar-print-hebrew-date))) | |
269 | |
92918
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
270 (defvar displayed-month) ; from generate-calendar |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
271 (defvar displayed-year) |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
272 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
273 ;;;###holiday-autoload |
13050 | 274 (defun holiday-hebrew (month day string) |
275 "Holiday on MONTH, DAY (Hebrew) called STRING. | |
276 If MONTH, DAY (Hebrew) is visible, the value returned is corresponding | |
277 Gregorian date in the form of the list (((month day year) STRING)). Returns | |
278 nil if it is not visible in the current calendar window." | |
92658 | 279 ;; This test is only to speed things up a bit; it works fine without it. |
280 (if (memq displayed-month | |
281 (list | |
13050 | 282 (if (< 11 month) (- month 11) (+ month 1)) |
283 (if (< 10 month) (- month 10) (+ month 2)) | |
284 (if (< 9 month) (- month 9) (+ month 3)) | |
285 (if (< 8 month) (- month 8) (+ month 4)) | |
286 (if (< 7 month) (- month 7) (+ month 5)))) | |
287 (let ((m1 displayed-month) | |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
288 (y1 displayed-year) |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
289 (m2 displayed-month) |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
290 (y2 displayed-year) |
13050 | 291 (year)) |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
292 (increment-calendar-month m1 y1 -1) |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
293 (increment-calendar-month m2 y2 1) |
13050 | 294 (let* ((start-date (calendar-absolute-from-gregorian |
295 (list m1 1 y1))) | |
296 (end-date (calendar-absolute-from-gregorian | |
297 (list m2 (calendar-last-day-of-month m2 y2) y2))) | |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
298 (hebrew-start (calendar-hebrew-from-absolute start-date)) |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
299 (hebrew-end (calendar-hebrew-from-absolute end-date)) |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
300 (hebrew-y1 (extract-calendar-year hebrew-start)) |
13050 | 301 (hebrew-y2 (extract-calendar-year hebrew-end))) |
302 (setq year (if (< 6 month) hebrew-y2 hebrew-y1)) | |
303 (let ((date (calendar-gregorian-from-absolute | |
304 (calendar-absolute-from-hebrew | |
305 (list month day year))))) | |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
306 (if (calendar-date-is-visible-p date) |
13050 | 307 (list (list date string)))))))) |
308 | |
86489
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
309 ;; h-r-h-e should be called from holidays code. |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
310 (declare-function holiday-filter-visible-calendar "holidays" (l)) |
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
311 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
312 ;;;###holiday-autoload |
13050 | 313 (defun holiday-rosh-hashanah-etc () |
314 "List of dates related to Rosh Hashanah, as visible in calendar window." | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
315 (unless (or (< displayed-month 8) ; none of the dates is visible |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
316 (> displayed-month 11)) |
13050 | 317 (let* ((abs-r-h (calendar-absolute-from-hebrew |
92852 | 318 (list 7 1 (+ displayed-year 3761)))) |
319 (mandatory | |
320 (list | |
321 (list (calendar-gregorian-from-absolute abs-r-h) | |
322 (format "Rosh HaShanah %d" (+ 3761 displayed-year))) | |
323 (list (calendar-gregorian-from-absolute (+ abs-r-h 9)) | |
324 "Yom Kippur") | |
325 (list (calendar-gregorian-from-absolute (+ abs-r-h 14)) | |
326 "Sukkot") | |
327 (list (calendar-gregorian-from-absolute (+ abs-r-h 21)) | |
328 "Shemini Atzeret") | |
329 (list (calendar-gregorian-from-absolute (+ abs-r-h 22)) | |
330 "Simchat Torah"))) | |
13050 | 331 (optional |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
332 (list |
13050 | 333 (list (calendar-gregorian-from-absolute |
334 (calendar-dayname-on-or-before 6 (- abs-r-h 4))) | |
335 "Selichot (night)") | |
336 (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
|
337 "Erev Rosh HaShanah") |
13050 | 338 (list (calendar-gregorian-from-absolute (1+ abs-r-h)) |
339 "Rosh HaShanah (second day)") | |
340 (list (calendar-gregorian-from-absolute | |
341 (if (= (% abs-r-h 7) 4) (+ abs-r-h 3) (+ abs-r-h 2))) | |
342 "Tzom Gedaliah") | |
343 (list (calendar-gregorian-from-absolute | |
344 (calendar-dayname-on-or-before 6 (+ 7 abs-r-h))) | |
345 "Shabbat Shuvah") | |
346 (list (calendar-gregorian-from-absolute (+ abs-r-h 8)) | |
347 "Erev Yom Kippur") | |
348 (list (calendar-gregorian-from-absolute (+ abs-r-h 13)) | |
349 "Erev Sukkot") | |
350 (list (calendar-gregorian-from-absolute (+ abs-r-h 15)) | |
351 "Sukkot (second day)") | |
352 (list (calendar-gregorian-from-absolute (+ abs-r-h 16)) | |
353 "Hol Hamoed Sukkot (first day)") | |
354 (list (calendar-gregorian-from-absolute (+ abs-r-h 17)) | |
355 "Hol Hamoed Sukkot (second day)") | |
356 (list (calendar-gregorian-from-absolute (+ abs-r-h 18)) | |
357 "Hol Hamoed Sukkot (third day)") | |
358 (list (calendar-gregorian-from-absolute (+ abs-r-h 19)) | |
359 "Hol Hamoed Sukkot (fourth day)") | |
360 (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
|
361 "Hoshanah Rabbah"))) |
92852 | 362 (output-list |
363 (holiday-filter-visible-calendar mandatory))) | |
13050 | 364 (if all-hebrew-calendar-holidays |
365 (setq output-list | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
366 (append |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
367 (holiday-filter-visible-calendar optional) |
13050 | 368 output-list))) |
369 output-list))) | |
370 | |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
371 ;;;###holiday-autoload |
13050 | 372 (defun holiday-hanukkah () |
373 "List of dates related to Hanukkah, as visible in calendar window." | |
92658 | 374 ;; This test is only to speed things up a bit, it works fine without it. |
375 (if (memq displayed-month | |
92852 | 376 '(10 11 12 1 2)) |
92658 | 377 (let ((m displayed-month) |
92852 | 378 (y displayed-year)) |
379 (increment-calendar-month m y 1) | |
380 (let* ((h-y (extract-calendar-year | |
381 (calendar-hebrew-from-absolute | |
382 (calendar-absolute-from-gregorian | |
383 (list m (calendar-last-day-of-month m y) y))))) | |
384 (abs-h (calendar-absolute-from-hebrew (list 9 25 h-y)))) | |
385 (holiday-filter-visible-calendar | |
386 (list | |
387 (list (calendar-gregorian-from-absolute (1- abs-h)) | |
388 "Erev Hanukkah") | |
389 (list (calendar-gregorian-from-absolute abs-h) | |
390 "Hanukkah (first day)") | |
391 (list (calendar-gregorian-from-absolute (1+ abs-h)) | |
392 "Hanukkah (second day)") | |
393 (list (calendar-gregorian-from-absolute (+ abs-h 2)) | |
394 "Hanukkah (third day)") | |
395 (list (calendar-gregorian-from-absolute (+ abs-h 3)) | |
396 "Hanukkah (fourth day)") | |
397 (list (calendar-gregorian-from-absolute (+ abs-h 4)) | |
398 "Hanukkah (fifth day)") | |
399 (list (calendar-gregorian-from-absolute (+ abs-h 5)) | |
400 "Hanukkah (sixth day)") | |
401 (list (calendar-gregorian-from-absolute (+ abs-h 6)) | |
402 "Hanukkah (seventh day)") | |
403 (list (calendar-gregorian-from-absolute (+ abs-h 7)) | |
404 "Hanukkah (eighth day)"))))))) | |
13050 | 405 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
406 ;;;###holiday-autoload |
13050 | 407 (defun holiday-passover-etc () |
408 "List of dates related to Passover, as visible in calendar window." | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
409 (unless (< 7 displayed-month) ; none of the dates is visible |
13050 | 410 (let* ((abs-p (calendar-absolute-from-hebrew |
92852 | 411 (list 1 15 (+ displayed-year 3760)))) |
13050 | 412 (mandatory |
413 (list | |
414 (list (calendar-gregorian-from-absolute abs-p) | |
415 "Passover") | |
416 (list (calendar-gregorian-from-absolute (+ abs-p 50)) | |
417 "Shavuot"))) | |
418 (optional | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
419 (list |
13050 | 420 (list (calendar-gregorian-from-absolute |
421 (calendar-dayname-on-or-before 6 (- abs-p 43))) | |
422 "Shabbat Shekalim") | |
423 (list (calendar-gregorian-from-absolute | |
424 (calendar-dayname-on-or-before 6 (- abs-p 30))) | |
425 "Shabbat Zachor") | |
426 (list (calendar-gregorian-from-absolute | |
427 (if (= (% abs-p 7) 2) (- abs-p 33) (- abs-p 31))) | |
428 "Fast of Esther") | |
429 (list (calendar-gregorian-from-absolute (- abs-p 31)) | |
430 "Erev Purim") | |
431 (list (calendar-gregorian-from-absolute (- abs-p 30)) | |
432 "Purim") | |
433 (list (calendar-gregorian-from-absolute | |
434 (if (zerop (% abs-p 7)) (- abs-p 28) (- abs-p 29))) | |
435 "Shushan Purim") | |
436 (list (calendar-gregorian-from-absolute | |
437 (- (calendar-dayname-on-or-before 6 (- abs-p 14)) 7)) | |
438 "Shabbat Parah") | |
439 (list (calendar-gregorian-from-absolute | |
440 (calendar-dayname-on-or-before 6 (- abs-p 14))) | |
441 "Shabbat HaHodesh") | |
442 (list (calendar-gregorian-from-absolute | |
443 (calendar-dayname-on-or-before 6 (1- abs-p))) | |
444 "Shabbat HaGadol") | |
445 (list (calendar-gregorian-from-absolute (1- abs-p)) | |
446 "Erev Passover") | |
447 (list (calendar-gregorian-from-absolute (1+ abs-p)) | |
448 "Passover (second day)") | |
449 (list (calendar-gregorian-from-absolute (+ abs-p 2)) | |
450 "Hol Hamoed Passover (first day)") | |
451 (list (calendar-gregorian-from-absolute (+ abs-p 3)) | |
452 "Hol Hamoed Passover (second day)") | |
453 (list (calendar-gregorian-from-absolute (+ abs-p 4)) | |
454 "Hol Hamoed Passover (third day)") | |
455 (list (calendar-gregorian-from-absolute (+ abs-p 5)) | |
456 "Hol Hamoed Passover (fourth day)") | |
457 (list (calendar-gregorian-from-absolute (+ abs-p 6)) | |
458 "Passover (seventh day)") | |
459 (list (calendar-gregorian-from-absolute (+ abs-p 7)) | |
460 "Passover (eighth day)") | |
17694
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
461 (list (calendar-gregorian-from-absolute |
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
462 (if (zerop (% (+ abs-p 12) 7)) |
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
463 (+ abs-p 13) |
c9fd662941e3
(holiday-passover-etc): Postpone date of Yom
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
464 (+ abs-p 12))) |
13050 | 465 "Yom HaShoah") |
466 (list (calendar-gregorian-from-absolute | |
467 (if (zerop (% abs-p 7)) | |
468 (+ abs-p 18) | |
469 (if (= (% abs-p 7) 6) | |
470 (+ abs-p 19) | |
471 (+ abs-p 20)))) | |
472 "Yom HaAtzma'ut") | |
473 (list (calendar-gregorian-from-absolute (+ abs-p 33)) | |
474 "Lag BaOmer") | |
475 (list (calendar-gregorian-from-absolute (+ abs-p 43)) | |
22063
bf477b03b470
Fix mispelling.
Edward M. Reingold <reingold@emr.cs.iit.edu>
parents:
20462
diff
changeset
|
476 "Yom Yerushalaim") |
13050 | 477 (list (calendar-gregorian-from-absolute (+ abs-p 49)) |
478 "Erev Shavuot") | |
479 (list (calendar-gregorian-from-absolute (+ abs-p 51)) | |
480 "Shavuot (second day)"))) | |
481 (output-list | |
92852 | 482 (holiday-filter-visible-calendar mandatory))) |
13050 | 483 (if all-hebrew-calendar-holidays |
484 (setq output-list | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
485 (append |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
486 (holiday-filter-visible-calendar optional) |
13050 | 487 output-list))) |
488 output-list))) | |
489 | |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
490 ;;;###holiday-autoload |
13050 | 491 (defun holiday-tisha-b-av-etc () |
492 "List of dates around Tisha B'Av, as visible in calendar window." | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
493 (unless (or (< displayed-month 5) ; none of the dates is visible |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
494 (> displayed-month 9)) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
495 (let ((abs-t-a (calendar-absolute-from-hebrew |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
496 (list 5 9 (+ displayed-year 3760))))) |
84552
eb2c7d456b7a
Rename all filter-visible-calendar-holidays callers to
Glenn Morris <rgm@gnu.org>
parents:
82140
diff
changeset
|
497 (holiday-filter-visible-calendar |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
498 (list |
13050 | 499 (list (calendar-gregorian-from-absolute |
500 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21))) | |
501 "Tzom Tammuz") | |
502 (list (calendar-gregorian-from-absolute | |
503 (calendar-dayname-on-or-before 6 abs-t-a)) | |
504 "Shabbat Hazon") | |
505 (list (calendar-gregorian-from-absolute | |
506 (if (= (% abs-t-a 7) 6) (1+ abs-t-a) abs-t-a)) | |
507 "Tisha B'Av") | |
508 (list (calendar-gregorian-from-absolute | |
509 (calendar-dayname-on-or-before 6 (+ abs-t-a 7))) | |
510 "Shabbat Nahamu")))))) | |
511 | |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
512 (autoload 'diary-list-entries-1 "diary-lib") |
92701
6a990f964e22
(date, entry, number): Move declarations to where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92667
diff
changeset
|
513 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
514 ;;;###diary-autoload |
13050 | 515 (defun list-hebrew-diary-entries () |
516 "Add any Hebrew date entries from the diary file to `diary-entries-list'. | |
517 Hebrew date diary entries must be prefaced by `hebrew-diary-entry-symbol' | |
92918
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
518 \(normally an `H'). The same diary date forms govern the style |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
519 of the Hebrew calendar entries, except that the Hebrew month |
93269
da37495d5c85
(list-hebrew-diary-entries): Doc fix.
Glenn Morris <rgm@gnu.org>
parents:
93183
diff
changeset
|
520 names cannot be abbreviated. The Hebrew months are numbered |
92918
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
521 from 1 to 13 with Nisan being 1, 12 being Adar I and 13 being |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
522 Adar II; you must use `Adar I' if you want Adar of a common |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
523 Hebrew year. If a Hebrew date diary entry begins with |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
524 `diary-nonmarking-symbol', the entry will appear in the diary |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
525 listing, but will not be marked in the calendar. This function |
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
526 is provided for use with `nongregorian-diary-listing-hook'." |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
527 (diary-list-entries-1 calendar-hebrew-month-name-array-leap-year |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
528 hebrew-diary-entry-symbol |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
529 'calendar-hebrew-from-absolute)) |
13050 | 530 |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
531 (autoload 'calendar-mark-complex "diary-lib") |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
532 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
533 ;;;###diary-autoload |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
534 (defun mark-hebrew-calendar-date-pattern (month day year &optional color) |
13050 | 535 "Mark dates in calendar window that conform to Hebrew date MONTH/DAY/YEAR. |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
536 A value of 0 in any position is a wildcard. Optional argument COLOR is |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
537 passed to `mark-visible-calendar-date' as MARK." |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
538 ;; FIXME not the same as the Bahai and Islamic cases, so can't use |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
539 ;; calendar-mark-1. |
13050 | 540 (save-excursion |
541 (set-buffer calendar-buffer) | |
92611
297952467e34
(mark-hebrew-calendar-date-pattern): Use zerop.
Glenn Morris <rgm@gnu.org>
parents:
92583
diff
changeset
|
542 (if (and (not (zerop month)) (not (zerop day))) |
297952467e34
(mark-hebrew-calendar-date-pattern): Use zerop.
Glenn Morris <rgm@gnu.org>
parents:
92583
diff
changeset
|
543 (if (not (zerop year)) |
13050 | 544 ;; Fully specified Hebrew date. |
545 (let ((date (calendar-gregorian-from-absolute | |
546 (calendar-absolute-from-hebrew | |
547 (list month day year))))) | |
548 (if (calendar-date-is-visible-p date) | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
549 (mark-visible-calendar-date date color))) |
13050 | 550 ;; Month and day in any year--this taken from the holiday stuff. |
92852 | 551 ;; This test is only to speed things up a bit, it works |
552 ;; fine without it. | |
92658 | 553 (if (memq displayed-month |
554 (list | |
13050 | 555 (if (< 11 month) (- month 11) (+ month 1)) |
556 (if (< 10 month) (- month 10) (+ month 2)) | |
557 (if (< 9 month) (- month 9) (+ month 3)) | |
558 (if (< 8 month) (- month 8) (+ month 4)) | |
559 (if (< 7 month) (- month 7) (+ month 5)))) | |
560 (let ((m1 displayed-month) | |
561 (y1 displayed-year) | |
562 (m2 displayed-month) | |
563 (y2 displayed-year) | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
564 year) |
13050 | 565 (increment-calendar-month m1 y1 -1) |
566 (increment-calendar-month m2 y2 1) | |
567 (let* ((start-date (calendar-absolute-from-gregorian | |
568 (list m1 1 y1))) | |
569 (end-date (calendar-absolute-from-gregorian | |
570 (list m2 | |
571 (calendar-last-day-of-month m2 y2) | |
572 y2))) | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
573 (hebrew-start (calendar-hebrew-from-absolute start-date)) |
13050 | 574 (hebrew-end (calendar-hebrew-from-absolute end-date)) |
575 (hebrew-y1 (extract-calendar-year hebrew-start)) | |
576 (hebrew-y2 (extract-calendar-year hebrew-end))) | |
577 (setq year (if (< 6 month) hebrew-y2 hebrew-y1)) | |
578 (let ((date (calendar-gregorian-from-absolute | |
579 (calendar-absolute-from-hebrew | |
580 (list month day year))))) | |
581 (if (calendar-date-is-visible-p date) | |
92993
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
582 (mark-visible-calendar-date date color))))))) |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
583 (calendar-mark-complex month day year |
61c2483cb400
(calendar-mark-complex): Autoload it.
Glenn Morris <rgm@gnu.org>
parents:
92972
diff
changeset
|
584 'calendar-hebrew-from-absolute color)))) |
13050 | 585 |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
586 (autoload 'diary-mark-entries-1 "diary-lib") |
86489
997f6a0ad183
(holiday-filter-visible-calendar)
Glenn Morris <rgm@gnu.org>
parents:
85510
diff
changeset
|
587 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
588 ;;;###diary-autoload |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
589 (defun mark-hebrew-diary-entries () |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
590 "Mark days in the calendar window that have Hebrew date diary entries. |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
591 Marks each entry in `diary-file' (or included files) visible in the calendar |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
592 window. See `list-hebrew-diary-entries' for more information." |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
593 (diary-mark-entries-1 calendar-hebrew-month-name-array-leap-year |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
594 hebrew-diary-entry-symbol |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
595 'calendar-hebrew-from-absolute |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
596 'mark-hebrew-calendar-date-pattern)) |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
597 |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
598 |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
599 (autoload 'diary-insert-entry-1 "diary-lib") |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
600 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
601 ;;;###cal-autoload |
13050 | 602 (defun insert-hebrew-diary-entry (arg) |
603 "Insert a diary entry. | |
604 For the Hebrew date corresponding to the date indicated by point. | |
92667 | 605 Prefix argument ARG makes the entry nonmarking." |
13050 | 606 (interactive "P") |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
607 (diary-insert-entry-1 nil arg calendar-hebrew-month-name-array-leap-year |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
608 hebrew-diary-entry-symbol |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
609 'calendar-hebrew-from-absolute)) |
13050 | 610 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
611 ;;;###cal-autoload |
13050 | 612 (defun insert-monthly-hebrew-diary-entry (arg) |
613 "Insert a monthly diary entry. | |
614 For the day of the Hebrew month corresponding to the date indicated by point. | |
92667 | 615 Prefix argument ARG makes the entry nonmarking." |
13050 | 616 (interactive "P") |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
617 (diary-insert-entry-1 'monthly arg calendar-hebrew-month-name-array-leap-year |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
618 hebrew-diary-entry-symbol |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
619 'calendar-hebrew-from-absolute)) |
13050 | 620 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
621 ;;;###cal-autoload |
13050 | 622 (defun insert-yearly-hebrew-diary-entry (arg) |
623 "Insert an annual diary entry. | |
624 For the day of the Hebrew year corresponding to the date indicated by point. | |
92667 | 625 Prefix argument ARG makes the entry nonmarking." |
13050 | 626 (interactive "P") |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
627 (diary-insert-entry-1 'yearly arg calendar-hebrew-month-name-array-leap-year |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
628 hebrew-diary-entry-symbol |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
629 'calendar-hebrew-from-absolute)) |
13050 | 630 |
631 ;;;###autoload | |
632 (defun list-yahrzeit-dates (death-date start-year end-year) | |
633 "List Yahrzeit dates for *Gregorian* DEATH-DATE from START-YEAR to END-YEAR. | |
634 When called interactively from the calendar window, the date of death is taken | |
635 from the cursor position." | |
636 (interactive | |
637 (let* ((death-date | |
638 (if (equal (current-buffer) (get-buffer calendar-buffer)) | |
639 (calendar-cursor-to-date) | |
640 (let* ((today (calendar-current-date)) | |
641 (year (calendar-read | |
642 "Year of death (>0): " | |
92583 | 643 (lambda (x) (> x 0)) |
13050 | 644 (int-to-string (extract-calendar-year today)))) |
645 (month-array calendar-month-name-array) | |
646 (completion-ignore-case t) | |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
647 (month (cdr (assoc-string |
24187
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
648 (completing-read |
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
649 "Month of death (name): " |
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
650 (mapcar 'list (append month-array nil)) |
cc07d0f935d4
(calendar-goto-hebrew-date)
Richard M. Stallman <rms@gnu.org>
parents:
22063
diff
changeset
|
651 nil t) |
54074
ae72e69df10d
(calendar-goto-hebrew-date, mark-hebrew-diary-entries)
Glenn Morris <rgm@gnu.org>
parents:
52401
diff
changeset
|
652 (calendar-make-alist month-array 1) t))) |
13050 | 653 (last (calendar-last-day-of-month month year)) |
654 (day (calendar-read | |
655 (format "Day of death (1-%d): " last) | |
92583 | 656 (lambda (x) (and (< 0 x) (<= x last)))))) |
13050 | 657 (list month day year)))) |
658 (death-year (extract-calendar-year death-date)) | |
659 (start-year (calendar-read | |
660 (format "Starting year of Yahrzeit table (>%d): " | |
661 death-year) | |
92583 | 662 (lambda (x) (> x death-year)) |
13050 | 663 (int-to-string (1+ death-year)))) |
664 (end-year (calendar-read | |
665 (format "Ending year of Yahrzeit table (>=%d): " | |
666 start-year) | |
92852 | 667 (lambda (x) (>= x start-year))))) |
668 (list death-date start-year end-year))) | |
92667 | 669 (message "Computing Yahrzeits...") |
92817
1b8224570e5f
(list-yahrzeit-dates): Use cal-hebrew-yahrzeit-buffer.
Glenn Morris <rgm@gnu.org>
parents:
92701
diff
changeset
|
670 (let* ((h-date (calendar-hebrew-from-absolute |
13050 | 671 (calendar-absolute-from-gregorian death-date))) |
672 (h-month (extract-calendar-month h-date)) | |
673 (h-day (extract-calendar-day h-date)) | |
674 (h-year (extract-calendar-year h-date))) | |
93025
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
675 (calendar-in-read-only-buffer cal-hebrew-yahrzeit-buffer |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
676 (calendar-set-mode-line |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
677 (format "Yahrzeit dates for %s = %s" |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
678 (calendar-date-string death-date) |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
679 (let ((calendar-month-name-array |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
680 (if (hebrew-calendar-leap-year-p h-year) |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
681 calendar-hebrew-month-name-array-leap-year |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
682 calendar-hebrew-month-name-array-common-year))) |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
683 (calendar-date-string h-date nil t)))) |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
684 (calendar-for-loop i from start-year to end-year do |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
685 (insert |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
686 (calendar-date-string |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
687 (calendar-gregorian-from-absolute |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
688 (hebrew-calendar-yahrzeit |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
689 h-date |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
690 (extract-calendar-year |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
691 (calendar-hebrew-from-absolute |
1e3b2cf969d4
(list-yahrzeit-dates): Use calendar-in-read-only-buffer to replace
Glenn Morris <rgm@gnu.org>
parents:
92993
diff
changeset
|
692 (calendar-absolute-from-gregorian (list 1 1 i))))))) "\n"))) |
92667 | 693 (message "Computing Yahrzeits...done"))) |
13050 | 694 |
92701
6a990f964e22
(date, entry, number): Move declarations to where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92667
diff
changeset
|
695 (defvar date) |
6a990f964e22
(date, entry, number): Move declarations to where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92667
diff
changeset
|
696 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
697 ;; To be called from list-sexp-diary-entries, where DATE is bound. |
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
698 ;;;###diary-autoload |
13050 | 699 (defun diary-hebrew-date () |
700 "Hebrew calendar equivalent of date diary entry." | |
701 (format "Hebrew date (until sunset): %s" (calendar-hebrew-date-string date))) | |
702 | |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
703 ;;;###diary-autoload |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
704 (defun diary-omer (&optional mark) |
13050 | 705 "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
|
706 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
|
707 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
708 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
|
709 use when highlighting the day in the calendar." |
13050 | 710 (let* ((passover |
711 (calendar-absolute-from-hebrew | |
712 (list 1 15 (+ (extract-calendar-year date) 3760)))) | |
713 (omer (- (calendar-absolute-from-gregorian date) passover)) | |
714 (week (/ omer 7)) | |
715 (day (% omer 7))) | |
716 (if (and (> omer 0) (< omer 50)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
717 (cons mark |
92852 | 718 (format "Day %d%s of the omer (until sunset)" |
719 omer | |
720 (if (zerop week) | |
721 "" | |
722 (format ", that is, %d week%s%s" | |
723 week | |
724 (if (= week 1) "" "s") | |
725 (if (zerop day) | |
726 "" | |
727 (format " and %d day%s" | |
728 day (if (= day 1) "" "s")))))))))) | |
13050 | 729 |
92701
6a990f964e22
(date, entry, number): Move declarations to where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92667
diff
changeset
|
730 (defvar entry) |
6a990f964e22
(date, entry, number): Move declarations to where they are needed.
Glenn Morris <rgm@gnu.org>
parents:
92667
diff
changeset
|
731 |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
732 (autoload 'diary-make-date "diary-lib") |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
733 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
734 ;;;###diary-autoload |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
735 (defun diary-yahrzeit (death-month death-day death-year &optional mark) |
92667 | 736 "Yahrzeit diary entry--entry applies if date is Yahrzeit or the day before. |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
737 Parameters are DEATH-MONTH, DEATH-DAY, DEATH-YEAR; the diary |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
738 entry is assumed to be the name of the person. Although the date |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
739 of death is specified by the civil calendar, the proper Hebrew |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
740 calendar Yahrzeit is determined. |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
741 |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
742 The order of the input parameters changes according to `calendar-date-style' |
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
743 \(e.g. to DEATH-DAY, DEATH-MONTH, DEATH-YEAR in the European style). |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
744 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
745 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
|
746 use when highlighting the day in the calendar." |
13050 | 747 (let* ((h-date (calendar-hebrew-from-absolute |
748 (calendar-absolute-from-gregorian | |
93378
5fce742bc681
Autoload diary-insert-entry-1.
Glenn Morris <rgm@gnu.org>
parents:
93269
diff
changeset
|
749 (diary-make-date death-month death-day death-year)))) |
13050 | 750 (h-month (extract-calendar-month h-date)) |
751 (h-day (extract-calendar-day h-date)) | |
752 (h-year (extract-calendar-year h-date)) | |
753 (d (calendar-absolute-from-gregorian date)) | |
754 (yr (extract-calendar-year (calendar-hebrew-from-absolute d))) | |
755 (diff (- yr h-year)) | |
756 (y (hebrew-calendar-yahrzeit h-date yr))) | |
757 (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
|
758 (cons mark |
92852 | 759 (format "Yahrzeit of %s%s: %d%s anniversary" |
760 entry | |
761 (if (= y d) "" " (evening)") | |
762 diff | |
763 (cond ((= (% diff 10) 1) "st") | |
764 ((= (% diff 10) 2) "nd") | |
765 ((= (% diff 10) 3) "rd") | |
766 (t "th"))))))) | |
13050 | 767 |
92830
669faa35f924
Add calendar-specific autoload cookies.
Glenn Morris <rgm@gnu.org>
parents:
92817
diff
changeset
|
768 ;;;###diary-autoload |
46619
5d2941da3ed1
(diary-omer, diary-yahrzeit, diary-rosh-hodesh, diary-parasha, diary-parasha):
Richard M. Stallman <rms@gnu.org>
parents:
44366
diff
changeset
|
769 (defun diary-rosh-hodesh (&optional mark) |
13050 | 770 "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
|
771 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
|
772 |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
773 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
|
774 use when highlighting the day in the calendar." |
13050 | 775 (let* ((d (calendar-absolute-from-gregorian date)) |
776 (h-date (calendar-hebrew-from-absolute d)) | |
777 (h-month (extract-calendar-month h-date)) | |
778 (h-day (extract-calendar-day h-date)) | |
779 (h-year (extract-calendar-year h-date)) | |
780 (leap-year (hebrew-calendar-leap-year-p h-year)) | |
781 (last-day (hebrew-calendar-last-day-of-month h-month h-year)) | |
782 (h-month-names | |
783 (if leap-year | |
784 calendar-hebrew-month-name-array-leap-year | |
785 calendar-hebrew-month-name-array-common-year)) | |
786 (this-month (aref h-month-names (1- h-month))) | |
787 (h-yesterday (extract-calendar-day | |
788 (calendar-hebrew-from-absolute (1- d))))) | |
789 (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
|
790 (cons mark |
92852 | 791 (format |
792 "Rosh Hodesh %s" | |
793 (if (= h-day 30) | |
794 (format | |
795 "%s (first day)" | |
796 ;; Next month must be in the same year since this | |
797 ;; month can't be the last month of the year since | |
798 ;; it has 30 days | |
799 (aref h-month-names h-month)) | |
800 (if (= h-yesterday 30) | |
801 (format "%s (second day)" this-month) | |
802 this-month)))) | |
803 (if (= (% d 7) 6) ; Saturday--check for Shabbat Mevarchim | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
46708
diff
changeset
|
804 (cons mark |
92852 | 805 (cond ((and (> h-day 22) (/= h-month 6) (= 29 last-day)) |
806 (format "Mevarchim Rosh Hodesh %s (%s)" | |
807 (aref h-month-names | |
808 (if (= h-month | |
809 (hebrew-calendar-last-month-of-year | |
810 h-year)) | |
811 0 h-month)) | |
812 (aref calendar-day-name-array (- 29 h-day)))) | |
813 ((and (< h-day 30) (> h-day 22) (= 30 last-day)) | |
814 (format "Mevarchim Rosh Hodesh %s (%s-%s)" | |
815 (aref h-month-names h-month) | |
816 (if (= h-day 29) | |
817 "tomorrow" | |
818 (aref calendar-day-name-array (- 29 h-day))) | |
819 (aref calendar-day-name-array | |
820 (% (- 30 h-day) 7)))))) | |
13050 | 821 (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
|
822 (cons mark |
92852 | 823 (format "Erev Rosh Hodesh %s" |
824 (aref h-month-names | |
825 (if (= h-month | |
826 (hebrew-calendar-last-month-of-year | |
827 h-year)) | |
828 0 h-month))))))))) | |
13050 | 829 |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
830 (defconst hebrew-calendar-parashiot-names |
92852 | 831 ["Bereshith" "Noah" "Lech L'cha" "Vayera" "Hayei Sarah" "Toledoth" |
832 "Vayetze" "Vayishlah" "Vayeshev" "Mikketz" "Vayiggash" "Vayhi" | |
833 "Shemoth" "Vaera" "Bo" "Beshallah" "Yithro" "Mishpatim" | |
834 "Terumah" "Tetzavveh" "Ki Tissa" "Vayakhel" "Pekudei" "Vayikra" | |
835 "Tzav" "Shemini" "Tazria" "Metzora" "Aharei Moth" "Kedoshim" | |
836 "Emor" "Behar" "Behukkotai" "Bemidbar" "Naso" "Behaalot'cha" | |
837 "Shelah L'cha" "Korah" "Hukkath" "Balak" "Pinhas" "Mattoth" | |
838 "Masei" "Devarim" "Vaethanan" "Ekev" "Reeh" "Shofetim" | |
839 "Ki Tetze" "Ki Tavo" "Nitzavim" "Vayelech" "Haazinu"] | |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
840 "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
|
841 |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
842 (defun hebrew-calendar-parasha-name (p) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
843 "Name(s) corresponding to parasha P." |
92852 | 844 (if (arrayp p) ; combined parasha |
52118
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
845 (format "%s/%s" |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
846 (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
|
847 (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
|
848 (aref hebrew-calendar-parashiot-names p))) |
af8f4ec2f255
Reposition some code so defined before used.
Glenn Morris <rgm@gnu.org>
parents:
49598
diff
changeset
|
849 |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
850 ;; Following 14 constants are used in diary-parasha (intern). |
92918
3f05cbe354c1
(displayed-month, displayed-year, original-date): Move declarations
Glenn Morris <rgm@gnu.org>
parents:
92852
diff
changeset
|
851 |
92658 | 852 ;; The seven ordinary year types (keviot). |
13050 | 853 (defconst hebrew-calendar-year-Saturday-incomplete-Sunday |
854 [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] | |
92852 | 855 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] |
856 43 44 45 46 47 48 49 50] | |
13050 | 857 "The structure of the parashiot. |
858 Hebrew year starts on Saturday, is `incomplete' (Heshvan and Kislev each have | |
859 29 days), and has Passover start on Sunday.") | |
860 | |
861 (defconst hebrew-calendar-year-Saturday-complete-Tuesday | |
862 [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] | |
92852 | 863 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] |
864 43 44 45 46 47 48 49 [50 51]] | |
13050 | 865 "The structure of the parashiot. |
866 Hebrew year that starts on Saturday, is `complete' (Heshvan and Kislev each | |
867 have 30 days), and has Passover start on Tuesday.") | |
868 | |
869 (defconst hebrew-calendar-year-Monday-incomplete-Tuesday | |
870 [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] | |
92852 | 871 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] |
872 43 44 45 46 47 48 49 [50 51]] | |
13050 | 873 "The structure of the parashiot. |
874 Hebrew year that starts on Monday, is `incomplete' (Heshvan and Kislev each | |
875 have 29 days), and has Passover start on Tuesday.") | |
876 | |
877 (defconst hebrew-calendar-year-Monday-complete-Thursday | |
878 [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] | |
92852 | 879 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36) |
880 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
13050 | 881 "The structure of the parashiot. |
882 Hebrew year that starts on Monday, is `complete' (Heshvan and Kislev each have | |
883 30 days), and has Passover start on Thursday.") | |
884 | |
885 (defconst hebrew-calendar-year-Tuesday-regular-Thursday | |
886 [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] | |
92852 | 887 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 (nil . 34) (34 . 35) (35 . 36) |
888 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
13050 | 889 "The structure of the parashiot. |
890 Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29 days and | |
891 Kislev has 30 days), and has Passover start on Thursday.") | |
892 | |
893 (defconst hebrew-calendar-year-Thursday-regular-Saturday | |
894 [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 | |
92852 | 895 24 nil (nil . 25) (25 . [26 27]) ([26 27] . [28 29]) ([28 29] . 30) |
896 (30 . 31) ([31 32] . 32) 33 34 35 36 37 38 39 40 [41 42] 43 44 45 46 47 48 | |
897 49 50] | |
13050 | 898 "The structure of the parashiot. |
899 Hebrew year that starts on Thursday, is `regular' (Heshvan has 29 days and | |
900 Kislev has 30 days), and has Passover start on Saturday.") | |
901 | |
902 (defconst hebrew-calendar-year-Thursday-complete-Sunday | |
903 [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 | |
92852 | 904 23 24 nil 25 [26 27] [28 29] 30 [31 32] 33 34 35 36 37 38 39 40 [41 42] |
905 43 44 45 46 47 48 49 50] | |
13050 | 906 "The structure of the parashiot. |
907 Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev each | |
908 have 30 days), and has Passover start on Sunday.") | |
909 | |
92658 | 910 ;; The seven leap year types (keviot). |
13050 | 911 (defconst hebrew-calendar-year-Saturday-incomplete-Tuesday |
912 [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 | |
92852 | 913 23 24 25 26 27 nil 28 29 30 31 32 33 34 35 36 37 38 39 40 [41 42] |
914 43 44 45 46 47 48 49 [50 51]] | |
13050 | 915 "The structure of the parashiot. |
916 Hebrew year that starts on Saturday, is `incomplete' (Heshvan and Kislev each | |
917 have 29 days), and has Passover start on Tuesday.") | |
918 | |
919 (defconst hebrew-calendar-year-Saturday-complete-Thursday | |
920 [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 | |
92852 | 921 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36) |
922 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
13050 | 923 "The structure of the parashiot. |
924 Hebrew year that starts on Saturday, is `complete' (Heshvan and Kislev each | |
925 have 30 days), and has Passover start on Thursday.") | |
926 | |
927 (defconst hebrew-calendar-year-Monday-incomplete-Thursday | |
928 [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 | |
92852 | 929 23 24 25 26 27 nil 28 29 30 31 32 33 (nil . 34) (34 . 35) (35 . 36) |
930 (36 . 37) (37 . 38) ([38 39] . 39) 40 [41 42] 43 44 45 46 47 48 49 [50 51]] | |
13050 | 931 "The structure of the parashiot. |
932 Hebrew year that starts on Monday, is `incomplete' (Heshvan and Kislev each | |
933 have 29 days), and has Passover start on Thursday.") | |
934 | |
935 (defconst hebrew-calendar-year-Monday-complete-Saturday | |
936 [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 | |
92852 | 937 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32) |
938 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39) | |
939 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50] | |
13050 | 940 "The structure of the parashiot. |
941 Hebrew year that starts on Monday, is `complete' (Heshvan and Kislev each have | |
942 30 days), and has Passover start on Saturday.") | |
943 | |
944 (defconst hebrew-calendar-year-Tuesday-regular-Saturday | |
945 [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 | |
92852 | 946 23 24 25 26 27 nil (nil . 28) (28 . 29) (29 . 30) (30 . 31) (31 . 32) |
947 (32 . 33) (33 . 34) (34 . 35) (35 . 36) (36 . 37) (37 . 38) (38 . 39) | |
948 (39 . 40) (40 . 41) ([41 42] . 42) 43 44 45 46 47 48 49 50] | |
13050 | 949 "The structure of the parashiot. |
950 Hebrew year that starts on Tuesday, is `regular' (Heshvan has 29 days and | |
951 Kislev has 30 days), and has Passover start on Saturday.") | |
952 | |
953 (defconst hebrew-calendar-year-Thursday-incomplete-Sunday | |
954 [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 | |
92852 | 955 23 24 25 26 27 28 nil 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
956 43 44 45 46 47 48 49 50] | |
13050 | 957 "The structure of the parashiot. |
958 Hebrew year that starts on Thursday, is `incomplete' (Heshvan and Kislev both | |
959 have 29 days), and has Passover start on Sunday.") | |
960 | |
961 (defconst hebrew-calendar-year-Thursday-complete-Tuesday | |
962 [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 | |
92852 | 963 23 24 25 26 27 28 nil 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
964 43 44 45 46 47 48 49 [50 51]] | |
13050 | 965 "The structure of the parashiot. |
966 Hebrew year that starts on Thursday, is `complete' (Heshvan and Kislev both | |
967 have 30 days), and has Passover start on Tuesday.") | |
968 | |
92972
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
969 ;;;###diary-autoload |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
970 (defun diary-parasha (&optional mark) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
971 "Parasha diary entry--entry applies if date is a Saturday. |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
972 An optional parameter MARK specifies a face or single-character string to |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
973 use when highlighting the day in the calendar." |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
974 (let ((d (calendar-absolute-from-gregorian date))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
975 (if (= (% d 7) 6) ; Saturday |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
976 (let* ((h-year (extract-calendar-year |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
977 (calendar-hebrew-from-absolute d))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
978 (rosh-hashanah |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
979 (calendar-absolute-from-hebrew (list 7 1 h-year))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
980 (passover |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
981 (calendar-absolute-from-hebrew (list 1 15 h-year))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
982 (rosh-hashanah-day |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
983 (aref calendar-day-name-array (% rosh-hashanah 7))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
984 (passover-day |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
985 (aref calendar-day-name-array (% passover 7))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
986 (long-h (hebrew-calendar-long-heshvan-p h-year)) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
987 (short-k (hebrew-calendar-short-kislev-p h-year)) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
988 (type (cond ((and long-h (not short-k)) "complete") |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
989 ((and (not long-h) short-k) "incomplete") |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
990 (t "regular"))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
991 (year-format |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
992 (symbol-value |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
993 (intern (format "hebrew-calendar-year-%s-%s-%s" ; keviah |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
994 rosh-hashanah-day type passover-day)))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
995 (first-saturday ; of Hebrew year |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
996 (calendar-dayname-on-or-before 6 (+ 6 rosh-hashanah))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
997 (saturday ; which Saturday of the Hebrew year |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
998 (/ (- d first-saturday) 7)) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
999 (parasha (aref year-format saturday))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1000 (if parasha |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1001 (cons mark |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1002 (format |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1003 "Parashat %s" |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1004 (if (listp parasha) ; Israel differs from diaspora |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1005 (if (car parasha) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1006 (format "%s (diaspora), %s (Israel)" |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1007 (hebrew-calendar-parasha-name |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1008 (car parasha)) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1009 (hebrew-calendar-parasha-name |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1010 (cdr parasha))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1011 (format "%s (Israel)" |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1012 (hebrew-calendar-parasha-name |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1013 (cdr parasha)))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1014 (hebrew-calendar-parasha-name parasha))))))))) |
81a28241fa57
(number, original-date, add-to-diary-list)
Glenn Morris <rgm@gnu.org>
parents:
92918
diff
changeset
|
1015 |
13050 | 1016 (provide 'cal-hebrew) |
1017 | |
92583 | 1018 ;; arch-tag: aaab6718-7712-42ac-a32d-28fe1f944f3c |
13050 | 1019 ;;; cal-hebrew.el ends here |