Next: , Previous: Non-Gregorian Diary, Up: Advanced Calendar/Diary Usage


38.15.7 Fancy Diary Display

Diary display works by preparing the diary buffer and then running the function specified by the variable diary-display-function. The default value (diary-simple-display) hides the irrelevant diary entries and then displays the buffer. The alternative diary-fancy-display 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 diary-print-entries. To print a hard copy of a day-by-day diary for a week, position point on Sunday of that week, type 7 d, and then do M-x diary-print-entries. As usual, the inclusion of the holidays slows down the display slightly; you can speed things up by setting the variable diary-show-holidays-flag 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 diary-list-entries-hook to sort each day's diary entries by their time of day. Here's how:

     (add-hook 'diary-list-entries-hook 'diary-sort-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 starting with diary-include-string:

     #include "filename"

include 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 'diary-list-entries-hook 'diary-include-other-diary-files)
     (add-hook 'diary-mark-entries-hook 'diary-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.