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


Fancy Diary Display

Diary display works by preparing the diary buffer and then running the hook diary-display-hook. The default value of this hook (simple-diary-display) hides the irrelevant diary entries and then displays the buffer. However, if you specify the hook as follows,

(add-hook 'diary-display-hook 'fancy-diary-display)

this enables fancy diary display. It displays diary entries and holidays by copying them into a special buffer that exists only for the sake of display. Copying to a separate buffer provides an opportunity to change the displayed text to make it prettier--for example, to sort the entries by the dates they apply to.

As with simple diary display, you can print a hard copy of the buffer with print-diary-entries. To print a hard copy of a day-by-day diary for a week by positioning point on Sunday of that week, type 7 d and then do M-x print-diary-entries. As usual, the inclusion of the holidays slows down the display slightly; you can speed things up by setting the variable holidays-in-diary-buffer to nil.

Ordinarily, the fancy diary buffer does not show days for which there are no diary entries, even if that day is a holiday. If you want such days to be shown in the fancy diary buffer, set the variable diary-list-include-blanks to t.

If you use the fancy diary display, you can use the normal hook list-diary-entries-hook to sort each day's diary entries by their time of day. Here's how:

(add-hook 'list-diary-entries-hook 'sort-diary-entries t)

For each day, this sorts diary entries that begin with a recognizable time of day according to their times. Diary entries without times come first within each day.

Fancy diary display also has the ability to process included diary files. This permits a group of people to share a diary file for events that apply to all of them. Lines in the diary file of this form:

#include "filename"

includes the diary entries from the file filename in the fancy diary buffer. The include mechanism is recursive, so that included files can include other files, and so on; you must be careful not to have a cycle of inclusions, of course. Here is how to enable the include facility:

(add-hook 'list-diary-entries-hook 'include-other-diary-files)
(add-hook 'mark-diary-entries-hook 'mark-included-diary-files)

The include mechanism works only with the fancy diary display, because ordinary diary display shows the entries directly from your diary file.


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