calendar.el 122 KB
Newer Older
1
;;; calendar.el --- calendar functions
Eric S. Raymond's avatar
Eric S. Raymond committed
2

3
;; Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997,
4
;;	2000, 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
Eric S. Raymond's avatar
Eric S. Raymond committed
5

Eric S. Raymond's avatar
Eric S. Raymond committed
6
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
Glenn Morris's avatar
Glenn Morris committed
7
;; Maintainer: Glenn Morris <gmorris@ast.cam.ac.uk>
Eric S. Raymond's avatar
Eric S. Raymond committed
8
;; Keywords: calendar
9
;; Human-Keywords: calendar, Gregorian calendar, diary, holidays
Eric S. Raymond's avatar
Eric S. Raymond committed
10

Richard M. Stallman's avatar
Richard M. Stallman committed
11 12
;; This file is part of GNU Emacs.

Richard M. Stallman's avatar
Richard M. Stallman committed
13 14 15 16 17
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

Richard M. Stallman's avatar
Richard M. Stallman committed
18
;; GNU Emacs is distributed in the hope that it will be useful,
Richard M. Stallman's avatar
Richard M. Stallman committed
19 20 21 22 23
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
Erik Naggum's avatar
Erik Naggum committed
24 25 26
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
Richard M. Stallman's avatar
Richard M. Stallman committed
27

Eric S. Raymond's avatar
Eric S. Raymond committed
28 29
;;; Commentary:

30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
;; This collection of functions implements a calendar window.  It
;; generates a calendar for the current month, together with the
;; previous and coming months, or for any other three-month period.
;; The calendar can be scrolled forward and backward in the window to
;; show months in the past or future; the cursor can move forward and
;; backward by days, weeks, or months, making it possible, for
;; instance, to jump to the date a specified number of days, weeks, or
;; months from the date under the cursor.  The user can display a list
;; of holidays and other notable days for the period shown; the
;; notable days can be marked on the calendar, if desired.  The user
;; can also specify that dates having corresponding diary entries (in
;; a file that the user specifies) be marked; the diary entries for
;; any date can be viewed in a separate window.  The diary and the
;; notable days can be viewed independently of the calendar.  Dates
;; can be translated from the (usual) Gregorian calendar to the day of
;; the year/days remaining in year, to the ISO commercial calendar, to
;; the Julian (old style) calendar, to the Hebrew calendar, to the
;; Islamic calendar, to the Baha'i calendar, to the French
;; Revolutionary calendar, to the Mayan calendar, to the Chinese
;; calendar, to the Coptic calendar, to the Ethiopic calendar, and to
;; the astronomical (Julian) day number.  When floating point is
;; available, times of sunrise/sunset can be displayed, as can the
;; phases of the moon.  Appointment notification for diary entries is
53
;; available.  Calendar printing via LaTeX is available.
Jim Blandy's avatar
Jim Blandy committed
54 55 56

;; The following files are part of the calendar/diary code:

57
;;       appt.el                       Appointment notification
58
;;       cal-china.el                  Chinese calendar
59 60 61
;;       cal-coptic.el                 Coptic/Ethiopic calendars
;;       cal-dst.el                    Daylight savings time rules
;;       cal-hebrew.el                 Hebrew calendar
62
;;       cal-islam.el                  Islamic calendar
63
;;       cal-bahai.el                  Baha'i calendar
64 65 66
;;       cal-iso.el                    ISO calendar
;;       cal-julian.el                 Julian/astronomical calendars
;;       cal-mayan.el                  Mayan calendars
67
;;       cal-menu.el                   Menu support
68
;;       cal-move.el                   Movement in the calendar
69
;;       cal-persia.el                 Persian calendar
70
;;       cal-tex.el                    Calendars in LaTeX
71
;;       cal-x.el                      X-windows dedicated frame functions
Richard M. Stallman's avatar
Richard M. Stallman committed
72
;;       diary-lib.el                  Diary functions
Jim Blandy's avatar
Jim Blandy committed
73 74
;;       holidays.el                   Holiday functions
;;       lunar.el                      Phases of the moon
75
;;       solar.el                      Sunrise/sunset, equinoxes/solstices
Richard M. Stallman's avatar
Richard M. Stallman committed
76 77

;; Technical details of all the calendrical calculations can be found in
78 79
;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
;; Cambridge University Press (1997).
Jim Blandy's avatar
Jim Blandy committed
80

81
;; An earlier version of the technical details appeared in
Richard M. Stallman's avatar
Richard M. Stallman committed
82 83
;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
;; Software--Practice and Experience, Volume 20, Number 9 (September, 1990),
Jim Blandy's avatar
Jim Blandy committed
84 85
;; pages 899-928.  ``Calendrical Calculations, Part II: Three Historical
;; Calendars'' by E. M. Reingold,  N. Dershowitz, and S. M. Clamen,
86 87
;; Software--Practice and Experience, Volume 23, Number 4 (April, 1993),
;; pages 383-404.
Jim Blandy's avatar
Jim Blandy committed
88 89 90 91

;; Hard copies of these two papers can be obtained by sending email to
;; reingold@cs.uiuc.edu with the SUBJECT "send-paper-cal" (no quotes) and
;; the message BODY containing your mailing address (snail).
Richard M. Stallman's avatar
Richard M. Stallman committed
92

93 94 95 96 97 98
;; Comments, corrections, and improvements should be sent to
;;  Edward M. Reingold               Department of Computer Science
;;  (217) 333-6733                   University of Illinois at Urbana-Champaign
;;  reingold@cs.uiuc.edu             1304 West Springfield Avenue
;;                                   Urbana, Illinois 61801

Eric S. Raymond's avatar
Eric S. Raymond committed
99
;;; Code:
Richard M. Stallman's avatar
Richard M. Stallman committed
100

101
(eval-when-compile
102 103 104 105 106
  (defvar displayed-month)
  (defvar displayed-year)
  (defvar calendar-month-name-array)
  (defvar calendar-starred-day))

Richard M. Stallman's avatar
Richard M. Stallman committed
107 108
(defun calendar-version ()
  (interactive)
109
  (message "Version 6, October 12, 1995"))
Richard M. Stallman's avatar
Richard M. Stallman committed
110

111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
(defgroup calendar nil
  "Calendar and time management support."
  :group 'applications)

(defgroup diary nil
  "Emacs diary."
  :group 'calendar)

(defgroup appt nil
  "Appointment notification."
  :group 'calendar)

(defgroup holidays nil
  "Holidays support in calendar."
  :group 'calendar
  :prefix "calendar-"
  :group 'local)

(defgroup chinese-calendar nil
  "Chinese calendar support."
  :group 'calendar)

(defgroup calendar-tex nil
  "Options for printing calendar with LaTeX."
  :prefix "cal-tex-"
  :group 'calendar)

(defgroup calendar-hooks nil
  "Calendar hooks."
  :prefix "calendar-"
  :group 'calendar)


144 145 146
(defconst calendar-buffer "*Calendar*"
  "Name of the buffer used for the calendar.")

147
;;;###autoload
148
(defcustom calendar-offset 0
149 150 151
  "*The offset of the principal month from the center of the calendar window.
0 means the principal month is in the center (default), -1 means on the left,
+1 means on the right.  Larger (or smaller) values push the principal month off
152 153 154
the screen."
  :type 'integer
  :group 'calendar)
155

Jim Blandy's avatar
Jim Blandy committed
156
;;;###autoload
157
(defcustom view-diary-entries-initially nil
Glenn Morris's avatar
Glenn Morris committed
158
  "*Non-nil means display current date's diary entries on entry to calendar.
Richard M. Stallman's avatar
Richard M. Stallman committed
159 160
The diary is displayed in another window when the calendar is first displayed,
if the current date is visible.  The number of days of diary entries displayed
Glenn Morris's avatar
Glenn Morris committed
161 162
is governed by the variable `number-of-diary-entries'.  This variable can
be overridden by the value of `calendar-setup'."
163 164
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
165

Jim Blandy's avatar
Jim Blandy committed
166
;;;###autoload
167
(defcustom number-of-diary-entries 1
Richard M. Stallman's avatar
Richard M. Stallman committed
168
  "*Specifies how many days of diary entries are to be displayed initially.
Stefan Monnier's avatar
Stefan Monnier committed
169
This variable affects the diary display when the command \\[diary] is used,
Richard M. Stallman's avatar
Richard M. Stallman committed
170 171 172
or if the value of the variable `view-diary-entries-initially' is t.  For
example, if the default value 1 is used, then only the current day's diary
entries will be displayed.  If the value 2 is used, then both the current
Richard M. Stallman's avatar
Richard M. Stallman committed
173 174 175 176 177 178 179 180 181 182
day's and the next day's entries will be displayed.

The value can also be a vector such as [0 2 2 2 2 4 1]; this value
says to display no diary entries on Sunday, the display the entries
for the current date and the day after on Monday through Thursday,
display Friday through Monday's entries on Friday, and display only
Saturday's entries on Saturday.

This variable does not affect the diary display with the `d' command
from the calendar; in that case, the prefix argument controls the
183 184 185 186 187 188 189 190 191 192 193
number of days of diary entries displayed."
  :type '(choice (integer :tag "Entries")
		 (vector :value [0 0 0 0 0 0 0]
			 (integer :tag "Sunday")
			 (integer :tag "Monday")
			 (integer :tag "Tuesday")
			 (integer :tag "Wednesday")
			 (integer :tag "Thursday")
			 (integer :tag "Friday")
			 (integer :tag "Saturday")))
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
194

Jim Blandy's avatar
Jim Blandy committed
195
;;;###autoload
196
(defcustom mark-diary-entries-in-calendar nil
Richard M. Stallman's avatar
Richard M. Stallman committed
197
  "*Non-nil means mark dates with diary entries, in the calendar window.
198 199 200
The marking symbol is specified by the variable `diary-entry-marker'."
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
201

202 203 204 205 206 207 208
;;;###autoload
(defcustom calendar-remove-frame-by-deleting nil
  "*Determine how the calendar mode removes a frame no longer needed.
If nil, make an icon of the frame.  If non-nil, delete the frame."
  :type 'boolean
  :group 'view)

209 210
(defvar diary-face 'diary-face
  "Face name to use for diary entries.")
211 212
(defface diary-face
  '((((class color) (background light))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
213
     :foreground "red")
214
    (((class color) (background dark))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
215
     :foreground "yellow")
216
    (t
217
     :weight bold))
218 219 220 221 222 223 224 225 226 227
  "Face for highlighting diary entries."
  :group 'diary)

(defface calendar-today-face
  '((t (:underline t)))
  "Face for indicating today's date."
  :group 'diary)

(defface holiday-face
  '((((class color) (background light))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
228
     :background "pink")
229
    (((class color) (background dark))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
230
     :background "chocolate4")
231
    (t
ShengHuo ZHU's avatar
ShengHuo ZHU committed
232
     :inverse-video t))
233 234
  "Face for indicating dates that have holidays."
  :group 'diary)
235

236 237 238 239 240 241
(eval-after-load "facemenu"
  '(progn
     (add-to-list 'facemenu-unlisted-faces 'diary-face)
     (add-to-list 'facemenu-unlisted-faces 'calendar-today-face)
     (add-to-list 'facemenu-unlisted-faces 'holiday-face)))

242
(defcustom diary-entry-marker
243
  (if (not (display-color-p))
244 245
      "+"
    'diary-face)
246 247
  "*How to mark dates that have diary entries.
The value can be either a single-character string or a face."
248 249
  :type '(choice string face)
  :group 'diary)
250

251
(defcustom calendar-today-marker
252
  (if (not (display-color-p))
253 254
      "="
    'calendar-today-face)
255 256 257 258
  "*How to mark today's date in the calendar.
The value can be either a single-character string or a face.
Marking today's date is done only if you set up `today-visible-calendar-hook'
to request that."
259 260
  :type '(choice string face)
  :group 'calendar)
261

262
(defcustom calendar-holiday-marker
263
  (if (not (display-color-p))
264 265
      "*"
    'holiday-face)
266 267
  "*How to mark notable dates in the calendar.
The value can be either a single-character string or a face."
268 269
  :type '(choice string face)
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
270

Jim Blandy's avatar
Jim Blandy committed
271
;;;###autoload
272
(defcustom view-calendar-holidays-initially nil
Richard M. Stallman's avatar
Richard M. Stallman committed
273
  "*Non-nil means display holidays for current three month period on entry.
274
The holidays are displayed in another window when the calendar is first
275 276 277
displayed."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
278

Jim Blandy's avatar
Jim Blandy committed
279
;;;###autoload
280
(defcustom mark-holidays-in-calendar nil
Richard M. Stallman's avatar
Richard M. Stallman committed
281
  "*Non-nil means mark dates of holidays in the calendar window.
282 283 284
The marking symbol is specified by the variable `calendar-holiday-marker'."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
285

Jim Blandy's avatar
Jim Blandy committed
286
;;;###autoload
287
(defcustom all-hebrew-calendar-holidays nil
288
  "*If nil, show only major holidays from the Hebrew calendar.
Richard M. Stallman's avatar
Richard M. Stallman committed
289
This means only those Jewish holidays that appear on secular calendars.
290

291 292 293
If t, show all the holidays that would appear in a complete Hebrew calendar."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
294

Jim Blandy's avatar
Jim Blandy committed
295
;;;###autoload
296
(defcustom all-christian-calendar-holidays nil
297
  "*If nil, show only major holidays from the Christian calendar.
Richard M. Stallman's avatar
Richard M. Stallman committed
298
This means only those Christian holidays that appear on secular calendars.
299

Richard M. Stallman's avatar
Richard M. Stallman committed
300
If t, show all the holidays that would appear in a complete Christian
301 302 303
calendar."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
304

Jim Blandy's avatar
Jim Blandy committed
305
;;;###autoload
306
(defcustom all-islamic-calendar-holidays nil
307
  "*If nil, show only major holidays from the Islamic calendar.
Richard M. Stallman's avatar
Richard M. Stallman committed
308
This means only those Islamic holidays that appear on secular calendars.
309

Richard M. Stallman's avatar
Richard M. Stallman committed
310
If t, show all the holidays that would appear in a complete Islamic
311 312 313
calendar."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
314

315 316
(defcustom diary-file-name-prefix-function (function (lambda (str) str))
  "*The function that will take a diary file name and return the desired prefix."
317
  :type 'function
318 319
  :group 'diary)

320 321 322 323 324 325 326 327 328 329
;;;###autoload
(defcustom all-bahai-calendar-holidays nil
  "*If nil, show only major holidays from the Baha'i calendar.
These are the days on which work and school must be suspended.

If t, show all the holidays that would appear in a complete Baha'i
calendar."
  :type 'boolean
  :group 'holidays)

Jim Blandy's avatar
Jim Blandy committed
330
;;;###autoload
331
(defcustom calendar-load-hook nil
Jim Blandy's avatar
Jim Blandy committed
332
  "*List of functions to be called after the calendar is first loaded.
333 334 335
This is the place to add key bindings to `calendar-mode-map'."
  :type 'hook
  :group 'calendar-hooks)
Jim Blandy's avatar
Jim Blandy committed
336 337

;;;###autoload
338
(defcustom initial-calendar-window-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
339 340 341
  "*List of functions to be called when the calendar window is first opened.
The functions invoked are called after the calendar window is opened, but
once opened is never called again.  Leaving the calendar with the `q' command
342 343 344
and reentering it will cause these functions to be called again."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
345

Jim Blandy's avatar
Jim Blandy committed
346
;;;###autoload
347
(defcustom today-visible-calendar-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
348 349 350 351
  "*List of functions called whenever the current date is visible.
This can be used, for example, to replace today's date with asterisks; a
function `calendar-star-date' is included for this purpose:
    (setq today-visible-calendar-hook 'calendar-star-date)
Richard M. Stallman's avatar
Richard M. Stallman committed
352
It can also be used to mark the current date with `calendar-today-marker';
353
a function is also provided for this:
Richard M. Stallman's avatar
Richard M. Stallman committed
354 355 356 357 358 359 360 361
    (setq today-visible-calendar-hook 'calendar-mark-today)

The corresponding variable `today-invisible-calendar-hook' is the list of
functions called when the calendar function was called when the current
date is not visible in the window.

Other than the use of the provided functions, the changing of any
characters in the calendar buffer by the hooks may cause the failure of the
362 363 364
functions that move by days and weeks."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
365

Jim Blandy's avatar
Jim Blandy committed
366
;;;###autoload
367
(defcustom today-invisible-calendar-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
368 369 370 371 372 373 374 375
  "*List of functions called whenever the current date is not visible.

The corresponding variable `today-visible-calendar-hook' is the list of
functions called when the calendar function was called when the current
date is visible in the window.

Other than the use of the provided functions, the changing of any
characters in the calendar buffer by the hooks may cause the failure of the
376 377 378
functions that move by days and weeks."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
379

380 381 382 383
;;;###autoload
(defcustom calendar-move-hook nil
  "*List of functions called whenever the cursor moves in the calendar.

384
For example,
385 386 387 388 389 390 391

  (add-hook 'calendar-move-hook (lambda () (view-diary-entries 1)))

redisplays the diary for whatever date the cursor is moved to."
  :type 'hook
  :group 'calendar-hooks)

Jim Blandy's avatar
Jim Blandy committed
392
;;;###autoload
393
(defcustom diary-file "~/diary"
Richard M. Stallman's avatar
Richard M. Stallman committed
394 395
  "*Name of the file in which one's personal diary of dates is kept.

396 397
The file's entries are lines beginning with any of the forms
specified by the variable `american-date-diary-pattern', by default:
Richard M. Stallman's avatar
Richard M. Stallman committed
398 399 400 401 402 403 404

            MONTH/DAY
            MONTH/DAY/YEAR
            MONTHNAME DAY
            MONTHNAME DAY, YEAR
            DAYNAME

405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422
with the remainder of the line being the diary entry string for
that date.  MONTH and DAY are one or two digit numbers, YEAR is a
number and may be written in full or abbreviated to the final two
digits (if `abbreviated-calendar-year' is non-nil).  MONTHNAME
and DAYNAME can be spelled in full (as specified by the variables
`calendar-month-name-array' and `calendar-day-name-array'),
abbreviated (as specified by `calendar-month-abbrev-array' and
`calendar-day-abbrev-array') with or without a period,
capitalized or not.  Any of DAY, MONTH, or MONTHNAME, YEAR can be
`*' which matches any day, month, or year, respectively. If the
date does not contain a year, it is generic and applies to any
year.  A DAYNAME entry applies to the appropriate day of the week
in every week.

The European style (in which the day precedes the month) can be
used instead, if you execute `european-calendar' when in the
calendar, or set `european-calendar-style' to t in your .emacs
file.  The European forms (see `european-date-diary-pattern') are
Richard M. Stallman's avatar
Richard M. Stallman committed
423 424 425 426 427 428 429 430 431 432

            DAY/MONTH
            DAY/MONTH/YEAR
            DAY MONTHNAME
            DAY MONTHNAME YEAR
            DAYNAME

To revert to the default American style from the European style, execute
`american-calendar' in the calendar.

Richard M. Stallman's avatar
Richard M. Stallman committed
433 434 435 436
A diary entry can be preceded by the character
`diary-nonmarking-symbol' (ordinarily `&') to make that entry
nonmarking--that is, it will not be marked on dates in the calendar
window but will appear in a diary window.
Richard M. Stallman's avatar
Richard M. Stallman committed
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456

Multiline diary entries are made by indenting lines after the first with
either a TAB or one or more spaces.

Lines not in one the above formats are ignored.  Here are some sample diary
entries (in the default American style):

     12/22/1988 Twentieth wedding anniversary!!
     &1/1. Happy New Year!
     10/22 Ruth's birthday.
     21: Payday
     Tuesday--weekly meeting with grad students at 10am
              Supowit, Shen, Bitner, and Kapoor to attend.
     1/13/89 Friday the thirteenth!!
     &thu 4pm squash game with Lloyd.
     mar 16 Dad's birthday
     April 15, 1989 Income tax due.
     &* 15 time cards due.

If the first line of a diary entry consists only of the date or day name with
Richard M. Stallman's avatar
Richard M. Stallman committed
457 458
no trailing blanks or punctuation, then that line is not displayed in the
diary window; only the continuation lines is shown.  For example, the
Richard M. Stallman's avatar
Richard M. Stallman committed
459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
single diary entry

     02/11/1989
      Bill Blattner visits Princeton today
      2pm Cognitive Studies Committee meeting
      2:30-5:30 Lizzie at Lawrenceville for `Group Initiative'
      4:00pm Jamie Tappenden
      7:30pm Dinner at George and Ed's for Alan Ryan
      7:30-10:00pm dance at Stewart Country Day School

will appear in the diary window without the date line at the beginning.  This
facility allows the diary window to look neater, but can cause confusion if
used with more than one day's entries displayed.

Diary entries can be based on Lisp sexps.  For example, the diary entry

      %%(diary-block 11 1 1990 11 10 1990) Vacation

477 478 479 480 481
causes the diary entry \"Vacation\" to appear from November 1 through
November 10, 1990.  Other functions available are `diary-float',
`diary-anniversary', `diary-cyclic', `diary-day-of-year',
`diary-iso-date', `diary-french-date', `diary-hebrew-date',
`diary-islamic-date', `diary-bahai-date', `diary-mayan-date',
482
`diary-chinese-date', `diary-coptic-date', `diary-ethiopic-date',
483
`diary-persian-date', `diary-yahrzeit', `diary-sunrise-sunset',
484 485 486 487
`diary-phases-of-moon', `diary-parasha', `diary-omer',
`diary-rosh-hodesh', and `diary-sabbath-candles'.  See the
documentation for the function `list-sexp-diary-entries' for more
details.
Richard M. Stallman's avatar
Richard M. Stallman committed
488

489 490 491 492 493
Diary entries based on the Hebrew, the Islamic and/or the Baha'i
calendar are also possible, but because these are somewhat slow, they
are ignored unless you set the `nongregorian-diary-listing-hook' and
the `nongregorian-diary-marking-hook' appropriately.  See the
documentation for these functions for details.
Richard M. Stallman's avatar
Richard M. Stallman committed
494 495

Diary files can contain directives to include the contents of other files; for
496 497 498
details, see the documentation for the variable `list-diary-entries-hook'."
  :type 'file
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
499

Jim Blandy's avatar
Jim Blandy committed
500
;;;###autoload
501 502 503 504
(defcustom diary-nonmarking-symbol "&"
  "*Symbol indicating that a diary entry is not to be marked in the calendar."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
505

Jim Blandy's avatar
Jim Blandy committed
506
;;;###autoload
507 508 509 510
(defcustom hebrew-diary-entry-symbol "H"
  "*Symbol indicating a diary entry according to the Hebrew calendar."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
511

Jim Blandy's avatar
Jim Blandy committed
512
;;;###autoload
513 514 515 516
(defcustom islamic-diary-entry-symbol "I"
  "*Symbol indicating a diary entry according to the Islamic calendar."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
517

518 519 520 521 522 523
;;;###autoload
(defcustom bahai-diary-entry-symbol "B"
  "*Symbol indicating a diary entry according to the Baha'i calendar."
  :type 'string
  :group 'diary)

Jim Blandy's avatar
Jim Blandy committed
524
;;;###autoload
525
(defcustom diary-include-string "#include"
526
  "*The string indicating inclusion of another file of diary entries.
527 528 529
See the documentation for the function `include-other-diary-files'."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
530

531 532 533 534 535
(defcustom diary-glob-file-regexp-prefix "^\\#"
  "*The regular expression that gets pre-pended to each of the attribute-regexp's for file-wide specifiers."
  :type 'regexp
  :group 'diary)

536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
(defcustom diary-face-attrs
  '((" *\\[foreground:\\([-a-z]+\\)\\]$" 1 :foreground string)
    (" *\\[background:\\([-a-z]+\\)\\]$" 1 :background string)
    (" *\\[width:\\([-a-z]+\\)\\]$" 1 :width symbol)
    (" *\\[height:\\([-0-9a-z]+\\)\\]$" 1 :height int)
    (" *\\[weight:\\([-a-z]+\\)\\]$" 1 :weight symbol)
    (" *\\[slant:\\([-a-z]+\\)\\]$" 1 :slant symbol)
    (" *\\[underline:\\([-a-z]+\\)\\]$" 1 :underline stringtnil)
    (" *\\[overline:\\([-a-z]+\\)\\]$" 1 :overline stringtnil)
    (" *\\[strike-through:\\([-a-z]+\\)\\]$" 1 :strike-through stringtnil)
    (" *\\[inverse-video:\\([-a-z]+\\)\\]$" 1 :inverse-video tnil)
    (" *\\[face:\\([-0-9a-z]+\\)\\]$" 1 :face string)
    (" *\\[font:\\([-a-z0-9]+\\)\\]$" 1 :font string)
    ;; Unsupported.
;;;    (" *\\[box:\\([-a-z]+\\)\\]$" 1 :box)
;;;    (" *\\[stipple:\\([-a-z]+\\)\\]$" 1 :stipple)
    )
  "*A list of (regexp regnum attr attrtype) lists where the
regexp says how to find the tag, the regnum says which
parenthetical sub-regexp this regexp looks for, and the attr says
which attribute of the face (or that this _is_ a face) is being
modified."
558 559 560 561
  :type 'sexp
  :group 'diary)

(defcustom diary-file-name-prefix nil
562
  "If non-nil each diary entry is prefixed with the name of the file where it is defined."
563 564 565
  :type 'boolean
  :group 'diary)

Jim Blandy's avatar
Jim Blandy committed
566
;;;###autoload
567
(defcustom sexp-diary-entry-symbol "%%"
Stefan Monnier's avatar
Stefan Monnier committed
568
  "*The string used to indicate a sexp diary entry in `diary-file'.
569 570 571
See the documentation for the function `list-sexp-diary-entries'."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
572

Jim Blandy's avatar
Jim Blandy committed
573
;;;###autoload
574
(defcustom abbreviated-calendar-year t
575
  "*Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
576 577 578
For the Gregorian calendar; similarly for the Hebrew, Islamic and
Baha'i calendars.  If this variable is nil, years must be written in
full."
579 580
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
581

Jim Blandy's avatar
Jim Blandy committed
582
;;;###autoload
583
(defcustom european-calendar-style nil
584 585
  "*Use the European style of dates in the diary and in any displays.
If this variable is t, a date 1/2/1990 would be interpreted as February 1,
586 587
1990.  The default European date styles (see `european-date-diary-pattern')
are
Richard M. Stallman's avatar
Richard M. Stallman committed
588 589 590 591 592 593 594

            DAY/MONTH
            DAY/MONTH/YEAR
            DAY MONTHNAME
            DAY MONTHNAME YEAR
            DAYNAME

595 596
Names can be capitalized or not, written in full (as specified by the
variable `calendar-day-name-array'), or abbreviated (as specified by
Glenn Morris's avatar
Glenn Morris committed
597 598 599 600
`calendar-day-abbrev-array') with or without a period.  To take effect,
this variable should be set before the calendar package and its associates
are loaded.  Otherwise, use one of the functions `european-calendar' or
`american-calendar' to force the appropriate update."
601 602
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
603

Jim Blandy's avatar
Jim Blandy committed
604
;;;###autoload
605
(defcustom american-date-diary-pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
606 607 608 609 610 611
  '((month "/" day "[^/0-9]")
    (month "/" day "/" year "[^0-9]")
    (monthname " *" day "[^,0-9]")
    (monthname " *" day ", *" year "[^0-9]")
    (dayname "\\W"))
  "*List of pseudo-patterns describing the American patterns of date used.
612 613 614 615 616 617 618 619 620 621 622
See the documentation of `diary-date-forms' for an explanation."
  :type '(repeat (choice (cons :tag "Backup"
			       :value (backup . nil)
			       (const backup)
			       (repeat (list :inline t :format "%v"
					     (symbol :tag "Keyword")
					     (choice symbol regexp))))
			 (repeat (list :inline t :format "%v"
				       (symbol :tag "Keyword")
				       (choice symbol regexp)))))
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
623

Jim Blandy's avatar
Jim Blandy committed
624
;;;###autoload
625
(defcustom european-date-diary-pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
626 627
  '((day "/" month "[^/0-9]")
    (day "/" month "/" year "[^0-9]")
628
    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
Richard M. Stallman's avatar
Richard M. Stallman committed
629 630 631
    (day " *" monthname " *" year "[^0-9]")
    (dayname "\\W"))
  "*List of pseudo-patterns describing the European patterns of date used.
632 633 634 635 636 637 638 639 640 641 642 643 644
See the documentation of `diary-date-forms' for an explanation."
  :type '(repeat (choice (cons :tag "Backup"
			       :value (backup . nil)
			       (const backup)
			       (repeat (list :inline t :format "%v"
					     (symbol :tag "Keyword")
					     (choice symbol regexp))))
			 (repeat (list :inline t :format "%v"
				       (symbol :tag "Keyword")
				       (choice symbol regexp)))))
  :group 'diary)

(defcustom diary-date-forms
Richard M. Stallman's avatar
Richard M. Stallman committed
645 646 647 648
  (if european-calendar-style
      european-date-diary-pattern
    american-date-diary-pattern)
  "*List of pseudo-patterns describing the forms of date used in the diary.
Juanma Barranquero's avatar
Juanma Barranquero committed
649
The patterns on the list must be MUTUALLY EXCLUSIVE and should not match
Richard M. Stallman's avatar
Richard M. Stallman committed
650 651 652 653
any portion of the diary entry itself, just the date component.

A pseudo-pattern is a list of regular expressions and the keywords `month',
`day', `year', `monthname', and `dayname'.  The keyword `monthname' will
654 655 656 657 658 659 660 661
match the name of the month (see `calendar-month-name-array'), capitalized
or not, or its user-specified abbreviation (see `calendar-month-abbrev-array'),
followed by a period or not; it will also match `*'.  Similarly, `dayname'
will match the name of the day (see `calendar-day-name-array'), capitalized or
not, or its user-specified abbreviation (see `calendar-day-abbrev-array'),
followed by a period or not.  The keywords `month', `day', and `year' will
match those numerical values, preceded by arbitrarily many zeros; they will
also match `*'.
Richard M. Stallman's avatar
Richard M. Stallman committed
662 663 664 665 666 667 668

The matching of the diary entries with the date forms is done with the
standard syntax table from Fundamental mode, but with the `*' changed so
that it is a word constituent.

If, to be mutually exclusive, a pseudo-pattern must match a portion of the
diary entry itself, the first element of the pattern MUST be `backup'.  This
Jim Blandy's avatar
Jim Blandy committed
669 670
directive causes the date recognizer to back up to the beginning of the
current word of the diary entry, so in no case can the pattern match more than
671 672 673 674 675 676 677 678 679 680 681
a portion of the first word of the diary entry."
  :type '(repeat (choice (cons :tag "Backup"
			       :value (backup . nil)
			       (const backup)
			       (repeat (list :inline t :format "%v"
					     (symbol :tag "Keyword")
					     (choice symbol regexp))))
			 (repeat (list :inline t :format "%v"
				       (symbol :tag "Keyword")
				       (choice symbol regexp)))))
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
682

Jim Blandy's avatar
Jim Blandy committed
683
;;;###autoload
684
(defcustom european-calendar-display-form
Jim Blandy's avatar
Jim Blandy committed
685
  '((if dayname (concat dayname ", ")) day " " monthname " " year)
686
  "*Pseudo-pattern governing the way a date appears in the European style.
687
See the documentation of `calendar-date-display-form' for an explanation."
688 689
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
690

Jim Blandy's avatar
Jim Blandy committed
691
;;;###autoload
692
(defcustom american-calendar-display-form
Jim Blandy's avatar
Jim Blandy committed
693
  '((if dayname (concat dayname ", ")) monthname " " day ", " year)
694
  "*Pseudo-pattern governing the way a date appears in the American style.
695 696 697
See the documentation of `calendar-date-display-form' for an explanation."
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
698

699
(defcustom calendar-date-display-form
Richard M. Stallman's avatar
Richard M. Stallman committed
700 701 702
  (if european-calendar-style
      european-calendar-display-form
    american-calendar-display-form)
703 704 705 706 707 708
  "*Pseudo-pattern governing the way a date appears.

Used by the function `calendar-date-string', a pseudo-pattern is a list of
expressions that can involve the keywords `month', `day', and `year', all
numbers in string form, and `monthname' and `dayname', both alphabetic
strings.  For example, the ISO standard would use the pseudo- pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
709 710 711 712 713 714 715 716 717 718 719 720 721

       '(year \"-\" month \"-\" day)

while a typical American form would be

       '(month \"/\" day \"/\" (substring year -2))

and

       '((format \"%9s, %9s %2s, %4s\" dayname monthname day year))

would give the usual American style in fixed-length fields.

722 723 724
See the documentation of the function `calendar-date-string'."
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741

(defun european-calendar ()
  "Set the interpretation and display of dates to the European style."
  (interactive)
  (setq european-calendar-style t)
  (setq calendar-date-display-form european-calendar-display-form)
  (setq diary-date-forms european-date-diary-pattern)
  (update-calendar-mode-line))

(defun american-calendar ()
  "Set the interpretation and display of dates to the American style."
  (interactive)
  (setq european-calendar-style nil)
  (setq calendar-date-display-form american-calendar-display-form)
  (setq diary-date-forms american-date-diary-pattern)
  (update-calendar-mode-line))

Jim Blandy's avatar
Jim Blandy committed
742
;;;###autoload
743
(defcustom print-diary-entries-hook 'lpr-buffer
744 745 746 747
  "*List of functions called after a temporary diary buffer is prepared.
The buffer shows only the diary entries currently visible in the diary
buffer.  The default just does the printing.  Other uses might include, for
example, rearranging the lines into order by day and time, saving the buffer
748 749 750
instead of deleting it, or changing the function used to do the printing."
  :type 'hook
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
751

Jim Blandy's avatar
Jim Blandy committed
752
;;;###autoload
753
(defcustom list-diary-entries-hook nil
754 755
  "*List of functions called after diary file is culled for relevant entries.
It is to be used for diary entries that are not found in the diary file.
Richard M. Stallman's avatar
Richard M. Stallman committed
756 757 758

A function `include-other-diary-files' is provided for use as the value of
this hook.  This function enables you to use shared diary files together
Richard M. Stallman's avatar
Richard M. Stallman committed
759
with your own.  The files included are specified in the diary file by lines
Richard M. Stallman's avatar
Richard M. Stallman committed
760 761 762 763 764 765 766 767
of the form

        #include \"filename\"

This is recursive; that is, #include directives in files thus included are
obeyed.  You can change the \"#include\" to some other string by changing
the variable `diary-include-string'.  When you use `include-other-diary-files'
as part of the list-diary-entries-hook, you will probably also want to use the
Richard M. Stallman's avatar
Richard M. Stallman committed
768
function `mark-included-diary-files' as part of `mark-diary-entries-hook'.
Richard M. Stallman's avatar
Richard M. Stallman committed
769 770 771 772

For example, you could use

     (setq list-diary-entries-hook
Jim Blandy's avatar
Jim Blandy committed
773
       '(include-other-diary-files sort-diary-entries))
Richard M. Stallman's avatar
Richard M. Stallman committed
774 775
     (setq diary-display-hook 'fancy-diary-display)

Richard M. Stallman's avatar
Richard M. Stallman committed
776
in your `.emacs' file to cause the fancy diary buffer to be displayed with
Richard M. Stallman's avatar
Richard M. Stallman committed
777
diary entries from various included files, each day's entries sorted into
778 779
lexicographic order."
  :type 'hook
780
  :options '(include-other-diary-files sort-diary-entries)
781
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
782

Jim Blandy's avatar
Jim Blandy committed
783
;;;###autoload
784
(defcustom diary-hook nil
785
  "*List of functions called after the display of the diary.
786 787 788
Can be used for appointment notification."
  :type 'hook
  :group 'diary)
789 790

;;;###autoload
791
(defcustom diary-display-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
792
  "*List of functions that handle the display of the diary.
Richard M. Stallman's avatar
Richard M. Stallman committed
793
If nil (the default), `simple-diary-display' is used.  Use `ignore' for no
794
diary display.
Richard M. Stallman's avatar
Richard M. Stallman committed
795 796 797 798 799 800

Ordinarily, this just displays the diary buffer (with holidays indicated in
the mode line), if there are any relevant entries.  At the time these
functions are called, the variable `diary-entries-list' is a list, in order
by date, of all relevant diary entries in the form of ((MONTH DAY YEAR)
STRING), where string is the diary entry for the given date.  This can be
801 802
used, for example, a different buffer for display (perhaps combined with
holidays), or produce hard copy output.
Richard M. Stallman's avatar
Richard M. Stallman committed
803 804 805 806 807 808 809 810

A function `fancy-diary-display' is provided as an alternative
choice for this hook; this function prepares a special noneditable diary
buffer with the relevant diary entries that has neat day-by-day arrangement
with headings.  The fancy diary buffer will show the holidays unless the
variable `holidays-in-diary-buffer' is set to nil.  Ordinarily, the fancy
diary buffer will not show days for which there are no diary entries, even
if that day is a holiday; if you want such days to be shown in the fancy
811 812
diary buffer, set the variable `diary-list-include-blanks' to t."
  :type 'hook
813
  :options '(fancy-diary-display)
814
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
815

Jim Blandy's avatar
Jim Blandy committed
816
;;;###autoload
817
(defcustom nongregorian-diary-listing-hook nil
818
  "*List of functions called for listing diary file and included files.
819 820 821 822
As the files are processed for diary entries, these functions are used
to cull relevant entries.  You can use either or both of
`list-hebrew-diary-entries', `list-islamic-diary-entries' and
`list-bahai-diary-entries'.  The documentation for these functions
823 824
describes the style of such diary entries."
  :type 'hook
825 826 827
  :options '(list-hebrew-diary-entries
	     list-islamic-diary-entries
	     list-bahai-diary-entries)
828
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
829

Jim Blandy's avatar
Jim Blandy committed
830
;;;###autoload
831
(defcustom mark-diary-entries-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
832 833 834
  "*List of functions called after marking diary entries in the calendar.

A function `mark-included-diary-files' is also provided for use as the
Stefan Monnier's avatar
Stefan Monnier committed
835
`mark-diary-entries-hook'; it enables you to use shared diary files together
Richard M. Stallman's avatar
Richard M. Stallman committed
836
with your own.  The files included are specified in the diary file by lines
Richard M. Stallman's avatar
Richard M. Stallman committed
837 838 839 840 841 842
of the form
        #include \"filename\"
This is recursive; that is, #include directives in files thus included are
obeyed.  You can change the \"#include\" to some other string by changing the
variable `diary-include-string'.  When you use `mark-included-diary-files' as
part of the mark-diary-entries-hook, you will probably also want to use the
843 844
function `include-other-diary-files' as part of `list-diary-entries-hook'."
  :type 'hook
845
  :options '(mark-included-diary-files)
846
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
847

Jim Blandy's avatar
Jim Blandy committed
848
;;;###autoload
849
(defcustom nongregorian-diary-marking-hook nil
850
  "*List of functions called for marking diary file and included files.
851 852 853 854
As the files are processed for diary entries, these functions are used
to cull relevant entries.  You can use either or both of
`mark-hebrew-diary-entries', `mark-islamic-diary-entries' and
`mark-bahai-diary-entries'.  The documentation for these functions
855 856
describes the style of such diary entries."
  :type 'hook
857 858 859
  :options '(mark-hebrew-diary-entries
	     mark-islamic-diary-entries
	     mark-bahai-diary-entries)
860
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
861

Jim Blandy's avatar
Jim Blandy committed
862
;;;###autoload
863
(defcustom diary-list-include-blanks nil
864
  "*If nil, do not include days with no diary entry in the list of diary entries.
865
Such days will then not be shown in the fancy diary buffer, even if they
866 867 868
are holidays."
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
869

Jim Blandy's avatar
Jim Blandy committed
870
;;;###autoload
871
(defcustom holidays-in-diary-buffer t
Richard M. Stallman's avatar
Richard M. Stallman committed
872 873
  "*Non-nil means include holidays in the diary display.
The holidays appear in the mode line of the diary buffer, or in the
874
fancy diary buffer next to the date.  This slows down the diary functions
875 876 877
somewhat; setting it to nil makes the diary display faster."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
878

879 880
(defvar calendar-mark-ring nil)

Richard M. Stallman's avatar
Richard M. Stallman committed
881 882
;;;###autoload
(put 'general-holidays 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
883
;;;###autoload
884
(defcustom general-holidays
885 886
  '((holiday-fixed 1 1 "New Year's Day")
    (holiday-float 1 1 3 "Martin Luther King Day")
Edward M. Reingold's avatar
Edward M. Reingold committed
887
    (holiday-fixed 2 2 "Groundhog Day")
888 889 890
    (holiday-fixed 2 14 "Valentine's Day")
    (holiday-float 2 1 3 "President's Day")
    (holiday-fixed 3 17 "St. Patrick's Day")
Edward M. Reingold's avatar
Edward M. Reingold committed
891
    (holiday-fixed 4 1 "April Fools' Day")
892 893 894 895 896 897 898 899 900 901 902
    (holiday-float 5 0 2 "Mother's Day")
    (holiday-float 5 1 -1 "Memorial Day")
    (holiday-fixed 6 14 "Flag Day")
    (holiday-float 6 0 3 "Father's Day")
    (holiday-fixed 7 4 "Independence Day")
    (holiday-float 9 1 1 "Labor Day")
    (holiday-float 10 1 2 "Columbus Day")
    (holiday-fixed 10 31 "Halloween")
    (holiday-fixed 11 11 "Veteran's Day")
    (holiday-float 11 4 4 "Thanksgiving"))
  "*General holidays.  Default value is for the United States.
903 904 905
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
906

907 908 909
;;;###autoload
(put 'oriental-holidays 'risky-local-variable t)
;;;###autoload
910
(defcustom oriental-holidays
911 912 913
  '((if (fboundp 'atan)
	(holiday-chinese-new-year)))
  "*Oriental holidays.
914 915 916
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
917

Richard M. Stallman's avatar
Richard M. Stallman committed
918 919
;;;###autoload
(put 'local-holidays 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
920
;;;###autoload
921
(defcustom local-holidays nil
Jim Blandy's avatar
Jim Blandy committed
922
  "*Local holidays.
923 924 925
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Jim Blandy's avatar
Jim Blandy committed
926

Richard M. Stallman's avatar
Richard M. Stallman committed
927 928
;;;###autoload
(put 'other-holidays 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
929
;;;###autoload
930
(defcustom other-holidays nil
Jim Blandy's avatar
Jim Blandy committed
931
  "*User defined holidays.
932 933 934
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
935

Richard M. Stallman's avatar
Richard M. Stallman committed
936 937
;;;###autoload
(put 'hebrew-holidays-1 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
938
;;;###autoload
939
(defvar hebrew-holidays-1
940
  '((holiday-rosh-hashanah-etc)
Richard M. Stallman's avatar
Richard M. Stallman committed
941
    (if all-hebrew-calendar-holidays
942 943 944 945 946 947 948 949 950 951 952 953
        (holiday-julian
         11
         (let* ((m displayed-month)
                (y displayed-year)
                (year))
           (increment-calendar-month m y -1)
           (let ((year (extract-calendar-year
                        (calendar-julian-from-absolute
                         (calendar-absolute-from-gregorian
                          (list m 1 y))))))
             (if (zerop (% (1+ year) 4))
                 22
954 955
               21))) "\"Tal Umatar\" (evening)"))))

Richard M. Stallman's avatar
Richard M. Stallman committed
956 957
;;;###autoload
(put 'hebrew-holidays-2 'risky-local-variable t)
958 959 960
;;;###autoload
(defvar hebrew-holidays-2
  '((if all-hebrew-calendar-holidays
961 962
        (holiday-hanukkah)
      (holiday-hebrew 9 25 "Hanukkah"))
Richard M. Stallman's avatar
Richard M. Stallman committed
963
    (if all-hebrew-calendar-holidays
964 965 966 967 968 969 970