File: calendar.el.html
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 Bahá’í 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. Times of sunrise/sunset can be displayed, as can the phases of the moon. Appointment notification for diary entries is available. Calendar printing via LaTeX is available.
The following files are part of the calendar/diary code:
appt.el Appointment notification
cal-bahai.el Bahá’í calendar
cal-china.el Chinese calendar
cal-coptic.el Coptic/Ethiopic calendars
cal-dst.el Daylight saving time rules
cal-french.el French revolutionary calendar
cal-hebrew.el Hebrew calendar
cal-html.el Calendars in HTML
cal-islam.el Islamic calendar
cal-iso.el ISO calendar
cal-julian.el Julian/astronomical calendars
cal-mayan.el Mayan calendars
cal-menu.el Menu support
cal-move.el Movement in the calendar
cal-persia.el Persian calendar
cal-tex.el Calendars in LaTeX
cal-x.el Dedicated frame functions
calendar.el This file
diary-lib.el Diary functions
holidays.el Holiday functions
lunar.el Phases of the moon
solar.el Sunrise/sunset, equinoxes/solstices
Technical details of all the calendrical calculations can be found in
"Calendrical Calculations: The Ultimate Edition" by Edward M. Reingold
and Nachum Dershowitz, Cambridge University Press (2018).
An earlier version of the technical details appeared in "Calendrical
Calculations" by Nachum Dershowitz and Edward M. Reingold,
Software--Practice and Experience, Volume 20, Number 9 (September, 1990),
pages 899-928 <https://doi.org/10.1002/spe.4380200905>
<https://pdfs.semanticscholar.org/83b1/14f570002a7a8e1d4e3730cd0e4cdbcad212.pdf>,
and in "Calendrical Calculations, Part II: Three Historical Calendars" by
E. M. Reingold, N. Dershowitz, and S. M. Clamen, Software--Practice and
Experience, Volume 23, Number 4 (April, 1993), pages 383-404
<https://doi.org/10.1002/spe.4380230404>
<http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.42.6421&rep=rep1&type=pdf>
A note on how dates are represented:
The standard format for a (Gregorian) calendar date in this file is a
list of integers (MONTH DAY YEAR) -- see the functions
calendar-extract-year, calendar-extract-month, and
calendar-extract-day. Internally it also uses an "absolute" format
which is an integer number of days since December 31, 1BC on the
Gregorian calendar (see e.g. calendar-absolute-from-gregorian), and
converts between different calendar scales by converting to and from
the absolute format (see e.g. calendar-iso-from-absolute in
cal-iso.el). This representation is also useful for certain
calculations; e.g. calendar-day-of-week is simply the absolute
representation modulo 7, because December 31, 1BC is a Sunday.
A note on free variables:
The calendar passes around a few dynamically bound variables, which unfortunately have rather common names. They are meant to be available for external functions, so the names can't be changed.
displayed-month, displayed-year: bound in calendar-generate, the
central month of the 3 month calendar window
original-date, number: bound in diary-list-entries, the arguments
with which that function was called.
date, entry: bound in diary-list-sexp-entries (qv)
Bound in diary-list-entries: diary-entries-list: use in d-l, appt.el, and by diary-add-to-list diary-saved-point: only used in diary-lib.el, passed to the display func date-string: only used in diary-lib.el list-only: don't modify the diary-buffer, just return a list of entries file-glob-attrs: yuck
Defined variables (80)
calendar-abbrev-length | Default length of abbreviations to use for day and month names. |
calendar-american-date-display-form | Pseudo-pattern governing the way a date appears in the American style. |
calendar-american-month-header | Default format for calendar month headings with the American date style. |
calendar-bahai-all-holidays-flag | If nil, show only major holidays from the Bahá’í calendar. |
calendar-buffer | Name of the buffer used for the calendar. |
calendar-chinese-all-holidays-flag | If nil, show only the major holidays from the Chinese calendar. |
calendar-christian-all-holidays-flag | If nil, show only major holidays from the Christian calendar. |
calendar-column-width | Width of each day column in the calendar. Minimum value is 3. |
calendar-date-display-form | Pseudo-pattern governing the way a calendar date appears. |
calendar-date-echo-text | String displayed when the cursor is over a date in the calendar. |
calendar-date-style | Your preferred style for writing dates. |
calendar-day-abbrev-array | Array of capitalized strings giving the abbreviated day names. |
calendar-day-digit-width | Width of the day digits in the calendar. Minimum value is 2. |
calendar-day-header-array | Array of strings to use for the headers of the calendar’s day columns. |
calendar-day-header-width | Width of the day column headers in the calendar. |
calendar-day-name-array | Array of capitalized strings giving, in order from Sunday, the day names. |
calendar-debug-sexp | Turn debugging on when evaluating a sexp in the diary or holiday list. |
calendar-european-date-display-form | Pseudo-pattern governing the way a date appears in the European style. |
calendar-european-month-header | Default format for calendar month headings with the European date style. |
calendar-first-date-row | First row in the calendar with actual dates. |
calendar-hebrew-all-holidays-flag | If nil, show only major holidays from the Hebrew calendar. |
calendar-hebrew-yahrzeit-buffer | Name of the buffer used by ‘calendar-hebrew-list-yahrzeits’. |
calendar-holiday-marker | How to mark notable dates in the calendar. |
calendar-initial-window-hook | List of functions to be called when the calendar window is created. |
calendar-intermonth-header | Header text to display in the space to the left of each calendar month. |
calendar-intermonth-spacing | Space between months in the calendar. Minimum value is 1. |
calendar-intermonth-text | Text to display in the space to the left of each calendar month. |
calendar-islamic-all-holidays-flag | If nil, show only major holidays from the Islamic calendar. |
calendar-iso-date-display-form | Pseudo-pattern governing the way a date appears in the ISO style. |
calendar-iso-month-header | Default format for calendar month headings with the ISO date style. |
calendar-left-margin | Empty space to the left of the first month in the calendar. |
calendar-load-hook | List of functions to be called after the calendar is first loaded. |
calendar-mark-diary-entries | Variable version of the user option ‘calendar-mark-diary-entries-flag’. |
calendar-mark-diary-entries-flag | Non-nil means mark dates with diary entries, in the calendar window. |
calendar-mark-holidays | Variable version of the user option ‘calendar-mark-holidays-flag’. |
calendar-mark-holidays-flag | Non-nil means mark dates of holidays in the calendar window. |
calendar-mark-ring | Used by ‘calendar-set-mark’. |
calendar-minimum-window-height | Minimum height ‘calendar-generate-window’ should use for calendar window. |
calendar-mode-abbrev-table | Abbrev table for ‘calendar-mode’. |
calendar-mode-hook | Hook run when entering ‘calendar-mode’. |
calendar-mode-line-format | If non-nil, the mode line of the calendar buffer. |
calendar-mode-map | Keymap for ‘calendar-mode’. |
calendar-mode-syntax-table | Syntax table for ‘calendar-mode’. |
calendar-month-abbrev-array | Array of capitalized strings giving the abbreviated month names. |
calendar-month-digit-width | Width of the region with numbers in each month in the calendar. |
calendar-month-edges | Alist of month edge columns. |
calendar-month-header | Expression to evaluate to return the calendar month headings. |
calendar-month-name-array | Array of capitalized strings giving, in order, the month names. |
calendar-month-width | Full width of each month in the calendar. |
calendar-move-hook | List of functions called whenever the cursor moves in the calendar. |
calendar-offset | The offset of the principal month from the center of the calendar window. |
calendar-other-calendars-buffer | Name of the buffer used for the display of date on other calendars. |
calendar-remove-frame-by-deleting | Determine how the calendar mode removes a frame no longer needed. |
calendar-right-margin | Right margin of the calendar. |
calendar-setup | The frame setup of the calendar. |
calendar-split-width-threshold | Value to use for ‘split-width-threshold’ when creating a calendar. |
calendar-time-zone-style | Your preferred style for time zones. |
calendar-today-invisible-hook | List of functions called whenever the current date is not visible. |
calendar-today-marker | How to mark today’s date in the calendar. |
calendar-today-visible-hook | List of functions called whenever the current date is visible. |
calendar-view-diary-initially-flag | Non-nil means display current date’s diary entries on entry to calendar. |
calendar-view-holidays-initially-flag | Non-nil means display holidays for current three month period on entry. |
calendar-week-start-day | The day of the week on which a week in the calendar begins. |
calendar-weekend-days | Days of the week considered weekend days. |
diary-american-date-forms | List of pseudo-patterns describing the American style of dates. |
diary-bahai-entry-symbol | Symbol indicating a diary entry according to the Bahá’í calendar. |
diary-chinese-entry-symbol | Symbol indicating a diary entry according to the Chinese calendar. |
diary-date-forms | List of pseudo-patterns describing the forms of date used in the diary. |
diary-entry-marker | How to mark dates that have diary entries. |
diary-european-date-forms | List of pseudo-patterns describing the European style of dates. |
diary-fancy-buffer | Name of the buffer used for the optional fancy display of the diary. |
diary-file | Name of the file in which one’s personal diary of dates is kept. |
diary-hebrew-entry-symbol | Symbol indicating a diary entry according to the Hebrew calendar. |
diary-islamic-entry-symbol | Symbol indicating a diary entry according to the Islamic calendar. |
diary-iso-date-forms | List of pseudo-patterns describing the ISO style of dates. |
diary-nonmarking-symbol | Symbol indicating that a diary entry is not to be marked in the calendar. |
diary-show-holidays-flag | Non-nil means include holidays in the diary display. |
holiday-buffer | Name of the buffer used for the displaying the holidays. |
lunar-phases-buffer | Name of the buffer used for the lunar phases. |
solar-sunrises-buffer | Name of buffer used for sunrise/sunset times. |
Defined functions (74)
Defined faces (6)
calendar-month-header | Face used for month headers in the calendar. |
calendar-today | Face for indicating today’s date in the calendar. See the variable ‘calendar-today-marker’. |
calendar-weekday-header | Face used for weekday column headers in the calendar. See also the face ‘calendar-weekend-header’. |
calendar-weekend-header | Face used for weekend column headers in the calendar. See also the face ‘calendar-weekday-header’. |
diary | Face for highlighting diary entries. Used to mark diary entries in the calendar (see ‘diary-entry-marker’), and to highlight the date header in the fancy diary. |
holiday | Face for indicating in the calendar dates that have holidays. See ‘calendar-holiday-marker’. |