Go to the first, previous, next, last section, table of contents.

Customizing the Calendar

The variable view-diary-entries-initially, whose default is nil, can be set to to t to cause diary entries for the current date to be displayed in another window when the calendar is first displayed, if the current date is visible. If you add the lines

(setq view-diary-entries-initially t)
(calendar)

to your `.emacs' file, then whenever you start the editor, you'll see the calendar and the diary windows.

Similarly, if you set the variable view-calendar-holidays-initially to t, it will cause the holidays for the current three month period will be displayed on entry to the calendar. The holidays are displayed in a separate window.

Setting the variable mark-diary-entries-in-calendar to t causes any dates visible in the calendar window with diary entries to be marked with the symbol specified by the variable diary-entry-marker, normally a plus sign (`+'). Whenever the calendar window is displayed or redisplayed, the diary entries will be automatically marked.

Similarly, setting the variable mark-holidays-in-calendar to t causes any holidays visible in the calendar window to be marked with the symbol specified by the variable calendar-holiday-marker, normally an asterisk (`*'). Whenever the calendar window is displayed or redisplayed, the holidays will be automatically marked.

There are many customizations that you can make with the hooks provided. For example, the variable initial-calendar-window-hook, whose default value is nil, is a list of functions to be called when the calendar window is first opened. 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 and reentering it will cause these functions to be called again.

The variable today-visible-calendar-hook, whose default value is nil, is the list of functions called after the calendar buffer has been prepared with the calendar when the current date is visible in the window. This hook can be used, for example, to replace today's date with asterisks; a function calendar-star-date is included for this purpose. To use it, you would execute this expression:

(setq today-visible-calendar-hook 'calendar-star-date)

This hook could also be used to mark the current date with an asterisk; a function is also provided for this, too:

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

There is a corresponding variable today-invisible-calendar-hook, whose default value is nil, is the list of functions called after the calendar buffer has been prepared with the calendar when the current date is not visible in the window.


Go to the first, previous, next, last section, table of contents.