;;; holidays.el --- holiday functions for the calendar package
-;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2004 Free
-;; Software Foundation, Inc.
+;; Copyright (C) 1989, 1990, 1992, 1993, 1994, 1997, 2001, 2002, 2003,
+;; 2004, 2005, 2006 Free Software Foundation, Inc.
;; Author: Edward M. Reingold <reingold@cs.uiuc.edu>
-;; Maintainer: Glenn Morris <gmorris@ast.cam.ac.uk>
+;; Maintainer: Glenn Morris <rgm@gnu.org>
;; Keywords: holidays, calendar
;; This file is part of GNU Emacs.
;; You should have received a copy of the GNU General Public License
;; 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.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;;; Commentary:
;; in calendar.el.
;; Technical details of all the calendrical calculations can be found in
-;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
-;; Cambridge University Press (1997).
+;; ``Calendrical Calculations: The Millennium Edition'' by Edward M. Reingold
+;; and Nachum Dershowitz, Cambridge University Press (2001).
;; An earlier version of the technical details appeared in
;; ``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
(defun list-holidays (y1 y2 &optional l label)
"Display holidays for years Y1 to Y2 (inclusive).
-The optional list of holidays L defaults to `calendar-holidays'. See the
-documentation for that variable for a description of holiday lists.
+The optional list of holidays L defaults to `calendar-holidays'.
+If you want to control what holidays are displayed, use a
+different list. For example,
+
+ (list-holidays 2006 2006
+ (append general-holidays local-holidays other-holidays))
+
+will display holidays for the year 2006 defined in the 3
+mentioned lists, and nothing else.
+
+When called interactively, this command offers a choice of
+holidays, based on the variables `solar-holidays' etc. See the
+documentation of `calendar-holidays' for a list of the variables
+that control the choices, as well as a description of the format
+of a holiday list.
The optional LABEL is used to label the buffer created."
(interactive
(string (if date (eval string))))
(list (list date string)))))))
-(defun holiday-advent (n string)
- "Date of Nth day after advent (named STRING), if visible in calendar window."
- (let ((year displayed-year)
- (month displayed-month))
- (increment-calendar-month month year -1)
- (let ((advent (calendar-gregorian-from-absolute
- (+ n
- (calendar-dayname-on-or-before
- 0
- (calendar-absolute-from-gregorian
- (list 12 3 year)))))))
- (if (calendar-date-is-visible-p advent)
- (list (list advent string))))))
+(defun holiday-advent (&optional n string)
+ "Date of Nth day after advent (named STRING), if visible in calendar window.
+Negative values of N are interpreted as days before advent.
+STRING is used purely for display purposes. The return value has
+the form ((MONTH DAY YEAR) STRING), where the date is that of the
+Nth day before or after advent.
+
+For backwards compatibility, if this function is called with no
+arguments, then it returns the value appropriate for advent itself."
+ ;; Backwards compatibility layer.
+ (if (not n)
+ (holiday-advent 0 "Advent")
+ (let ((year displayed-year)
+ (month displayed-month))
+ (increment-calendar-month month year -1)
+ (let ((advent (calendar-gregorian-from-absolute
+ (+ n
+ (calendar-dayname-on-or-before
+ 0
+ (calendar-absolute-from-gregorian
+ (list 12 3 year)))))))
+ (if (calendar-date-is-visible-p advent)
+ (list (list advent string)))))))
(defun holiday-easter-etc (&optional n string)
"Date of Nth day after Easter (named STRING), if visible in calendar window.
the form ((MONTH DAY YEAR) STRING), where the date is that of the
Nth day before or after Easter.
-For backwards compatability, if this function is called with no
+For backwards compatibility, if this function is called with no
arguments, then it returns a list of \"standard\" Easter-related
holidays (with more entries if `all-christian-calendar-holidays'
is non-nil)."
- ;; Backwards compatability layer.
+ ;; Backwards compatibility layer.
(if (not n)
(let (res-list res)
(dolist (elem (append