32.13.1 Customizing the Calendar

The calendar display unfortunately cannot be changed from three months, but you can customize the whitespace used by setting the variables: calendar-left-margin, calendar-day-header-width, calendar-day-digit-width, calendar-column-width, and calendar-intermonth-spacing. To display text between the months, for example week numbers, customize the variables calendar-intermonth-header and calendar-intermonth-text as described in their documentation.

The variable calendar-month-header controls the text that appears above each month in the calendar. By default, it shows the month and year. The variable calendar-day-header-array controls the text that appears above each day’s column in every month. By default, it shows the first two letters of each day’s name.

The variable calendar-holiday-marker specifies how to mark a date that is a holiday. Its value may be a single-character string to insert next to the date, or a face name to use for displaying the date. Likewise, the variable diary-entry-marker specifies how to mark a date that has diary entries. The function calendar-mark-today uses calendar-today-marker to mark today’s date. By default, the calendar uses faces named holiday, diary, and calendar-today for these purposes.

Starting the calendar runs the normal hook calendar-initial-window-hook. Recomputation of the calendar display does not run this hook. But if you leave the calendar with the q command and reenter it, the hook runs again.

The variable calendar-today-visible-hook is a normal hook run after the calendar buffer has been prepared with the calendar, when the current date is visible in the window. One use of this hook is to mark today’s date; to do that use either of the functions calendar-mark-today or calendar-star-date:

(add-hook 'calendar-today-visible-hook 'calendar-mark-today)

A similar normal hook, calendar-today-invisible-hook is run if the current date is not visible in the window.

Each of the calendar cursor motion commands runs the hook calendar-move-hook after it moves the cursor.