(lemacs.info)Diary Customizing

Next: Hebrew/Islamic Entries Prev: Daylight Savings Up: Calendar Customization

Customizing the Diary

   Ordinarily, the mode line of the diary buffer window indicates any
holidays that fall on the date of the diary entries.  The process of
checking for holidays can take several seconds, so including holiday
information delays the display of the diary buffer noticeably.  If you'd
prefer to have a faster display of the diary buffer but without the
holiday information, set the variable `holidays-in-diary-buffer' to

   The variable `number-of-diary-entries' controls the number of days
of diary entries to be displayed at one time.  It affects the initial
display when `view-diary-entries-initially' is `t', as well as the
command `M-x diary'.  For example, the default value is 1, which says
to display only the current day's diary entries.  If the value is 2,
both the current day's and the next day's entries are displayed.  The
value can also be a vector of seven elements: 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.

   The variable `print-diary-entries-hook' is a normal hook run after
preparation of a temporary buffer containing just the diary entries
currently visible in the diary buffer.  (The other, irrelevant diary
entries are really absent from the temporary buffer; in the diary
buffer, they are merely hidden.)  The default value of this hook does
the printing with the command `lpr-buffer'.  If you want to use a
different command to do the printing, just change the value of this
hook.  Other uses might include, for example, rearranging the lines into
order by day and time.

   You can customize the form of dates in your diary file, if neither
the standard American nor European styles suits your needs, by setting
the variable `diary-date-forms'.  This variable is a list of forms of
dates recognized in the diary file.  Each form is a list of regular
expressions (Note: Regexps.) and the variables `month', `day',
`year', `monthname', and `dayname'.  The variable `monthname' matches
the name of the month, capitalized or not, or its three-letter
abbreviation, followed by a period or not; it matches `*'.  Similarly,
`dayname' matches the name of the day, capitalized or not, or its
three-letter abbreviation, followed by a period or not.  The variables
`month', `day', and `year' match those numerical values, preceded by
arbitrarily many zeros; they also match `*'.  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"))

Emacs matches of the diary entries with the date forms is done with the
standard syntax table from Fundamental mode (*note Syntax Tables:
(lispref)Syntax Tables.), but with the `*' changed so that it is a word

   The forms on the list must be *mutually exclusive* and must not
match any portion of the diary entry itself, just the date.  If, to be
mutually exclusive, the pattern must match a portion of the diary entry
itself, the first element of the form *must* be `backup'.  This causes
the date recognizer to back up to the beginning of the current word of
the diary entry.  Even if you use `backup', the form must absolutely
not match more than a portion of the first word of the diary entry.
The default value of `diary-date-forms' in the European style is this

     ((day "/" month "[^/0-9]")
      (day "/" month "/" year "[^0-9]")
      (backup day " *" monthname "\\W+\\<[^*0-9]")
      (day " *" monthname " *" year "[^0-9]")
      (dayname "\\W"))

Notice the use of `backup' in the middle form because part of the diary
entry must be matched to distinguish this form from the following one.

automatically generated by info2www