annotate lisp/calendar/holidays.el @ 4864:4bfa62882154

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