Next: Diary Entries Using non-Gregorian Calendars, Previous: Time Display Format, Up: More advanced features of the Calendar and Diary [Contents][Index]
Ordinarily, the diary window indicates any holidays that fall on the
date of the diary entries, either in the mode line or the buffer itself.
The process of checking for holidays can be slow, depending on the
defined holidays. In that case, setting
nil will speed up the diary display.
diary-number-of-entries controls the number of
days of diary entries to be displayed at one time. It affects the
initial display when
t, as well as the command M-x diary. For example, a value
of 1 (the default) displays only the current day’s diary entries,
whereas a value of 2 will also show the next day’s entries. The value
can also be a vector of seven integers: for example, if the value is
[0 2 2 2 2 4 1] then no diary entries appear on Sunday, the
current date’s and the next day’s diary entries appear Monday through
Thursday, Friday through Monday’s entries appear on Friday, while on
Saturday only that day’s entries appear.
You can customize the form of dates in your diary file by setting the
diary-date-forms. This variable is a list of patterns
for recognizing a date. Each date pattern is a list whose elements may
be regular expressions (see Regular Expressions in the Emacs
Lisp Reference Manual) or the symbols
dayname. All these elements
serve as patterns that match certain kinds of text in the diary file.
In order for the date pattern as a whole to match, all of its elements
must match consecutively.
A regular expression in a date pattern matches in its usual fashion, using the standard syntax table altered so that ‘*’ is a word constituent.
dayname match the month number, day number, year number,
month name, and day name of the date being considered. The symbols that
match numbers allow leading zeros; those that match names allow
capitalization and abbreviation (as specified by
calendar-day-abbrev-array). All the symbols can match ‘*’;
since ‘*’ in a diary entry means “any day”, “any month”, and so
on, it should match regardless of the date being considered.
The default value of
diary-date-forms in the American style is
((month "/" day "[^/0-9]") (month "/" day "/" year "[^0-9]") (monthname " *" day "[^,0-9]") (monthname " *" day ", *" year "[^0-9]") (dayname "\\W"))
diary-iso-date-forms provide other default styles.
The date patterns in the list must be mutually exclusive and
must not match any portion of the diary entry itself, just the date and
one character of whitespace. If, to be mutually exclusive, the pattern
must match a portion of the diary entry text—beyond the whitespace
that ends the date—then the first element of the date pattern
backup. This causes the date recognizer to back
up to the beginning of the current word of the diary entry, after
finishing the match. Even if you use
backup, the date pattern
must absolutely not match more than a portion of the first word of the
diary entry. For example, the default value of
((day "/" month "[^/0-9]") (day "/" month "/" year "[^0-9]") (backup day " *" monthname "\\W+\\<\\([^*0-9]\\|\\([0-9]+[:aApP]\\)\\)") (day " *" monthname " *" year "[^0-9]") (dayname "\\W"))
Notice the use of
backup in the third pattern, because it needs
to match part of a word beyond the date itself to distinguish it from
the fourth pattern.