Function: list-holidays
list-holidays is an autoloaded, interactive and byte-compiled function
defined in holidays.el.gz.
Signature
(list-holidays Y1 &optional Y2 L LABEL)
Documentation
Display holidays for years Y1 to Y2 (inclusive).
Y2 defaults to Y1. 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 holiday-general-holidays holiday-local-holidays))
will display holidays for the year 2006 defined in the two mentioned lists, and nothing else.
When called interactively, this command offers a choice of
holidays, based on the variables holiday-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.
The list of holiday lists is computed by the
holiday-available-holiday-lists and you can alter the results
by redefining that function, or use add-function to add
values.
Probably introduced at or before Emacs version 20.1.
Key Bindings
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/calendar/holidays.el.gz
;; rms: "Emacs commands to display a list of something generally start
;; with `list-'. Please make `list-holidays' the principal name."
;;;###autoload
(defun list-holidays (y1 &optional y2 l label)
"Display holidays for years Y1 to Y2 (inclusive).
Y2 defaults to Y1. 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 holiday-general-holidays holiday-local-holidays))
will display holidays for the year 2006 defined in the two
mentioned lists, and nothing else.
When called interactively, this command offers a choice of
holidays, based on the variables `holiday-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.
The list of holiday lists is computed by the
`holiday-available-holiday-lists' and you can alter the results
by redefining that function, or use `add-function' to add
values."
(interactive
(let* ((start-year (calendar-read-sexp
"Starting year of holidays (>0)"
(lambda (x) (> x 0))
(calendar-extract-year (calendar-current-date))))
(end-year (calendar-read-sexp
"Ending year (inclusive) of holidays (>=%s)"
(lambda (x) (>= x start-year))
start-year
start-year))
(completion-ignore-case t)
(lists (holiday-available-holiday-lists))
(choice (capitalize
(completing-read "List (TAB for choices): " lists nil t)))
(which (if (string-equal choice "Ask")
(symbol-value (read-variable "Enter list name: "))
(cdr (assoc choice lists))))
(name (if (string-equal choice "Equinoxes/Solstices")
choice
(if (member choice '("Ask" ""))
"Holidays"
(format "%s Holidays" choice)))))
(list start-year end-year which name)))
(unless y2 (setq y2 y1))
(message "Computing holidays...")
(let ((calendar-holidays (or l calendar-holidays))
(title (or label "Holidays"))
(s (calendar-absolute-from-gregorian (list 2 1 y1)))
(e (calendar-absolute-from-gregorian (list 11 1 y2)))
(displayed-month 2)
(displayed-year y1)
holiday-list)
(while (<= s e)
(setq holiday-list (append holiday-list (calendar-holiday-list)))
(calendar-increment-month displayed-month displayed-year 3)
(setq s (calendar-absolute-from-gregorian
(list displayed-month 1 displayed-year))))
(save-current-buffer
(calendar-in-read-only-buffer holiday-buffer
(calendar-set-mode-line
(if (= y1 y2)
(format "%s for %s" title y1)
(format "%s for %s-%s" title y1 y2)))
(insert
(mapconcat
(lambda (x) (concat (calendar-date-string (car x))
": " (cadr x)))
holiday-list "\n")))
(message "Computing holidays...done"))))