In addition to entries based on calendar dates, your diary file can contain entries based on expressions (sexps) to be evaluated as the diary file is scanned for entries for a given date. Such an entry is indicated by `%%' at the beginning (preceded by `&' for a nonmarking entry), followed by an sexp in parentheses. Here is such a diary entry that will apply to all dates from June 24, 1990 through July 10, 1990:
%%(diary-block 6 24 1990 7 10 1990) Vacation
The `6 24 1990' indicates the starting date and the `7 10 1990' indicates the stopping date. (If you are using the European calendar style, the months and days would be interchanged.) Or, as another example, here is a nonmarking diary entry that applies to the last Thursday in November:
&%%(diary-float 11 4 -1) Payday
In this last example, the `11' specifies November, the `4' specifies Thursday (the fourth day of the week, counting Sunday as zero), and the `-1' specifies "last" (`1' would mean "first", `2' would mean "second", `-2' would mean "second-to-last", and so on). The month can be a single month or a list of months. Thus you could change the `11' above to `'(1 2 3)' and have the entry apply to the last Thursday of January, February, and March. If the month is `t', the entry applies to all months of the year.
Anniversaries of dates can be specifed in the diary with, for example,
%%(diary-anniversary 10 31 1948) Arthur's birthday
This entry will apply to October 31 in any year after 1948; `10 31 1948' specifies the date. (Again, if you are using the European calendar style, the month and day would be interchanged.)
You can specify cyclic diary entries that repeat after a fixed interval of days. For example,
%%(diary-cyclic 50 3 1 1990) Renew medication
will apply to March 1, 1990 and every 50th day following; `3 1 1990' specifies the starting date. (Again, if you are using the European calendar style, the month and day would be interchanged.)
There are Calendar mode commands to help you in making block and anniversary entries to your diary.
insert-anniversary-diary-entry
).
insert-block-diary-entry
).
insert-cyclic-diary-entry
).
If you want to make a diary entry that will apply to the anniversary of a specific date, move point to that date and use the C-c a command. The end of your diary file will be displayed in another window and the anniversary description will be inserted; you can then type the diary entry.
You can make a diary entry entry for a block of dates by setting the mark at the date at one end of the block, moving point to the date at the other end of the block, and using the C-c b command. This command causes the end of your diary file to be displayed in another window and the block description to be inserted; you can then type the diary entry.
If you want to make a cyclic diary entry that will apply to a specific date and every so many days afterward, move point to the starting date and use the C-c c command. You will be asked to type the interval, the end of your diary file will be displayed in another window, and the cyclic description will be inserted; you can then type the diary entry.
All three of the these commands make marking diary entries. If you want the diary entry to be nonmarking, give a numeric argument to the command. For example, C-u C-c a will make a nonmarking anniversary diary entry.
Marking sexp diary entries in the calendar is extremely time-consuming, since every date visible in the calendar window must be individually checked. So these diary entries are much better if they are nonmarking.
The sexp feature of the diary allows you to specify diary entries based on any Emacs-Lisp expression. You can use a library of built-in functions or you can write your own functions. The built-in functions include `diary-block', `diary-float', `diary-anniversary', `diary-cyclic', and others (see section Fancy Diary Display). For more details on these functions and a description of how to write your own functions, use C-h f list-sexp-diary-entries RET after entering the diary.