calendar.el 115 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,
Glenn Morris's avatar
Glenn Morris committed
4
;;	2000, 2001, 2003, 2004 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>
Eric S. Raymond's avatar
Eric S. Raymond committed
7
;; Keywords: calendar
8
;; Human-Keywords: calendar, Gregorian calendar, diary, holidays
Eric S. Raymond's avatar
Eric S. Raymond committed
9

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

Richard M. Stallman's avatar
Richard M. Stallman committed
12 13 14 15 16
;; 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
17
;; GNU Emacs is distributed in the hope that it will be useful,
Richard M. Stallman's avatar
Richard M. Stallman committed
18 19 20 21 22
;; 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
23 24 25
;; 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
26

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

29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
;; 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 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
49
;; available.  Calendar printing via LaTeX is available.
Jim Blandy's avatar
Jim Blandy committed
50 51 52

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

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

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

76
;; An earlier version of the technical details appeared in
Richard M. Stallman's avatar
Richard M. Stallman committed
77 78
;; ``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
79 80
;; pages 899-928.  ``Calendrical Calculations, Part II: Three Historical
;; Calendars'' by E. M. Reingold,  N. Dershowitz, and S. M. Clamen,
81 82
;; Software--Practice and Experience, Volume 23, Number 4 (April, 1993),
;; pages 383-404.
Jim Blandy's avatar
Jim Blandy committed
83 84 85 86

;; 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
87

88 89 90 91 92 93
;; 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
94
;;; Code:
Richard M. Stallman's avatar
Richard M. Stallman committed
95

96
(eval-when-compile
97 98 99 100 101
  (defvar displayed-month)
  (defvar displayed-year)
  (defvar calendar-month-name-array)
  (defvar calendar-starred-day))

Richard M. Stallman's avatar
Richard M. Stallman committed
102 103
(defun calendar-version ()
  (interactive)
104
  (message "Version 6, October 12, 1995"))
Richard M. Stallman's avatar
Richard M. Stallman committed
105

106 107 108 109 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
(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)


139
;;;###autoload
140
(defcustom calendar-week-start-day 0
141
  "*The day of the week on which a week in the calendar begins.
142 143 144
0 means Sunday (default), 1 means Monday, and so on."
  :type 'integer
  :group 'calendar)
145

146
;;;###autoload
147
(defcustom calendar-offset 0
148 149 150
  "*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
151 152 153
the screen."
  :type 'integer
  :group 'calendar)
154

Jim Blandy's avatar
Jim Blandy committed
155
;;;###autoload
156
(defcustom view-diary-entries-initially nil
Glenn Morris's avatar
Glenn Morris committed
157
  "*Non-nil means display current date's diary entries on entry to calendar.
Richard M. Stallman's avatar
Richard M. Stallman committed
158 159
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
160 161
is governed by the variable `number-of-diary-entries'.  This variable can
be overridden by the value of `calendar-setup'."
162 163
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
164

Jim Blandy's avatar
Jim Blandy committed
165
;;;###autoload
166
(defcustom number-of-diary-entries 1
Richard M. Stallman's avatar
Richard M. Stallman committed
167
  "*Specifies how many days of diary entries are to be displayed initially.
Stefan Monnier's avatar
Stefan Monnier committed
168
This variable affects the diary display when the command \\[diary] is used,
Richard M. Stallman's avatar
Richard M. Stallman committed
169 170 171
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
172 173 174 175 176 177 178 179 180 181
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
182 183 184 185 186 187 188 189 190 191 192
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
193

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

201 202 203 204 205 206 207
;;;###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)

208 209
(defvar diary-face 'diary-face
  "Face name to use for diary entries.")
210 211
(defface diary-face
  '((((class color) (background light))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
212
     :foreground "red")
213
    (((class color) (background dark))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
214
     :foreground "yellow")
215
    (t
216
     :weight bold))
217 218 219 220 221 222 223 224 225 226
  "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
227
     :background "pink")
228
    (((class color) (background dark))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
229
     :background "chocolate4")
230
    (t
ShengHuo ZHU's avatar
ShengHuo ZHU committed
231
     :inverse-video t))
232 233
  "Face for indicating dates that have holidays."
  :group 'diary)
234

235 236 237 238 239 240
(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)))

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

250
(defcustom calendar-today-marker
251
  (if (not (display-color-p))
252 253
      "="
    'calendar-today-face)
254 255 256 257
  "*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."
258 259
  :type '(choice string face)
  :group 'calendar)
260

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

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

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

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

290 291 292
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
293

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

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

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

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

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

Jim Blandy's avatar
Jim Blandy committed
319
;;;###autoload
320
(defcustom calendar-load-hook nil
Jim Blandy's avatar
Jim Blandy committed
321
  "*List of functions to be called after the calendar is first loaded.
322 323 324
This is the place to add key bindings to `calendar-mode-map'."
  :type 'hook
  :group 'calendar-hooks)
Jim Blandy's avatar
Jim Blandy committed
325 326

;;;###autoload
327
(defcustom initial-calendar-window-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
328 329 330
  "*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
331 332 333
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
334

Jim Blandy's avatar
Jim Blandy committed
335
;;;###autoload
336
(defcustom today-visible-calendar-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
337 338 339 340
  "*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
341
It can also be used to mark the current date with `calendar-today-marker';
342
a function is also provided for this:
Richard M. Stallman's avatar
Richard M. Stallman committed
343 344 345 346 347 348 349 350
    (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
351 352 353
functions that move by days and weeks."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
354

Jim Blandy's avatar
Jim Blandy committed
355
;;;###autoload
356
(defcustom today-invisible-calendar-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
357 358 359 360 361 362 363 364
  "*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
365 366 367
functions that move by days and weeks."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
368

369 370 371 372
;;;###autoload
(defcustom calendar-move-hook nil
  "*List of functions called whenever the cursor moves in the calendar.

373
For example,
374 375 376 377 378 379 380

  (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
381
;;;###autoload
382
(defcustom diary-file "~/diary"
Richard M. Stallman's avatar
Richard M. Stallman committed
383 384
  "*Name of the file in which one's personal diary of dates is kept.

385 386
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
387 388 389 390 391 392 393

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

394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
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
412 413 414 415 416 417 418 419 420 421

            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
422 423 424 425
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
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445

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
446 447
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
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
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

466 467 468 469
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-mayan-date',
470
`diary-chinese-date', `diary-coptic-date', `diary-ethiopic-date',
471
`diary-persian-date', `diary-yahrzeit', `diary-sunrise-sunset',
472 473 474
`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
475

476 477 478 479 480
Diary entries based on the Hebrew and/or the Islamic 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
481 482

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

Jim Blandy's avatar
Jim Blandy committed
487
;;;###autoload
488 489 490 491
(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
492

Jim Blandy's avatar
Jim Blandy committed
493
;;;###autoload
494 495 496 497
(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
498

Jim Blandy's avatar
Jim Blandy committed
499
;;;###autoload
500 501 502 503
(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
504

Jim Blandy's avatar
Jim Blandy committed
505
;;;###autoload
506
(defcustom diary-include-string "#include"
507
  "*The string indicating inclusion of another file of diary entries.
508 509 510
See the documentation for the function `include-other-diary-files'."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
511

512 513 514 515 516
(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)

517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538
(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."
539 540 541 542
  :type 'sexp
  :group 'diary)

(defcustom diary-file-name-prefix nil
543
  "If non-nil each diary entry is prefixed with the name of the file where it is defined."
544 545 546
  :type 'boolean
  :group 'diary)

Jim Blandy's avatar
Jim Blandy committed
547
;;;###autoload
548
(defcustom sexp-diary-entry-symbol "%%"
Stefan Monnier's avatar
Stefan Monnier committed
549
  "*The string used to indicate a sexp diary entry in `diary-file'.
550 551 552
See the documentation for the function `list-sexp-diary-entries'."
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
553

Jim Blandy's avatar
Jim Blandy committed
554
;;;###autoload
555
(defcustom abbreviated-calendar-year t
556
  "*Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
557 558
For the Gregorian calendar; similarly for the Hebrew and Islamic calendars.
If this variable is nil, years must be written in full."
559 560
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
561

Jim Blandy's avatar
Jim Blandy committed
562
;;;###autoload
563
(defcustom european-calendar-style nil
564 565
  "*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,
566 567
1990.  The default European date styles (see `european-date-diary-pattern')
are
Richard M. Stallman's avatar
Richard M. Stallman committed
568 569 570 571 572 573 574

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

575 576
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
577 578 579 580
`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."
581 582
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
583

Jim Blandy's avatar
Jim Blandy committed
584
;;;###autoload
585
(defcustom american-date-diary-pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
586 587 588 589 590 591
  '((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.
592 593 594 595 596 597 598 599 600 601 602
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
603

Jim Blandy's avatar
Jim Blandy committed
604
;;;###autoload
605
(defcustom european-date-diary-pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
606 607
  '((day "/" month "[^/0-9]")
    (day "/" month "/" year "[^0-9]")
608
    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
Richard M. Stallman's avatar
Richard M. Stallman committed
609 610 611
    (day " *" monthname " *" year "[^0-9]")
    (dayname "\\W"))
  "*List of pseudo-patterns describing the European patterns of date used.
612 613 614 615 616 617 618 619 620 621 622 623 624
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
625 626 627 628
  (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
629
The patterns on the list must be MUTUALLY EXCLUSIVE and should not match
Richard M. Stallman's avatar
Richard M. Stallman committed
630 631 632 633
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
634 635 636 637 638 639 640 641
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
642 643 644 645 646 647 648

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
649 650
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
651 652 653 654 655 656 657 658 659 660 661
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
662

Jim Blandy's avatar
Jim Blandy committed
663
;;;###autoload
664
(defcustom european-calendar-display-form
Jim Blandy's avatar
Jim Blandy committed
665
  '((if dayname (concat dayname ", ")) day " " monthname " " year)
666
  "*Pseudo-pattern governing the way a date appears in the European style.
667
See the documentation of `calendar-date-display-form' for an explanation."
668 669
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
670

Jim Blandy's avatar
Jim Blandy committed
671
;;;###autoload
672
(defcustom american-calendar-display-form
Jim Blandy's avatar
Jim Blandy committed
673
  '((if dayname (concat dayname ", ")) monthname " " day ", " year)
674
  "*Pseudo-pattern governing the way a date appears in the American style.
675 676 677
See the documentation of `calendar-date-display-form' for an explanation."
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
678

679
(defcustom calendar-date-display-form
Richard M. Stallman's avatar
Richard M. Stallman committed
680 681 682
  (if european-calendar-style
      european-calendar-display-form
    american-calendar-display-form)
683 684 685 686 687 688
  "*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
689 690 691 692 693 694 695 696 697 698 699 700 701

       '(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.

702 703 704
See the documentation of the function `calendar-date-string'."
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721

(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
722
;;;###autoload
723
(defcustom print-diary-entries-hook 'lpr-buffer
724 725 726 727
  "*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
728 729 730
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
731

Jim Blandy's avatar
Jim Blandy committed
732
;;;###autoload
733
(defcustom list-diary-entries-hook nil
734 735
  "*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
736 737 738

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
739
with your own.  The files included are specified in the diary file by lines
Richard M. Stallman's avatar
Richard M. Stallman committed
740 741 742 743 744 745 746 747
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
748
function `mark-included-diary-files' as part of `mark-diary-entries-hook'.
Richard M. Stallman's avatar
Richard M. Stallman committed
749 750 751 752

For example, you could use

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

Richard M. Stallman's avatar
Richard M. Stallman committed
756
in your `.emacs' file to cause the fancy diary buffer to be displayed with
Richard M. Stallman's avatar
Richard M. Stallman committed
757
diary entries from various included files, each day's entries sorted into
758 759
lexicographic order."
  :type 'hook
760
  :options '(include-other-diary-files sort-diary-entries)
761
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
762

Jim Blandy's avatar
Jim Blandy committed
763
;;;###autoload
764
(defcustom diary-hook nil
765
  "*List of functions called after the display of the diary.
766 767 768
Can be used for appointment notification."
  :type 'hook
  :group 'diary)
769 770

;;;###autoload
771
(defcustom diary-display-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
772
  "*List of functions that handle the display of the diary.
Richard M. Stallman's avatar
Richard M. Stallman committed
773
If nil (the default), `simple-diary-display' is used.  Use `ignore' for no
774
diary display.
Richard M. Stallman's avatar
Richard M. Stallman committed
775 776 777 778 779 780

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
781 782
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
783 784 785 786 787 788 789 790

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
791 792
diary buffer, set the variable `diary-list-include-blanks' to t."
  :type 'hook
793
  :options '(fancy-diary-display)
794
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
795

Jim Blandy's avatar
Jim Blandy committed
796
;;;###autoload
797
(defcustom nongregorian-diary-listing-hook nil
798
  "*List of functions called for listing diary file and included files.
799 800 801
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'
and `list-islamic-diary-entries'.  The documentation for these functions
802 803
describes the style of such diary entries."
  :type 'hook
804
  :options '(list-hebrew-diary-entries list-islamic-diary-entries)
805
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
806

Jim Blandy's avatar
Jim Blandy committed
807
;;;###autoload
808
(defcustom mark-diary-entries-hook nil
Richard M. Stallman's avatar
Richard M. Stallman committed
809 810 811
  "*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
812
`mark-diary-entries-hook'; it enables you to use shared diary files together
Richard M. Stallman's avatar
Richard M. Stallman committed
813
with your own.  The files included are specified in the diary file by lines
Richard M. Stallman's avatar
Richard M. Stallman committed
814 815 816 817 818 819
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
820 821
function `include-other-diary-files' as part of `list-diary-entries-hook'."
  :type 'hook
822
  :options '(mark-included-diary-files)
823
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
824

Jim Blandy's avatar
Jim Blandy committed
825
;;;###autoload
826
(defcustom nongregorian-diary-marking-hook nil
827
  "*List of functions called for marking diary file and included files.
828 829 830
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'
and `mark-islamic-diary-entries'.  The documentation for these functions
831 832
describes the style of such diary entries."
  :type 'hook
833
  :options '(mark-hebrew-diary-entries mark-islamic-diary-entries)
834
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
835

Jim Blandy's avatar
Jim Blandy committed
836
;;;###autoload
837
(defcustom diary-list-include-blanks nil
838
  "*If nil, do not include days with no diary entry in the list of diary entries.
839
Such days will then not be shown in the fancy diary buffer, even if they
840 841 842
are holidays."
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
843

Jim Blandy's avatar
Jim Blandy committed
844
;;;###autoload
845
(defcustom holidays-in-diary-buffer t
Richard M. Stallman's avatar
Richard M. Stallman committed
846 847
  "*Non-nil means include holidays in the diary display.
The holidays appear in the mode line of the diary buffer, or in the
848
fancy diary buffer next to the date.  This slows down the diary functions
849 850 851
somewhat; setting it to nil makes the diary display faster."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
852

853 854
(defvar calendar-mark-ring nil)

Richard M. Stallman's avatar
Richard M. Stallman committed
855 856
;;;###autoload
(put 'general-holidays 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
857
;;;###autoload
858
(defcustom general-holidays
859 860
  '((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
861
    (holiday-fixed 2 2 "Groundhog Day")
862 863 864
    (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
865
    (holiday-fixed 4 1 "April Fools' Day")
866 867 868 869 870 871 872 873 874 875 876
    (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.
877 878 879
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
880

881 882 883
;;;###autoload
(put 'oriental-holidays 'risky-local-variable t)
;;;###autoload
884
(defcustom oriental-holidays
885 886 887
  '((if (fboundp 'atan)
	(holiday-chinese-new-year)))
  "*Oriental holidays.
888 889 890
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
891

Richard M. Stallman's avatar
Richard M. Stallman committed
892 893
;;;###autoload
(put 'local-holidays 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
894
;;;###autoload
895
(defcustom local-holidays nil
Jim Blandy's avatar
Jim Blandy committed
896
  "*Local holidays.
897 898 899
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Jim Blandy's avatar
Jim Blandy committed
900

Richard M. Stallman's avatar
Richard M. Stallman committed
901 902
;;;###autoload
(put 'other-holidays 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
903
;;;###autoload
904
(defcustom other-holidays nil
Jim Blandy's avatar
Jim Blandy committed
905
  "*User defined holidays.
906 907 908
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
909

Richard M. Stallman's avatar
Richard M. Stallman committed
910 911
;;;###autoload
(put 'hebrew-holidays-1 'risky-local-variable t)
Jim Blandy's avatar
Jim Blandy committed
912
;;;###autoload
913
(defvar hebrew-holidays-1
914
  '((holiday-rosh-hashanah-etc)
Richard M. Stallman's avatar
Richard M. Stallman committed
915
    (if all-hebrew-calendar-holidays
916 917 918 919 920 921 922 923 924 925 926 927
        (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
928 929
               21))) "\"Tal Umatar\" (evening)"))))

Richard M. Stallman's avatar
Richard M. Stallman committed
930 931
;;;###autoload
(put 'hebrew-holidays-2 'risky-local-variable t)
932 933 934
;;;###autoload
(defvar hebrew-holidays-2
  '((if all-hebrew-calendar-holidays
935 936
        (holiday-hanukkah)
      (holiday-hebrew 9 25 "Hanukkah"))
Richard M. Stallman's avatar
Richard M. Stallman committed
937
    (if all-hebrew-calendar-holidays
938 939 940 941 942 943 944 945 946 947 948
      (holiday-hebrew
       10
       (let ((h-year (extract-calendar-year
                      (calendar-hebrew-from-absolute
                       (calendar-absolute-from-gregorian
                        (list displayed-month 28 displayed-year))))))
         (if (= (% (calendar-absolute-from-hebrew (list 10 10 h-year))
                   7)
                6)
             11 10))
       "Tzom Teveth"))
Richard M. Stallman's avatar
Richard M. Stallman committed
949
    (if all-hebrew-calendar-holidays
950 951
        (holiday-hebrew 11 15 "Tu B'Shevat"))))

Richard M. Stallman's avatar
Richard M. Stallman committed
952 953
;;;###autoload
(put 'hebrew-holidays-3 'risky-local-variable t)