annotate lisp/calendar/holidays.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 0293115a14e9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; holidays.el --- holiday functions for the calendar package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;;; Copyright (C) 1989, 1990, 1992, 1993, 1994 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; Keywords: holidays, calendar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
21 ;; along with XEmacs; see the file COPYING. If not, write to the Free
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 16
diff changeset
22 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;; This collection of functions implements the holiday features as described
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;; in calendar.el.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;; Comments, corrections, and improvements should be sent to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;; Edward M. Reingold Department of Computer Science
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; (217) 333-6733 University of Illinois at Urbana-Champaign
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; reingold@cs.uiuc.edu 1304 West Springfield Avenue
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; Urbana, Illinois 61801
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; Technical details of all the calendrical calculations can be found in
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 ;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;; Software--Practice and Experience, Volume 20, Number 9 (September, 1990),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 ;; pages 899-928. ``Calendrical Calculations, Part II: Three Historical
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; Calendars'' by E. M. Reingold, N. Dershowitz, and S. M. Clamen,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ;; Software--Practice and Experience, Volume 23, Number 4 (April, 1993),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ;; pages 383-404.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ;; Hard copies of these two papers can be obtained by sending email to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ;; reingold@cs.uiuc.edu with the SUBJECT "send-paper-cal" (no quotes) and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 ;; the message BODY containing your mailing address (snail).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (require 'calendar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (autoload 'solar-equinoxes-solstices "solar"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 "Date and time of equinoxes and solstices, if visible in the calendar window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 Requires floating point."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 ;;;###autoload
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (defun holidays (&optional arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "Display the holidays for last month, this month, and next month.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 If called with an optional prefix argument, prompts for month and year.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 This function is suitable for execution in a .emacs file."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (let* ((completion-ignore-case t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (date (if arg
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (calendar-read-date t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (calendar-current-date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 (displayed-month (extract-calendar-month date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (displayed-year (extract-calendar-year date)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (list-calendar-holidays))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun check-calendar-holidays (date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 "Check the list of holidays for any that occur on DATE.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 The value returned is a list of strings of relevant holiday descriptions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 The holidays are those in the list calendar-holidays."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (let* ((displayed-month (extract-calendar-month date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (displayed-year (extract-calendar-year date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (h (calendar-holiday-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (holiday-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (while h
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 (if (calendar-date-equal date (car (car h)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 (setq holiday-list (append holiday-list (cdr (car h)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (setq h (cdr h)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 holiday-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (defun calendar-cursor-holidays ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 "Find holidays for the date specified by the cursor in the calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (message "Checking holidays...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (let* ((date (calendar-cursor-to-date t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (date-string (calendar-date-string date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (holiday-list (check-calendar-holidays date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (holiday-string (mapconcat 'identity holiday-list "; "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 (msg (format "%s: %s" date-string holiday-string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (if (not holiday-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (message "No holidays known for %s" date-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (if (<= (length msg) (frame-width))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (message msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (set-buffer (get-buffer-create holiday-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (calendar-set-mode-line date-string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (insert (mapconcat 'identity holiday-list "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 (display-buffer holiday-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (message "Checking holidays...done")))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (defun mark-calendar-holidays ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 "Mark notable days in the calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (setq mark-holidays-in-calendar t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (message "Marking holidays...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (let ((holiday-list (calendar-holiday-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (while holiday-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 (mark-visible-calendar-date
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 (car (car holiday-list)) calendar-holiday-marker)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (setq holiday-list (cdr holiday-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (message "Marking holidays...done"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 (defun list-calendar-holidays ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 "Create a buffer containing the holidays for the current calendar window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 The holidays are those in the list calendar-notable-days. Returns t if any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 holidays are found, nil if not."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (message "Looking up holidays...")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (let ((holiday-list (calendar-holiday-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (m1 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 (y1 displayed-year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (m2 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (y2 displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (if (not holiday-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 (message "Looking up holidays...none found")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 (set-buffer (get-buffer-create holiday-buffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (increment-calendar-month m1 y1 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (increment-calendar-month m2 y2 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 (calendar-set-mode-line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 (if (= y1 y2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 (format "Notable Dates from %s to %s, %d%%-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 (calendar-month-name m1) (calendar-month-name m2) y2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (format "Notable Dates from %s, %d to %s, %d%%-"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (calendar-month-name m1) y1 (calendar-month-name m2) y2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (insert
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (mapconcat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 '(lambda (x) (concat (calendar-date-string (car x))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ": " (car (cdr x))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 holiday-list "\n"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 (setq buffer-read-only t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 (display-buffer holiday-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (message "Looking up holidays...done")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 (defun calendar-holiday-list ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 "Form the list of holidays that occur on dates in the calendar window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 The holidays are those in the list calendar-holidays."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (let ((p calendar-holidays)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (holiday-list))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 (let* ((holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 (if calendar-debug-sexp
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 (let ((stack-trace-on-error t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 (eval (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (condition-case nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 (eval (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (error (beep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 (message "Bad holiday list item: %s" (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 (sleep-for 2))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (if holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (setq holiday-list (append holidays holiday-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (setq holiday-list (sort holiday-list 'calendar-date-compare))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; Below are the functions that calculate the dates of holidays; these
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; are eval'ed in the function calendar-holiday-list. If you
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; write other such functions, be sure to imitate the style used below.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 ;; Remember that each function must return a list of items of the form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 ;; ((month day year) string) of VISIBLE dates in the calendar window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 (defun holiday-fixed (month day string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 "Holiday on MONTH, DAY (Gregorian) called STRING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 If MONTH, DAY is visible, the value returned is the list (((MONTH DAY year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 STRING)). Returns nil if it is not visible in the current calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 (let ((m displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 (y displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (increment-calendar-month m y (- 11 month))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (if (> m 9)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (list (list (list month day y) string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 (defun holiday-float (month dayname n string &optional day)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 "Holiday on MONTH, DAYNAME (Nth occurrence, Gregorian) called STRING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 If the Nth DAYNAME in MONTH is visible, the value returned is the list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 \(((MONTH DAY year) STRING)).
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 If N<0, count backward from the end of MONTH.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 An optional parameter DAY means the Nth DAYNAME after/before MONTH DAY.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 Returns nil if it is not visible in the current calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 (let ((m displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 (y displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 (increment-calendar-month m y (- 11 month))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (if (> m 9)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (list (list (calendar-nth-named-day n dayname month y day) string)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 (defun holiday-julian (month day string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 "Holiday on MONTH, DAY (Julian) called STRING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 If MONTH, DAY (Julian) is visible, the value returned is corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 Gregorian date in the form of the list (((month day year) STRING)). Returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 nil if it is not visible in the current calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (let ((m1 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (y1 displayed-year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (m2 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (y2 displayed-year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 (increment-calendar-month m1 y1 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 (increment-calendar-month m2 y2 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (let* ((start-date (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (list m1 1 y1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (end-date (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 (list m2 (calendar-last-day-of-month m2 y2) y2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 (julian-start (calendar-julian-from-absolute start-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (julian-end (calendar-julian-from-absolute end-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (julian-y1 (extract-calendar-year julian-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (julian-y2 (extract-calendar-year julian-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 (setq year (if (< 10 month) julian-y1 julian-y2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 (let ((date (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (calendar-absolute-from-julian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 (list month day year)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (if (calendar-date-is-visible-p date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 (list (list date string)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 (defun holiday-islamic (month day string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 "Holiday on MONTH, DAY (Islamic) called STRING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 If MONTH, DAY (Islamic) is visible, the value returned is corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 Gregorian date in the form of the list (((month day year) STRING)). Returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 nil if it is not visible in the current calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (let* ((islamic-date (calendar-islamic-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (list displayed-month 15 displayed-year))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (m (extract-calendar-month islamic-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (y (extract-calendar-year islamic-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (if (< m 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 nil;; Islamic calendar doesn't apply.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 (increment-calendar-month m y (- 10 month))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 (if (> m 7);; Islamic date might be visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (let ((date (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (calendar-absolute-from-islamic (list month day y)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 (if (calendar-date-is-visible-p date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 (list (list date string))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 (defun holiday-hebrew (month day string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 "Holiday on MONTH, DAY (Hebrew) called STRING.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 If MONTH, DAY (Hebrew) is visible, the value returned is corresponding
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 Gregorian date in the form of the list (((month day year) STRING)). Returns
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 nil if it is not visible in the current calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (if (memq displayed-month;; This test is only to speed things up a bit;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 (list ;; it works fine without the test too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 (if (< 11 month) (- month 11) (+ month 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 (if (< 10 month) (- month 10) (+ month 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 (if (< 9 month) (- month 9) (+ month 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (if (< 8 month) (- month 8) (+ month 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 (if (< 7 month) (- month 7) (+ month 5))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 (let ((m1 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 (y1 displayed-year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 (m2 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 (y2 displayed-year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 (year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 (increment-calendar-month m1 y1 -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 (increment-calendar-month m2 y2 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 (let* ((start-date (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 (list m1 1 y1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (end-date (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (list m2 (calendar-last-day-of-month m2 y2) y2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (hebrew-start (calendar-hebrew-from-absolute start-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (hebrew-end (calendar-hebrew-from-absolute end-date))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (hebrew-y1 (extract-calendar-year hebrew-start))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (hebrew-y2 (extract-calendar-year hebrew-end)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 (setq year (if (< 6 month) hebrew-y2 hebrew-y1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (let ((date (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (calendar-absolute-from-hebrew
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (list month day year)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 (if (calendar-date-is-visible-p date)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (list (list date string))))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (defun holiday-sexp (sexp string)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 "Sexp holiday for dates in the calendar window.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 SEXP is an expression in variable `year' evaluates to `date'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 STRING is an expression in `date' that evaluates to the holiday description
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 of `date'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 If `date' is visible in the calendar window, the holiday STRING is on that
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 date. If date is nil, or if the date is not visible, there is no holiday."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 (let ((m displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (y displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (increment-calendar-month m y -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 (filter-visible-calendar-holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (let* ((year y)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (date (eval sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (string (if date (eval string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 (list (list date string)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (let* ((year (1+ y))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (date (eval sexp))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (string (if date (eval string))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (list (list date string)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 (defun holiday-advent ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 "Date of Advent, if visible in calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 (let ((year displayed-year)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 (month displayed-month))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (increment-calendar-month month year -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 (let ((advent (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 (calendar-dayname-on-or-before 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 (list 12 3 year))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (if (calendar-date-is-visible-p advent)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 (list (list advent "Advent"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (defun holiday-easter-etc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 "List of dates related to Easter, as visible in calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (if (and (> displayed-month 5) (not all-christian-calendar-holidays))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 nil;; Ash Wednesday, Good Friday, and Easter are not visible.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (let* ((century (1+ (/ displayed-year 100)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (shifted-epact ;; Age of moon for April 5...
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (% (+ 14 (* 11 (% displayed-year 19));; ...by Nicaean rule
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (- ;; ...corrected for the Gregorian century rule
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (/ (* 3 century) 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (/ ;; ...corrected for Metonic cycle inaccuracy.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (+ 5 (* 8 century)) 25)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (* 30 century));; Keeps value positive.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 30))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (adjusted-epact ;; Adjust for 29.5 day month.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (if (or (= shifted-epact 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (and (= shifted-epact 1) (< 10 (% displayed-year 19))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (1+ shifted-epact)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 shifted-epact))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 (paschal-moon ;; Day after the full moon on or after March 21.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (- (calendar-absolute-from-gregorian (list 4 19 displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 adjusted-epact))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (abs-easter (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (mandatory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (list (calendar-gregorian-from-absolute abs-easter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 "Easter Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (list (calendar-gregorian-from-absolute (- abs-easter 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 "Good Friday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (list (calendar-gregorian-from-absolute (- abs-easter 46))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 "Ash Wednesday")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (list (calendar-gregorian-from-absolute (- abs-easter 63))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 "Septuagesima Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (list (calendar-gregorian-from-absolute (- abs-easter 56))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 "Sexagesima Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (list (calendar-gregorian-from-absolute (- abs-easter 49))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 "Shrove Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (list (calendar-gregorian-from-absolute (- abs-easter 48))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 "Shrove Monday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (list (calendar-gregorian-from-absolute (- abs-easter 47))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 "Shrove Tuesday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (list (calendar-gregorian-from-absolute (- abs-easter 14))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 "Passion Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 (list (calendar-gregorian-from-absolute (- abs-easter 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 "Palm Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 (list (calendar-gregorian-from-absolute (- abs-easter 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 "Maundy Thursday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 (list (calendar-gregorian-from-absolute (+ abs-easter 35))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 "Rogation Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 (list (calendar-gregorian-from-absolute (+ abs-easter 39))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 "Ascension Day")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 (list (calendar-gregorian-from-absolute (+ abs-easter 49))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 "Pentecost (Whitsunday)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (list (calendar-gregorian-from-absolute (+ abs-easter 50))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 "Whitmunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (list (calendar-gregorian-from-absolute (+ abs-easter 56))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 "Trinity Sunday")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (list (calendar-gregorian-from-absolute (+ abs-easter 60))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 "Corpus Christi")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (output-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 (filter-visible-calendar-holidays mandatory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (if all-christian-calendar-holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (setq output-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 (filter-visible-calendar-holidays optional)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 output-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 output-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 (defun holiday-greek-orthodox-easter ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 "Date of Easter according to the rule of the Council of Nicaea."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (let ((m displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (y displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (increment-calendar-month m y 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (let* ((julian-year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (extract-calendar-year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (calendar-julian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (list m (calendar-last-day-of-month m y) y)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (shifted-epact ;; Age of moon for April 5.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 (% (+ 14
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (* 11 (% julian-year 19)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 30))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 (paschal-moon ;; Day after full moon on or after March 21.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (- (calendar-absolute-from-julian (list 4 19 julian-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 shifted-epact))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (nicaean-easter;; Sunday following the Paschal moon
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 (calendar-dayname-on-or-before 0 (+ paschal-moon 7)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (if (calendar-date-is-visible-p nicaean-easter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (list (list nicaean-easter "Pascha (Greek Orthodox Easter)"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (defun holiday-rosh-hashanah-etc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 "List of dates related to Rosh Hashanah, as visible in calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 (if (or (< displayed-month 8)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 (> displayed-month 11))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 nil;; None of the dates is visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (let* ((abs-r-h (calendar-absolute-from-hebrew
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (list 7 1 (+ displayed-year 3761))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (mandatory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 (list (calendar-gregorian-from-absolute abs-r-h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (format "Rosh HaShanah %d" (+ 3761 displayed-year)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (list (calendar-gregorian-from-absolute (+ abs-r-h 9))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 "Yom Kippur")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 (list (calendar-gregorian-from-absolute (+ abs-r-h 14))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 "Sukkot")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (list (calendar-gregorian-from-absolute (+ abs-r-h 21))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 "Shemini Atzeret")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (list (calendar-gregorian-from-absolute (+ abs-r-h 22))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 "Simchat Torah")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 (calendar-dayname-on-or-before 6 (- abs-r-h 4)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443 "Selichot (night)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 (list (calendar-gregorian-from-absolute (1- abs-r-h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 "Erev Rosh HaShannah")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 (list (calendar-gregorian-from-absolute (1+ abs-r-h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447 "Rosh HaShanah (second day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (if (= (% abs-r-h 7) 4) (+ abs-r-h 3) (+ abs-r-h 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 "Tzom Gedaliah")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (calendar-dayname-on-or-before 6 (+ 7 abs-r-h)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 "Shabbat Shuvah")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (list (calendar-gregorian-from-absolute (+ abs-r-h 8))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 "Erev Yom Kippur")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (list (calendar-gregorian-from-absolute (+ abs-r-h 13))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 "Erev Sukkot")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (list (calendar-gregorian-from-absolute (+ abs-r-h 15))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 "Sukkot (second day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (list (calendar-gregorian-from-absolute (+ abs-r-h 16))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 "Hol Hamoed Sukkot (first day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (list (calendar-gregorian-from-absolute (+ abs-r-h 17))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 "Hol Hamoed Sukkot (second day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (list (calendar-gregorian-from-absolute (+ abs-r-h 18))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 "Hol Hamoed Sukkot (third day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (list (calendar-gregorian-from-absolute (+ abs-r-h 19))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 "Hol Hamoed Sukkot (fourth day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468 (list (calendar-gregorian-from-absolute (+ abs-r-h 20))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 "Hoshannah Rabbah")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 (output-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (filter-visible-calendar-holidays mandatory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (if all-hebrew-calendar-holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 (setq output-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 (filter-visible-calendar-holidays optional)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 output-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 output-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479 (defun holiday-hanukkah ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 "List of dates related to Hanukkah, as visible in calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 (if (memq displayed-month;; This test is only to speed things up a bit;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 '(10 11 12 1 2));; it works fine without the test too.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483 (let ((m displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 (y displayed-year))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (increment-calendar-month m y 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486 (let* ((h-y (extract-calendar-year
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (calendar-hebrew-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 (calendar-absolute-from-gregorian
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (list m (calendar-last-day-of-month m y) y)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 (abs-h (calendar-absolute-from-hebrew (list 9 25 h-y))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (filter-visible-calendar-holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (list (calendar-gregorian-from-absolute (1- abs-h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 "Erev Hanukkah")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (list (calendar-gregorian-from-absolute abs-h)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 "Hanukkah (first day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 (list (calendar-gregorian-from-absolute (1+ abs-h))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 "Hanukkah (second day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 (list (calendar-gregorian-from-absolute (+ abs-h 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 "Hanukkah (third day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (list (calendar-gregorian-from-absolute (+ abs-h 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 "Hanukkah (fourth day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (list (calendar-gregorian-from-absolute (+ abs-h 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 "Hanukkah (fifth day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (list (calendar-gregorian-from-absolute (+ abs-h 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506 "Hanukkah (sixth day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (list (calendar-gregorian-from-absolute (+ abs-h 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
508 "Hanukkah (seventh day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
509 (list (calendar-gregorian-from-absolute (+ abs-h 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
510 "Hanukkah (eighth day)")))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
511
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
512 (defun holiday-passover-etc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
513 "List of dates related to Passover, as visible in calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
514 (if (< 7 displayed-month)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
515 nil;; None of the dates is visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
516 (let* ((abs-p (calendar-absolute-from-hebrew
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
517 (list 1 15 (+ displayed-year 3760))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
518 (mandatory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
519 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
520 (list (calendar-gregorian-from-absolute abs-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
521 "Passover")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
522 (list (calendar-gregorian-from-absolute (+ abs-p 50))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
523 "Shavuot")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
524 (optional
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
525 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
526 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
527 (calendar-dayname-on-or-before 6 (- abs-p 43)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
528 "Shabbat Shekalim")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
529 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
530 (calendar-dayname-on-or-before 6 (- abs-p 30)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
531 "Shabbat Zachor")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
532 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
533 (if (= (% abs-p 7) 2) (- abs-p 33) (- abs-p 31)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
534 "Fast of Esther")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
535 (list (calendar-gregorian-from-absolute (- abs-p 31))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
536 "Erev Purim")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
537 (list (calendar-gregorian-from-absolute (- abs-p 30))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
538 "Purim")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
539 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
540 (if (zerop (% abs-p 7)) (- abs-p 28) (- abs-p 29)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
541 "Shushan Purim")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
542 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
543 (- (calendar-dayname-on-or-before 6 (- abs-p 14)) 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
544 "Shabbat Parah")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
545 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
546 (calendar-dayname-on-or-before 6 (- abs-p 14)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
547 "Shabbat HaHodesh")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
548 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
549 (calendar-dayname-on-or-before 6 (1- abs-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
550 "Shabbat HaGadol")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
551 (list (calendar-gregorian-from-absolute (1- abs-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
552 "Erev Passover")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
553 (list (calendar-gregorian-from-absolute (1+ abs-p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
554 "Passover (second day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
555 (list (calendar-gregorian-from-absolute (+ abs-p 2))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
556 "Hol Hamoed Passover (first day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
557 (list (calendar-gregorian-from-absolute (+ abs-p 3))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
558 "Hol Hamoed Passover (second day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
559 (list (calendar-gregorian-from-absolute (+ abs-p 4))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
560 "Hol Hamoed Passover (third day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
561 (list (calendar-gregorian-from-absolute (+ abs-p 5))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
562 "Hol Hamoed Passover (fourth day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
563 (list (calendar-gregorian-from-absolute (+ abs-p 6))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
564 "Passover (seventh day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
565 (list (calendar-gregorian-from-absolute (+ abs-p 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
566 "Passover (eighth day)")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
567 (list (calendar-gregorian-from-absolute (+ abs-p 12))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
568 "Yom HaShoah")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
569 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
570 (if (zerop (% abs-p 7))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
571 (+ abs-p 18)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
572 (if (= (% abs-p 7) 6)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
573 (+ abs-p 19)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
574 (+ abs-p 20))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
575 "Yom HaAtzma'ut")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
576 (list (calendar-gregorian-from-absolute (+ abs-p 33))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
577 "Lag BaOmer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
578 (list (calendar-gregorian-from-absolute (+ abs-p 43))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
579 "Yom Yerushalim")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
580 (list (calendar-gregorian-from-absolute (+ abs-p 49))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
581 "Erev Shavuot")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
582 (list (calendar-gregorian-from-absolute (+ abs-p 51))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
583 "Shavuot (second day)")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
584 (output-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
585 (filter-visible-calendar-holidays mandatory)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
586 (if all-hebrew-calendar-holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
587 (setq output-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
588 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
589 (filter-visible-calendar-holidays optional)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
590 output-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
591 output-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
592
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
593 (defun holiday-tisha-b-av-etc ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
594 "List of dates around Tisha B'Av, as visible in calendar window."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
595 (if (or (< displayed-month 5)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
596 (> displayed-month 9))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
597 nil;; None of the dates is visible
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
598 (let* ((abs-t-a (calendar-absolute-from-hebrew
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
599 (list 5 9 (+ displayed-year 3760)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
600
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
601 (filter-visible-calendar-holidays
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
602 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
603 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
604 (if (= (% abs-t-a 7) 6) (- abs-t-a 20) (- abs-t-a 21)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
605 "Tzom Tammuz")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
606 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
607 (calendar-dayname-on-or-before 6 abs-t-a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
608 "Shabbat Hazon")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
609 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
610 (if (= (% abs-t-a 7) 6) (1+ abs-t-a) abs-t-a))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
611 "Tisha B'Av")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
612 (list (calendar-gregorian-from-absolute
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
613 (calendar-dayname-on-or-before 6 (+ abs-t-a 7)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
614 "Shabbat Nahamu"))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
615
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
616 (defun filter-visible-calendar-holidays (l)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
617 "Return a list of all visible holidays of those on L."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
618 (let ((visible)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
619 (p l))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
620 (while p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
621 (and (car (car p))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
622 (calendar-date-is-visible-p (car (car p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
623 (setq visible (append (list (car p)) visible)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
624 (setq p (cdr p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
625 visible))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
626
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
627 (provide 'holidays)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
628
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
629 ;;; holidays.el ends here