(lemacs.info)Sexp Diary Entries
Next: Appt Customizing Prev: Included Diary Files Up: Calendar Customization
Sexp Entries and the Fancy Diary Display
Sexp diary entries allow you to do more than just have complicated
conditions under which a diary entry applies. If you use the fancy
diary display, sexp entries can generate the text of the entry depending
on the date itself. For example, an anniversary diary entry can insert
the number of years since the anniversary date into the text of the
diary entry. Thus the `%d' in this dairy entry:
%%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
gets replaced by the age, so on October 31, 1990 the entry appears in
the fancy diary buffer like this:
Arthur's birthday (42 years old)
If the diary file instead contains this entry:
%%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
the entry in the fancy diary buffer for October 31, 1990 appears like
Arthur's 42nd birthday
Similarly, cyclic diary entries can interpolate the number of
repetitions that have occurred:
%%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
looks like this:
Renew medication (5th time)
in the fancy diary display on September 8, 1990.
The generality of sexp diary entries lets you specify any diary entry
that you can describe algorithmically. Suppose you get paid on the 21st
of the month if it is a weekday, and to the Friday before if the 21st is
on a weekend. The diary entry
&%%(let ((dayname (calendar-day-of-week date))
(day (car (cdr date))))
(or (and (= day 21) (memq dayname '(1 2 3 4 5)))
(and (memq day '(19 20)) (= dayname 5)))
) Pay check deposited
applies to just those dates. This example illustrates how the sexp can
depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
that gives the Gregorian date for which the diary entries are being
found. If the value of the expression is `t', the entry applies to
that date. If the expression evaluates to `nil', the entry does *not*
apply to that date.
The following sexp diary entries take advantage of the ability (in
the fancy diary display) to concoct diary entries based on the date:
Make a diary entry for the local times of today's sunrise and
Make a diary entry for the phases (quarters) of the moon.
Make a diary entry with today's day number in the current year and
the number of days remaining in the current year.
Make a diary entry with today's equivalent ISO commercial date.
Make a diary entry with today's equivalent date on the Julian
Make a diary entry with today's equivalent astronomical (Julian)
Make a diary entry with today's equivalent date on the Hebrew
Make a diary entry with today's equivalent date on the Islamic
Make a diary entry with today's equivalent date on the French
Make a diary entry with today's equivalent date on the Mayan
Thus including the diary entry
causes every day's diary display to contain the equivalent date on the
Hebrew calendar, if you are using the fancy diary display. (With simple
diary display, the line `&%%(diary-hebrew-date)' appears in the diary
for any date, but does nothing particularly useful.)
There are a number of other available sexp diary entries that are
important to those who follow the Hebrew calendar:
Make a diary entry that tells the occurrence and ritual
announcement of each new Hebrew month.
Make a Saturday diary entry that tells the weekly synagogue
Make a Friday diary entry that tells the *local time* of Sabbath
Make a diary entry that gives the omer count, when appropriate.
`%%(diary-yahrzeit MONTH DAY YEAR) NAME'
Make a diary entry marking the anniversary of a date of death.
The date is the *Gregorian* (civil) date of death. The diary
entry appears on the proper Hebrew calendar anniversary and on the
day before. (In the European style, the order of the parameters
is changed to DAY, MONTH, YEAR.)
automatically generated by info2www