calendar.el 105 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,
Miles Bader's avatar
Miles Bader committed
4
;;   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Glenn Morris's avatar
Glenn Morris committed
5
;;   Free Software Foundation, Inc.
Eric S. Raymond's avatar
Eric S. Raymond committed
6

Eric S. Raymond's avatar
Eric S. Raymond committed
7
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
8
;; Maintainer: Glenn Morris <rgm@gnu.org>
Eric S. Raymond's avatar
Eric S. Raymond committed
9
;; Keywords: calendar
10
;; Human-Keywords: calendar, Gregorian calendar, diary, holidays
Eric S. Raymond's avatar
Eric S. Raymond committed
11

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

Richard M. Stallman's avatar
Richard M. Stallman committed
14 15
;; 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
16
;; the Free Software Foundation; either version 3, or (at your option)
Richard M. Stallman's avatar
Richard M. Stallman committed
17 18
;; any later version.

Richard M. Stallman's avatar
Richard M. Stallman committed
19
;; GNU Emacs is distributed in the hope that it will be useful,
Richard M. Stallman's avatar
Richard M. Stallman committed
20 21 22 23 24
;; 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
25
;; along with GNU Emacs; see the file COPYING.  If not, write to the
Lute Kamstra's avatar
Lute Kamstra committed
26 27
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
Richard M. Stallman's avatar
Richard M. Stallman committed
28

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

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

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

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

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

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

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

Eric S. Raymond's avatar
Eric S. Raymond committed
94
;;; Code:
Richard M. Stallman's avatar
Richard M. Stallman committed
95

96 97
(defvar displayed-month)
(defvar displayed-year)
98 99 100 101

(require 'cal-loaddefs)
(require 'cal-menu)

102

103 104 105 106
(defgroup calendar nil
  "Calendar and time management support."
  :group 'applications)

107 108 109
(defgroup calendar-hooks nil
  "Calendar hooks."
  :prefix "calendar-"
110 111
  :group 'calendar)

112 113
(defgroup diary nil
  "Emacs diary."
114 115 116 117 118 119 120 121 122
  :group 'calendar)

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


123 124 125 126 127 128
(defcustom calendar-offset 0
  "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
the screen."
  :type 'integer
129 130
  :group 'calendar)

131 132 133 134 135 136 137 138 139 140 141 142
(defcustom calendar-setup nil
  "The frame setup of the calendar.
The choices are: `one-frame' (calendar and diary together in one separate,
dedicated frame); `two-frames' (calendar and diary in separate, dedicated
frames); `calendar-only' (calendar in a separate, dedicated frame); with
any other value the current frame is used.  Using any of the first
three options overrides the value of `view-diary-entries-initially'."
  :type '(choice
          (const :tag "calendar and diary in separate frame" one-frame)
          (const :tag "calendar and diary each in own frame" two-frames)
          (const :tag "calendar in separate frame" calendar-only)
          (const :tag "use current frame" nil))
143 144
  :group 'calendar)

145 146 147 148 149
(defcustom calendar-minimum-window-height 8
  "Minimum height `generate-calendar-window' should use for calendar window."
  :type 'integer
  :version "22.1"
  :group 'calendar)
150

151 152 153
(defcustom calendar-week-start-day 0
  "The day of the week on which a week in the calendar begins.
0 means Sunday (default), 1 means Monday, and so on.
154

155 156 157 158
If you change this variable directly (without using customize)
after starting `calendar', you should call `redraw-calendar' to
update the calendar display to reflect the change, otherwise
movement commands will not work correctly."
159
  :type 'integer
160 161 162 163 164 165 166
  ;; Change the initialize so that if you reload calendar.el, it will not
  ;; cause a redraw (which may fail, e.g. with "invalid byte-code in
  ;; calendar.elc" because of the "byte-compile-dynamic").
  :initialize 'custom-initialize-default
  :set (lambda (sym val)
         (set sym val)
         (redraw-calendar))
167
  :group 'calendar)
168

169
(defcustom view-diary-entries-initially nil
170
  "Non-nil means display current date's diary entries on entry to calendar.
Richard M. Stallman's avatar
Richard M. Stallman committed
171 172
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
173 174
is governed by the variable `number-of-diary-entries'.  This variable can
be overridden by the value of `calendar-setup'."
175 176
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
177

178
(defcustom mark-diary-entries-in-calendar nil
179
  "Non-nil means mark dates with diary entries, in the calendar window.
180 181 182
The marking symbol is specified by the variable `diary-entry-marker'."
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
183

184
(defcustom calendar-remove-frame-by-deleting nil
185
  "Determine how the calendar mode removes a frame no longer needed.
186 187 188 189
If nil, make an icon of the frame.  If non-nil, delete the frame."
  :type 'boolean
  :group 'view)

190 191 192 193 194 195 196
(defface calendar-today
  '((t (:underline t)))
  "Face for indicating today's date."
  :group 'diary)
;; Backward-compatibility alias.  FIXME make obsolete.
(put 'calendar-today-face 'face-alias 'calendar-today)

197
(defface diary
198 199 200
  '((((min-colors 88) (class color) (background light))
     :foreground "red1")
    (((class color) (background light))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
201
     :foreground "red")
202 203
    (((min-colors 88) (class color) (background dark))
     :foreground "yellow1")
204
    (((class color) (background dark))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
205
     :foreground "yellow")
206
    (t
207
     :weight bold))
208 209
  "Face for highlighting diary entries."
  :group 'diary)
210
;; Backward-compatibility alias. FIXME make obsolete.
211
(put 'diary-face 'face-alias 'diary)
212

213
(defface holiday
214
  '((((class color) (background light))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
215
     :background "pink")
216
    (((class color) (background dark))
ShengHuo ZHU's avatar
ShengHuo ZHU committed
217
     :background "chocolate4")
218
    (t
ShengHuo ZHU's avatar
ShengHuo ZHU committed
219
     :inverse-video t))
220 221
  "Face for indicating dates that have holidays."
  :group 'diary)
222
;; Backward-compatibility alias.  FIXME make obsolete.
223
(put 'holiday-face 'face-alias 'holiday)
224

225
(defcustom diary-entry-marker (if (display-color-p) 'diary "+")
226
  "How to mark dates that have diary entries.
227
The value can be either a single-character string or a face."
228 229
  :type '(choice string face)
  :group 'diary)
230

231
(defcustom calendar-today-marker (if (display-color-p) 'calendar-today "=")
232
  "How to mark today's date in the calendar.
233 234 235
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."
236 237
  :type '(choice string face)
  :group 'calendar)
238

239
(defcustom calendar-holiday-marker (if (display-color-p) 'holiday "*")
240
  "How to mark notable dates in the calendar.
241
The value can be either a single-character string or a face."
242 243
  :type '(choice string face)
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
244

245
(defcustom view-calendar-holidays-initially nil
246
  "Non-nil means display holidays for current three month period on entry.
247
The holidays are displayed in another window when the calendar is first
248 249 250
displayed."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
251

252
(defcustom mark-holidays-in-calendar nil
253
  "Non-nil means mark dates of holidays in the calendar window.
254 255 256
The marking symbol is specified by the variable `calendar-holiday-marker'."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
257

258 259 260 261 262
(defcustom calendar-mode-hook nil
  "Hook run when entering `calendar-mode'."
  :type 'hook
  :group 'calendar-hooks)

263
(defcustom calendar-load-hook nil
264
  "List of functions to be called after the calendar is first loaded.
265 266 267
This is the place to add key bindings to `calendar-mode-map'."
  :type 'hook
  :group 'calendar-hooks)
Jim Blandy's avatar
Jim Blandy committed
268

269
(defcustom initial-calendar-window-hook nil
270
  "List of functions to be called when the calendar window is first opened.
Richard M. Stallman's avatar
Richard M. Stallman committed
271 272
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
273 274 275
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
276

277
(defcustom today-visible-calendar-hook nil
278
  "List of functions called whenever the current date is visible.
Richard M. Stallman's avatar
Richard M. Stallman committed
279 280 281
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
282
It can also be used to mark the current date with `calendar-today-marker';
283
a function is also provided for this:
Richard M. Stallman's avatar
Richard M. Stallman committed
284 285 286 287 288 289 290 291
    (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
292 293 294
functions that move by days and weeks."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
295

296
(defcustom today-invisible-calendar-hook nil
297
  "List of functions called whenever the current date is not visible.
Richard M. Stallman's avatar
Richard M. Stallman committed
298 299 300 301 302 303 304

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
305 306 307
functions that move by days and weeks."
  :type 'hook
  :group 'calendar-hooks)
Richard M. Stallman's avatar
Richard M. Stallman committed
308

309
(defcustom calendar-move-hook nil
310
  "List of functions called whenever the cursor moves in the calendar.
311

312
For example,
313

314
  (add-hook 'calendar-move-hook (lambda () (diary-view-entries 1)))
315 316 317 318 319

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

Jim Blandy's avatar
Jim Blandy committed
320
;;;###autoload
321
(defcustom diary-file "~/diary"
322
  "Name of the file in which one's personal diary of dates is kept.
Richard M. Stallman's avatar
Richard M. Stallman committed
323

324 325
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
326 327 328 329 330 331 332

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

333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350
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
351 352 353 354 355 356 357 358 359 360

            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
361 362 363 364
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
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384

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
385 386
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
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
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

405 406 407 408 409
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',
410
`diary-chinese-date', `diary-coptic-date', `diary-ethiopic-date',
411
`diary-persian-date', `diary-yahrzeit', `diary-sunrise-sunset',
412 413 414 415
`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
416

417 418 419 420 421
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
422 423

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

428
(defcustom diary-nonmarking-symbol "&"
429
  "Symbol indicating that a diary entry is not to be marked in the calendar."
430 431
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
432

433
(defcustom hebrew-diary-entry-symbol "H"
434
  "Symbol indicating a diary entry according to the Hebrew calendar."
435 436
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
437

438
(defcustom islamic-diary-entry-symbol "I"
439
  "Symbol indicating a diary entry according to the Islamic calendar."
440 441
  :type 'string
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
442

443
(defcustom bahai-diary-entry-symbol "B"
444
  "Symbol indicating a diary entry according to the Baha'i calendar."
445 446 447
  :type 'string
  :group 'diary)

448
(defcustom abbreviated-calendar-year t
449
  "Interpret a two-digit year DD in a diary entry as either 19DD or 20DD.
450 451 452
For the Gregorian calendar; similarly for the Hebrew, Islamic and
Baha'i calendars.  If this variable is nil, years must be written in
full."
453 454
  :type 'boolean
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
455

Jim Blandy's avatar
Jim Blandy committed
456
;;;###autoload
457
(defcustom european-calendar-style nil
458
  "Use the European style of dates in the diary and in any displays.
459
If this variable is t, a date 1/2/1990 would be interpreted as February 1,
460 461
1990.  The default European date styles (see `european-date-diary-pattern')
are
Richard M. Stallman's avatar
Richard M. Stallman committed
462 463 464 465 466 467 468

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

469 470
Names can be capitalized or not, written in full (as specified by the
variable `calendar-day-name-array'), or abbreviated (as specified by
471 472 473 474 475 476
`calendar-day-abbrev-array') with or without a period.

Setting this variable directly does not take effect (if the
calendar package is already loaded).  Rather, use either
\\[customize] or the functions `european-calendar' and
`american-calendar'."
477
  :type 'boolean
478 479 480
  ;; Without :initialize (require 'calendar) throws an error because
  ;; american-calendar is undefined at this point.
  :initialize 'custom-initialize-default
481 482 483 484
  :set (lambda (symbol value)
         (if value
             (european-calendar)
           (american-calendar)))
485
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
486

487
(defcustom american-date-diary-pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
488 489 490 491 492
  '((month "/" day "[^/0-9]")
    (month "/" day "/" year "[^0-9]")
    (monthname " *" day "[^,0-9]")
    (monthname " *" day ", *" year "[^0-9]")
    (dayname "\\W"))
493
  "List of pseudo-patterns describing the American patterns of date used.
494 495 496 497 498 499 500 501 502 503 504
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
505

506
(defcustom european-date-diary-pattern
Richard M. Stallman's avatar
Richard M. Stallman committed
507 508
  '((day "/" month "[^/0-9]")
    (day "/" month "/" year "[^0-9]")
509
    (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)")
Richard M. Stallman's avatar
Richard M. Stallman committed
510 511
    (day " *" monthname " *" year "[^0-9]")
    (dayname "\\W"))
512
  "List of pseudo-patterns describing the European patterns of date used.
513 514 515 516 517 518 519 520 521 522 523 524
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)

525 526 527 528
(autoload 'diary-font-lock-keywords "diary-lib")
(autoload 'diary-live-p "diary-lib")
(defvar diary-font-lock-keywords)

529
(defcustom diary-date-forms
Richard M. Stallman's avatar
Richard M. Stallman committed
530 531 532
  (if european-calendar-style
      european-date-diary-pattern
    american-date-diary-pattern)
533
  "List of pseudo-patterns describing the forms of date used in the diary.
Juanma Barranquero's avatar
Juanma Barranquero committed
534
The patterns on the list must be MUTUALLY EXCLUSIVE and should not match
Richard M. Stallman's avatar
Richard M. Stallman committed
535 536 537 538
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
539 540 541 542 543 544 545 546
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
547 548 549 550 551 552 553

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
554 555
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
556 557 558 559 560 561 562 563 564 565
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)))))
566 567 568 569 570 571 572 573 574
  :initialize 'custom-initialize-default
  :set (lambda (symbol value)
         (unless (equal value (eval symbol))
           (custom-set-default symbol value)
           (setq diary-font-lock-keywords (diary-font-lock-keywords))
           ;; Need to redraw not just to get new font-locking, but also
           ;; to pick up any newly recognized entries.
           (and (diary-live-p)
                (diary))))
575
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
576

577
(defcustom european-calendar-display-form
Jim Blandy's avatar
Jim Blandy committed
578
  '((if dayname (concat dayname ", ")) day " " monthname " " year)
579
  "Pseudo-pattern governing the way a date appears in the European style.
580
See the documentation of `calendar-date-display-form' for an explanation."
581 582
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
583

584
(defcustom american-calendar-display-form
Jim Blandy's avatar
Jim Blandy committed
585
  '((if dayname (concat dayname ", ")) monthname " " day ", " year)
586
  "Pseudo-pattern governing the way a date appears in the American style.
587 588 589
See the documentation of `calendar-date-display-form' for an explanation."
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
590

591
(defcustom calendar-date-display-form
Richard M. Stallman's avatar
Richard M. Stallman committed
592 593 594
  (if european-calendar-style
      european-calendar-display-form
    american-calendar-display-form)
595
  "Pseudo-pattern governing the way a date appears.
596 597 598 599 600

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
601 602 603 604 605 606 607 608 609 610 611 612 613

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

614 615 616
See the documentation of the function `calendar-date-string'."
  :type 'sexp
  :group 'calendar)
Richard M. Stallman's avatar
Richard M. Stallman committed
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633

(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))

634
;; FIXME move to diary-lib and adjust appt.
635
(defcustom diary-hook nil
636
  "List of functions called after the display of the diary.
637 638 639
Can be used for appointment notification."
  :type 'hook
  :group 'diary)
640

641 642
(autoload 'diary-set-maybe-redraw "diary-lib")

643
(defcustom diary-display-hook nil
644
  "List of functions that handle the display of the diary.
Richard M. Stallman's avatar
Richard M. Stallman committed
645
If nil (the default), `simple-diary-display' is used.  Use `ignore' for no
646
diary display.
Richard M. Stallman's avatar
Richard M. Stallman committed
647 648 649 650 651 652

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

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
663 664
diary buffer, set the variable `diary-list-include-blanks' to t."
  :type 'hook
665
  :options '(fancy-diary-display)
666 667
  :initialize 'custom-initialize-default
  :set 'diary-set-maybe-redraw
668
  :group 'diary)
Richard M. Stallman's avatar
Richard M. Stallman committed
669

670
(defcustom holidays-in-diary-buffer t
671
  "Non-nil means include holidays in the diary display.
Richard M. Stallman's avatar
Richard M. Stallman committed
672
The holidays appear in the mode line of the diary buffer, or in the
673
fancy diary buffer next to the date.  This slows down the diary functions
674 675 676
somewhat; setting it to nil makes the diary display faster."
  :type 'boolean
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
677

678 679 680 681
(defcustom calendar-debug-sexp nil
  "Turn debugging on when evaluating a sexp in the diary or holiday list."
  :type 'boolean
  :group 'calendar)
682

683
(defcustom general-holidays
684 685
  '((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
686
    (holiday-fixed 2 2 "Groundhog Day")
687 688 689
    (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
690
    (holiday-fixed 4 1 "April Fools' Day")
691 692 693 694 695 696 697 698 699 700
    (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"))
701
  "General holidays.  Default value is for the United States.
702 703 704
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
705
;;;###autoload
706 707
(put 'general-holidays 'risky-local-variable t)

708
(defcustom oriental-holidays
709 710
  '((if (fboundp 'atan)
	(holiday-chinese-new-year)))
711
  "Oriental holidays.
712 713 714
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
715
;;;###autoload
716 717
(put 'oriental-holidays 'risky-local-variable t)

718
(defcustom local-holidays nil
719
  "Local holidays.
720 721 722
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
723
;;;###autoload
724 725
(put 'local-holidays 'risky-local-variable t)

726
(defcustom other-holidays nil
727
  "User defined holidays.
728 729 730
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
731
;;;###autoload
732 733 734 735 736 737 738 739 740 741
(put 'other-holidays 'risky-local-variable t)

(defcustom all-hebrew-calendar-holidays nil
  "If nil, show only major holidays from the Hebrew calendar.
This means only those Jewish holidays that appear on secular calendars.
Otherwise, show all the holidays that would appear in a complete Hebrew
calendar."
  :type 'boolean
  :group 'holidays)

742
(defvar hebrew-holidays-1
743
  '((holiday-rosh-hashanah-etc)
Richard M. Stallman's avatar
Richard M. Stallman committed
744
    (if all-hebrew-calendar-holidays
745 746 747 748 749 750 751 752 753 754 755 756
        (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
757
               21))) "\"Tal Umatar\" (evening)"))))
Richard M. Stallman's avatar
Richard M. Stallman committed
758
;;;###autoload
759 760
(put 'hebrew-holidays-1 'risky-local-variable t)

761 762
(defvar hebrew-holidays-2
  '((if all-hebrew-calendar-holidays
763 764
        (holiday-hanukkah)
      (holiday-hebrew 9 25 "Hanukkah"))
Richard M. Stallman's avatar
Richard M. Stallman committed
765
    (if all-hebrew-calendar-holidays
766 767 768 769 770 771 772 773 774 775 776
      (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
777
    (if all-hebrew-calendar-holidays
778
        (holiday-hebrew 11 15 "Tu B'Shevat"))))
Richard M. Stallman's avatar
Richard M. Stallman committed
779
;;;###autoload
780 781
(put 'hebrew-holidays-2 'risky-local-variable t)

782
(defvar hebrew-holidays-3
783
  '((if all-hebrew-calendar-holidays
784
        (holiday-hebrew
Richard M. Stallman's avatar
Richard M. Stallman committed
785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809
         11
         (let ((m displayed-month)
               (y displayed-year))
           (increment-calendar-month m y 1)
           (let* ((h-year (extract-calendar-year
                           (calendar-hebrew-from-absolute
                            (calendar-absolute-from-gregorian
                             (list m
                                   (calendar-last-day-of-month m y)
                                   y)))))
                  (s-s
                   (calendar-hebrew-from-absolute
                    (if (=
                         (% (calendar-absolute-from-hebrew
                             (list 7 1 h-year))
                            7)
                         6)
                        (calendar-dayname-on-or-before
                         6 (calendar-absolute-from-hebrew
                            (list 11 17 h-year)))
                      (calendar-dayname-on-or-before
                       6 (calendar-absolute-from-hebrew
                          (list 11 16 h-year))))))
                  (day (extract-calendar-day s-s)))
             day))
810
         "Shabbat Shirah"))))
Richard M. Stallman's avatar
Richard M. Stallman committed
811
;;;###autoload
812 813
(put 'hebrew-holidays-3 'risky-local-variable t)

814 815
(defvar hebrew-holidays-4
  '((holiday-passover-etc)
Richard M. Stallman's avatar
Richard M. Stallman committed
816 817 818 819 820 821 822 823 824 825
    (if (and all-hebrew-calendar-holidays
             (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))))))
                 (= 21 (% year 28)))))
826
        (holiday-julian 3 26 "Kiddush HaHamah"))
Richard M. Stallman's avatar
Richard M. Stallman committed
827
    (if all-hebrew-calendar-holidays
828
        (holiday-tisha-b-av-etc))))
Richard M. Stallman's avatar
Richard M. Stallman committed
829
;;;###autoload
830 831
(put 'hebrew-holidays-4 'risky-local-variable t)

832
(defcustom hebrew-holidays (append hebrew-holidays-1 hebrew-holidays-2
833
				hebrew-holidays-3 hebrew-holidays-4)
834
  "Jewish holidays.
835 836 837
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
838
;;;###autoload
839 840 841 842 843 844 845 846 847 848
(put 'hebrew-holidays 'risky-local-variable t)

(defcustom all-christian-calendar-holidays nil
  "If nil, show only major holidays from the Christian calendar.
This means only those Christian holidays that appear on secular calendars.
Otherwise, show all the holidays that would appear in a complete Christian
calendar."
  :type 'boolean
  :group 'holidays)

849
(defcustom christian-holidays
Jim Blandy's avatar
Jim Blandy committed
850
  '((if all-christian-calendar-holidays
851
        (holiday-fixed 1 6 "Epiphany"))
Glenn Morris's avatar
Glenn Morris committed
852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
    (holiday-easter-etc 0 "Easter Sunday")
    (holiday-easter-etc -2 "Good Friday")
    (holiday-easter-etc -46 "Ash Wednesday")
    (if all-christian-calendar-holidays
        (holiday-easter-etc -63 "Septuagesima Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -56 "Sexagesima Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -49 "Shrove Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -48 "Shrove Monday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -47 "Shrove Tuesday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -14 "Passion Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -7 "Palm Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc -3 "Maundy Thursday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc 35 "Rogation Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc 39 "Ascension Day"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc 49 "Pentecost (Whitsunday)"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc 50 "Whitmonday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc 56 "Trinity Sunday"))
    (if all-christian-calendar-holidays
        (holiday-easter-etc 60 "Corpus Christi"))
Jim Blandy's avatar
Jim Blandy committed
883
    (if all-christian-calendar-holidays
884
        (holiday-greek-orthodox-easter))
Jim Blandy's avatar
Jim Blandy committed
885
    (if all-christian-calendar-holidays
886
        (holiday-fixed 8 15 "Assumption"))
Jim Blandy's avatar
Jim Blandy committed
887
    (if all-christian-calendar-holidays
Glenn Morris's avatar
Glenn Morris committed
888
        (holiday-advent 0 "Advent"))
889
    (holiday-fixed 12 25 "Christmas")
Jim Blandy's avatar
Jim Blandy committed
890
    (if all-christian-calendar-holidays
891
        (holiday-julian 12 25 "Eastern Orthodox Christmas")))
892
  "Christian holidays.
893 894 895
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
896
;;;###autoload
897 898 899 900 901 902 903 904 905 906
(put 'christian-holidays 'risky-local-variable t)

(defcustom all-islamic-calendar-holidays nil
  "If nil, show only major holidays from the Islamic calendar.
This means only those Islamic holidays that appear on secular calendars.
Otherwise, show all the holidays that would appear in a complete Islamic
calendar."
  :type 'boolean
  :group 'holidays)

907
(defcustom islamic-holidays
908 909 910 911 912 913 914 915 916 917 918
  '((holiday-islamic
     1 1
     (format "Islamic New Year %d"
             (let ((m displayed-month)
                   (y displayed-year))
               (increment-calendar-month m y 1)
               (extract-calendar-year
                (calendar-islamic-from-absolute
                 (calendar-absolute-from-gregorian
                  (list
                   m (calendar-last-day-of-month m y) y)))))))
Richard M. Stallman's avatar
Richard M. Stallman committed
919
    (if all-islamic-calendar-holidays
920
        (holiday-islamic 1 10 "Ashura"))
Richard M. Stallman's avatar
Richard M. Stallman committed
921
    (if all-islamic-calendar-holidays
922
        (holiday-islamic 3 12 "Mulad-al-Nabi"))
Richard M. Stallman's avatar
Richard M. Stallman committed
923
    (if all-islamic-calendar-holidays
924
        (holiday-islamic 7 26 "Shab-e-Mi'raj"))
Richard M. Stallman's avatar
Richard M. Stallman committed
925
    (if all-islamic-calendar-holidays
926 927
        (holiday-islamic 8 15 "Shab-e-Bara't"))
    (holiday-islamic 9 1 "Ramadan Begins")
Richard M. Stallman's avatar
Richard M. Stallman committed
928
    (if all-islamic-calendar-holidays
929
        (holiday-islamic 9 27 "Shab-e Qadr"))
Richard M. Stallman's avatar
Richard M. Stallman committed
930
    (if all-islamic-calendar-holidays
931
        (holiday-islamic 10 1 "Id-al-Fitr"))
Richard M. Stallman's avatar
Richard M. Stallman committed
932
    (if all-islamic-calendar-holidays
933
        (holiday-islamic 12 10 "Id-al-Adha")))
934
  "Islamic holidays.
935 936 937
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
938
;;;###autoload
939 940 941 942 943 944 945 946 947 948
(put 'islamic-holidays 'risky-local-variable t)

(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.
Otherwise, show all the holidays that would appear in a complete Baha'i
calendar."
  :type 'boolean
  :group 'holidays)

949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982
(defcustom bahai-holidays
  '((holiday-fixed
     3 21
     (format "Baha'i New Year (Naw-Ruz) %d" (- displayed-year (1- 1844))))
    (holiday-fixed  4 21 "First Day of Ridvan")
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 22 "Second Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 23 "Third Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 24 "Fourth Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 25 "Fifth Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 26 "Sixth Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 27 "Seventh Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 28 "Eighth Day of Ridvan"))
    (holiday-fixed  4 29 "Ninth Day of Ridvan")
    (if all-bahai-calendar-holidays
	(holiday-fixed  4 30 "Tenth Day of Ridvan"))
    (if all-bahai-calendar-holidays
	(holiday-fixed  5  1 "Eleventh Day of Ridvan"))
    (holiday-fixed  5  2 "Twelfth Day of Ridvan")
    (holiday-fixed  5 23 "Declaration of the Bab")
    (holiday-fixed  5 29 "Ascension of Baha'u'llah")
    (holiday-fixed  7  9 "Martyrdom of the Bab")
    (holiday-fixed 10 20 "Birth of the Bab")
    (holiday-fixed 11 12 "Birth of Baha'u'llah")
    (if all-bahai-calendar-holidays
	(holiday-fixed 11 26 "Day of the Covenant"))
    (if all-bahai-calendar-holidays
	(holiday-fixed 11 28 "Ascension of `Abdu'l-Baha")))
983
  "Baha'i holidays.
984 985 986
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
987
;;;###autoload
988 989
(put 'bahai-holidays 'risky-local-variable t)

990
(defcustom solar-holidays
Jim Blandy's avatar
Jim Blandy committed
991 992
  '((if (fboundp 'atan)
	(solar-equinoxes-solstices))
993
    (if (require 'cal-dst)
994
      (funcall
995
       'holiday-sexp
996
        calendar-daylight-savings-starts
997
        '(format "Daylight Saving Time Begins %s"
998 999
                  (if (fboundp 'atan)
                      (solar-time-string
1000 1001
                       (/ calendar-daylight-savings-starts-time (float 60))
                       calendar-standard-time-zone-name)
1002 1003 1004 1005
                    ""))))
    (funcall
     'holiday-sexp
     calendar-daylight-savings-ends
1006
     '(format "Daylight Saving Time Ends %s"
1007 1008
              (if (fboundp 'atan)
                  (solar-time-string
1009 1010
                   (/ calendar-daylight-savings-ends-time (float 60))
                   calendar-daylight-time-zone-name)
1011
                ""))))
1012
  "Sun-related holidays.
1013 1014 1015
See the documentation for `calendar-holidays' for details."
  :type 'sexp
  :group 'holidays)
Richard M. Stallman's avatar
Richard M. Stallman committed
1016
;;;###autoload
1017 1018
(put 'solar-holidays 'risky-local-variable t)

1019
(defcustom calendar-holidays
1020 1021
  (append general-holidays local-holidays other-holidays
          christian-holidays hebrew-holidays islamic-holidays
1022
          bahai-holidays oriental-holidays solar-holidays)
1023
  "List of notable days for the command \\[holidays].
Jim Blandy's avatar
Jim Blandy committed
1024

1025