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

The Diary

Associated with the Emacs calendar is a diary that keeps track of appointments or other events on a daily basis. To use the diary feature, you must first create a diary file containing a list of events and their dates. Then Emacs can automatically pick out and display the events for today, for the immediate future, or for any specified date.

d
Display any diary entries for the selected date (view-diary-entries).
s
Display entire diary file (show-all-diary-entries).
m
Mark all visible dates that have diary entries (mark-diary-entries).
u
Unmark calendar window (calendar-unmark).
M-x print-diary-entries
Print a hard copy of the diary display as it appears.
M-x diary
Display any diary entries for today's date.

Displaying the diary entries with d shows in a separate window the diary entries for the date indicated by the point in the calendar window. The mode line of the new window shows the date of the diary entries and any holidays that fall on that date.

If you specify a numeric argument with d, then all the diary entries for that many successive days are shown. Thus, 2 d displays all the entries for the selected date and for the following day.

To get a broader overview of which days are mentioned in the diary, use the m command to mark those days in the calendar window. The marks appear next to the dates to which they apply. The m command affects the dates currently visible and, if you scroll the calendar, newly visible dates as well. The u command deletes all diary marks (and all holiday marks too; see section Holidays), not only in the dates currently visible, but dates that become visible when you scroll the calendar.

For more detailed information, use the s command, which displays the entire diary file.

The diary file is displayed using selective display, the same mechanism used in Outline mode (@xref{Outline Mode}). This means that diary entries that are not relevant are made invisible by changing the preceding newline into an ASCII control-m (code 015). These lines are invisible, but they are part of the file; when you save the diary, the control-m characters are saved as newlines so the invisible lines become ordinary lines in the file without changing their visibility status in Emacs.

Because the diary buffer as you see it is an illusion, simply printing the contents will not print what you see on your screen. So there is a special command to print a hard copy of the buffer as it appears; this command is M-x print-diary-entries. It sends the data directly to the printer, and can be customized like lpr-region (@xref{Hardcopy}).

The command M-x diary displays the diary entries for the current date, independently of the calendar display. Entries for the next few days can be displayed as well; the number of days is governed by the variable number-of-diary-entries (see section Customizing the Calendar).

The function diary is suitable for use in your `.emacs' file to display automatically the day's diary entries when you enter Emacs. The mode line of the displayed window will show the date and any holidays that fall on that date. It is sufficient to put this expression in `.emacs':

(diary)

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