Merge r21-2-24-utf-2000-0_13-0.
[chise/xemacs-chise.git] / info / xemacs.info-14
1 This is ../info/xemacs.info, produced by makeinfo version 3.12s from
2 xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19    Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
25
26    Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
31
32 \1f
33 File: xemacs.info,  Node: To Other Calendar,  Next: From Other Calendar,  Prev: Calendar Systems,  Up: Other Calendars
34
35 Converting To Other Calendars
36 =============================
37
38    The following commands describe the selected date (the date at point)
39 in various other calendar systems:
40
41 `Button2  Other Calendars'
42      Display the date that you click on, expressed in various other
43      calendars.
44
45 `p c'
46      Display ISO commercial calendar equivalent for selected day
47      (`calendar-print-iso-date').
48
49 `p j'
50      Display Julian date for selected day
51      (`calendar-print-julian-date').
52
53 `p a'
54      Display astronomical (Julian) day number for selected day
55      (`calendar-print-astro-day-number').
56
57 `p h'
58      Display Hebrew date for selected day
59      (`calendar-print-hebrew-date').
60
61 `p i'
62      Display Islamic date for selected day
63      (`calendar-print-islamic-date').
64
65 `p f'
66      Display French Revolutionary date for selected day
67      (`calendar-print-french-date').
68
69 `p C'
70      Display Chinese date for selected day
71      (`calendar-print-chinese-date').
72
73 `p k'
74      Display Coptic date for selected day
75      (`calendar-print-coptic-date').
76
77 `p e'
78      Display Ethiopic date for selected day
79      (`calendar-print-ethiopic-date').
80
81 `p p'
82      Display Persian date for selected day
83      (`calendar-print-persian-date').
84
85 `p m'
86      Display Mayan date for selected day (`calendar-print-mayan-date').
87
88    If you are using X, the easiest way to translate a date into other
89 calendars is to click on it with `Button2', then choose `Other
90 Calendars' from the menu that appears.  This displays the equivalent
91 forms of the date in all the calendars Emacs understands, in the form of
92 a menu.  (Choosing an alternative from this menu doesn't actually do
93 anything--the menu is used only for display.)
94
95    Put point on the desired date of the Gregorian calendar, then type
96 the appropriate keys.  The `p' is a mnemonic for "print" since Emacs
97 "prints" the equivalent date in the echo area.
98
99 \1f
100 File: xemacs.info,  Node: From Other Calendar,  Next: Mayan Calendar,  Prev: To Other Calendar,  Up: Other Calendars
101
102 Converting From Other Calendars
103 ===============================
104
105    You can use the other supported calendars to specify a date to move
106 to.  This section describes the commands for doing this using calendars
107 other than Mayan; for the Mayan calendar, see the following section.
108
109 `g c'
110      Move to a date specified in the ISO commercial calendar
111      (`calendar-goto-iso-date').
112
113 `g j'
114      Move to a date specified in the Julian calendar
115      (`calendar-goto-julian-date').
116
117 `g a'
118      Move to a date specified in astronomical (Julian) day number
119      (`calendar-goto-astro-day-number').
120
121 `g h'
122      Move to a date specified in the Hebrew calendar
123      (`calendar-goto-hebrew-date').
124
125 `g i'
126      Move to a date specified in the Islamic calendar
127      (`calendar-goto-islamic-date').
128
129 `g f'
130      Move to a date specified in the French Revolutionary calendar
131      (`calendar-goto-french-date').
132
133 `g C'
134      Move to a date specified in the Chinese calendar
135      (`calendar-goto-chinese-date').
136
137 `g p'
138      Move to a date specified in the Persian calendar
139      (`calendar-goto-persian-date').
140
141 `g k'
142      Move to a date specified in the Coptic calendar
143      (`calendar-goto-coptic-date').
144
145 `g e'
146      Move to a date specified in the Ethiopic calendar
147      (`calendar-goto-ethiopic-date').
148
149    These commands ask you for a date on the other calendar, move point
150 to the Gregorian calendar date equivalent to that date, and display the
151 other calendar's date in the echo area.  Emacs uses strict completion
152 (*note Completion::) whenever it asks you to type a month name, so you
153 don't have to worry about the spelling of Hebrew, Islamic, or French
154 names.
155
156    One common question concerning the Hebrew calendar is the computation
157 of the anniversary of a date of death, called a "yahrzeit."  The Emacs
158 calendar includes a facility for such calculations.  If you are in the
159 calendar, the command `M-x list-yahrzeit-dates' asks you for a range of
160 years and then displays a list of the yahrzeit dates for those years
161 for the date given by point.  If you are not in the calendar, this
162 command first asks you for the date of death and the range of years,
163 and then displays the list of yahrzeit dates.
164
165 \1f
166 File: xemacs.info,  Node: Mayan Calendar,  Next: Diary,  Prev: From Other Calendar,  Up: Other Calendars
167
168 Converting from the Mayan Calendar
169 ----------------------------------
170
171    Here are the commands to select dates based on the Mayan calendar:
172
173 `g m l'
174      Move to a date specified by the long count calendar
175      (`calendar-goto-mayan-long-count-date').
176
177 `g m n t'
178      Move to the next occurrence of a place in the tzolkin calendar
179      (`calendar-next-tzolkin-date').
180
181 `g m p t'
182      Move to the previous occurrence of a place in the tzolkin calendar
183      (`calendar-previous-tzolkin-date').
184
185 `g m n h'
186      Move to the next occurrence of a place in the haab calendar
187      (`calendar-next-haab-date').
188
189 `g m p h'
190      Move to the previous occurrence of a place in the haab calendar
191      (`calendar-previous-haab-date').
192
193 `g m n c'
194      Move to the next occurrence of a place in the calendar round
195      (`calendar-next-calendar-round-date').
196
197 `g m p c'
198      Move to the previous occurrence of a place in the calendar round
199      (`calendar-previous-calendar-round-date').
200
201    To understand these commands, you need to understand the Mayan
202 calendars.  The "long count" is a counting of days with these units:
203
204      1 kin = 1 day   1 uinal = 20 kin   1 tun = 18 uinal
205      1 katun = 20 tun   1 baktun = 20 katun
206
207 Thus, the long count date 12.16.11.16.6 means 12 baktun, 16 katun, 11
208 tun, 16 uinal, and 6 kin.  The Emacs calendar can handle Mayan long
209 count dates as early as 7.17.18.13.1, but no earlier.  When you use the
210 `g m l' command, type the Mayan long count date with the baktun, katun,
211 tun, uinal, and kin separated by periods.
212
213    The Mayan tzolkin calendar is a cycle of 260 days formed by a pair of
214 independent cycles of 13 and 20 days.  Since this cycle repeats
215 endlessly, Emacs provides commands to move backward and forward to the
216 previous or next point in the cycle.  Type `g m p t' to go to the
217 previous tzolkin date; Emacs asks you for a tzolkin date and moves point
218 to the previous occurrence of that date.  Similarly, type `g m n t' to
219 go to the next occurrence of a tzolkin date.
220
221    The Mayan haab calendar is a cycle of 365 days arranged as 18 months
222 of 20 days each, followed a 5-day monthless period.  Like the tzolkin
223 cycle, this cycle repeats endlessly, and there are commands to move
224 backward and forward to the previous or next point in the cycle.  Type
225 `g m p h' to go to the previous haab date; Emacs asks you for a haab
226 date and moves point to the previous occurrence of that date.
227 Similarly, type `g m n h' to go to the next occurrence of a haab date.
228
229    The Maya also used the combination of the tzolkin date and the haab
230 date.  This combination is a cycle of about 52 years called a _calendar
231 round_.  If you type `g m p c', Emacs asks you for both a haab and a
232 tzolkin date and then moves point to the previous occurrence of that
233 combination.  Use `g m n c' to move point to the next occurrence of a
234 combination.  These commands signal an error if the haab/tzolkin date
235 combination you have typed is impossible.
236
237    Emacs uses strict completion (*note Completion::) whenever it asks
238 you to type a Mayan name, so you don't have to worry about spelling.
239
240 \1f
241 File: xemacs.info,  Node: Diary,  Next: Calendar Customization,  Prev: Mayan Calendar,  Up: Calendar/Diary
242
243 The Diary
244 ---------
245
246    The Emacs diary keeps track of appointments or other events on a
247 daily basis, in conjunction with the calendar.  To use the diary
248 feature, you must first create a "diary file" containing a list of
249 events and their dates.  Then Emacs can automatically pick out and
250 display the events for today, for the immediate future, or for any
251 specified date.
252
253    By default, Emacs uses `~/diary' as the diary file.  This is the
254 same file that the `calendar' utility uses.  A sample `~/diary' file is:
255
256      12/22/1988 Twentieth wedding anniversary!!
257      &1/1. Happy New Year!
258      10/22 Ruth's birthday.
259      * 21, *: Payday
260      Tuesday--weekly meeting with grad students at 10am
261               Supowit, Shen, Bitner, and Kapoor to attend.
262      1/13/89 Friday the thirteenth!!
263      &thu 4pm squash game with Lloyd.
264      mar 16 Dad's birthday
265      April 15, 1989 Income tax due.
266      &* 15 time cards due.
267
268 This example uses extra spaces to align the event descriptions of most
269 of the entries.  Such formatting is purely a matter of taste.
270
271    Although you probably will start by creating a diary manually, Emacs
272 provides a number of commands to let you view, add, and change diary
273 entries.  You can also share diary entries with other users (*note
274 Included Diary Files::).
275
276 * Menu:
277
278 * Diary Commands::         Viewing diary entries and associated calendar dates.
279 * Format of Diary File::   Entering events in your diary.
280 * Date Formats::           Various ways you can specify dates.
281 * Adding to Diary::        Commands to create diary entries.
282 * Special Diary Entries::  Anniversaries, blocks of dates, cyclic entries, etc.
283
284 \1f
285 File: xemacs.info,  Node: Diary Commands,  Next: Format of Diary File,  Prev: Diary,  Up: Diary
286
287 Commands Displaying Diary Entries
288 ---------------------------------
289
290    Once you have created a `~/diary' file, you can use the calendar to
291 view it.  You can also view today's events outside of Calendar mode.
292
293 `d'
294      Display all diary entries for the selected date
295      (`view-diary-entries').
296
297 `Button2 Diary'
298      Display all diary entries for the date you click on.
299
300 `s'
301      Display the entire diary file (`show-all-diary-entries').
302
303 `m'
304      Mark all visible dates that have diary entries
305      (`mark-diary-entries').
306
307 `u'
308      Unmark the calendar window (`calendar-unmark').
309
310 `M-x print-diary-entries'
311      Print hard copy of the diary display as it appears.
312
313 `M-x diary'
314      Display all diary entries for today's date.
315
316 `M-x diary-mail-entries'
317      Mail yourself email reminders about upcoming diary entries.
318
319    Displaying the diary entries with `d' shows in a separate window the
320 diary entries for the selected date in the calendar.  The mode line of
321 the new window shows the date of the diary entries and any holidays
322 that fall on that date.  If you specify a numeric argument with `d', it
323 shows all the diary entries for that many successive days.  Thus, `2 d'
324 displays all the entries for the selected date and for the following
325 day.
326
327    Another way to display the diary entries for a date is to click
328 `Button2' on the date, and then choose `Diary' from the menu that
329 appears.
330
331    To get a broader view of which days are mentioned in the diary, use
332 the `m' command.  This displays the dates that have diary entries in a
333 different face (or places a `+' after these dates, if display with
334 multiple faces is not available).  The command applies both to the
335 currently visible months and to other months that subsequently become
336 visible by scrolling.  To turn marking off and erase the current marks,
337 type `u', which also turns off holiday marks (*note Holidays::).
338
339    To see the full diary file, rather than just some of the entries, use
340 the `s' command.
341
342    Display of selected diary entries uses the selective display feature
343 to hide entries that don't apply.
344
345    The diary buffer as you see it is an illusion, so simply printing the
346 buffer does not print what you see on your screen.  There is a special
347 command to print hard copy of the diary buffer _as it appears_; this
348 command is `M-x print-diary-entries'.  It sends the data directly to
349 the printer.  You can customize it like `lpr-region' (*note Hardcopy::).
350
351    The command `M-x diary' displays the diary entries for the current
352 date, independently of the calendar display, and optionally for the next
353 few days as well; the variable `number-of-diary-entries' specifies how
354 many days to include (*note Customization::).
355
356    If you put `(diary)' in your `.emacs' file, this automatically
357 displays a window with the day's diary entries, when you enter Emacs.
358 The mode line of the displayed window shows the date and any holidays
359 that fall on that date.
360
361    Many users like to receive notice of events in their diary as email.
362 To send such mail to yourself, use the command `M-x
363 diary-mail-entries'.  A prefix argument specifies how many days
364 (starting with today) to check; otherwise, the variable
365 `diary-mail-days' says how many days.
366
367 \1f
368 File: xemacs.info,  Node: Format of Diary File,  Next: Date Formats,  Prev: Diary Commands,  Up: Diary
369
370 The Diary File
371 --------------
372
373    Your "diary file" is a file that records events associated with
374 particular dates.  The name of the diary file is specified by the
375 variable `diary-file'; `~/diary' is the default.  The `calendar'
376 utility program supports a subset of the format allowed by the Emacs
377 diary facilities, so you can use that utility to view the diary file,
378 with reasonable results aside from the entries it cannot understand.
379
380    Each entry in the diary file describes one event and consists of one
381 or more lines.  An entry always begins with a date specification at the
382 left margin.  The rest of the entry is simply text to describe the
383 event.  If the entry has more than one line, then the lines after the
384 first must begin with whitespace to indicate they continue a previous
385 entry.  Lines that do not begin with valid dates and do not continue a
386 preceding entry are ignored.
387
388    You can inhibit the marking of certain diary entries in the calendar
389 window; to do this, insert an ampersand (`&') at the beginning of the
390 entry, before the date.  This has no effect on display of the entry in
391 the diary window; it affects only marks on dates in the calendar
392 window.  Nonmarking entries are especially useful for generic entries
393 that would otherwise mark many different dates.
394
395    If the first line of a diary entry consists only of the date or day
396 name with no following blanks or punctuation, then the diary window
397 display doesn't include that line; only the continuation lines appear.
398 For example, this entry:
399
400      02/11/1989
401            Bill B. visits Princeton today
402            2pm Cognitive Studies Committee meeting
403            2:30-5:30 Liz at Lawrenceville
404            4:00pm Dentist appt
405            7:30pm Dinner at George's
406            8:00-10:00pm concert
407
408 appears in the diary window without the date line at the beginning.
409 This style of entry looks neater when you display just a single day's
410 entries, but can cause confusion if you ask for more than one day's
411 entries.
412
413    You can edit the diary entries as they appear in the window, but it
414 is important to remember that the buffer displayed contains the _entire_
415 diary file, with portions of it concealed from view.  This means, for
416 instance, that the `C-f' (`forward-char') command can put point at what
417 appears to be the end of the line, but what is in reality the middle of
418 some concealed line.
419
420    _Be careful when editing the diary entries!_  Inserting additional
421 lines or adding/deleting characters in the middle of a visible line
422 cannot cause problems, but editing at the end of a line may not do what
423 you expect.  Deleting a line may delete other invisible entries that
424 follow it.  Before editing the diary, it is best to display the entire
425 file with `s' (`show-all-diary-entries').
426
427 \1f
428 File: xemacs.info,  Node: Date Formats,  Next: Adding to Diary,  Prev: Format of Diary File,  Up: Diary
429
430 Date Formats
431 ------------
432
433    Here are some sample diary entries, illustrating different ways of
434 formatting a date.  The examples all show dates in American order
435 (month, day, year), but Calendar mode supports European order (day,
436 month, year) as an option.
437
438      4/20/93  Switch-over to new tabulation system
439      apr. 25  Start tabulating annual results
440      4/30  Results for April are due
441      */25  Monthly cycle finishes
442      Friday  Don't leave without backing up files
443
444    The first entry appears only once, on April 20, 1993.  The second and
445 third appear every year on the specified dates, and the fourth uses a
446 wildcard (asterisk) for the month, so it appears on the 25th of every
447 month.  The final entry appears every week on Friday.
448
449    You can use just numbers to express a date, as in `MONTH/DAY' or
450 `MONTH/DAY/YEAR'.  This must be followed by a nondigit.  In the date
451 itself, MONTH and DAY are numbers of one or two digits.  The optional
452 YEAR is also a number, and may be abbreviated to the last two digits;
453 that is, you can use `11/12/1989' or `11/12/89'.
454
455    Dates can also have the form `MONTHNAME DAY' or `MONTHNAME DAY,
456 YEAR', where the month's name can be spelled in full or abbreviated to
457 three characters (with or without a period).  Case is not significant.
458
459    A date may be "generic"; that is, partially unspecified.  Then the
460 entry applies to all dates that match the specification.  If the date
461 does not contain a year, it is generic and applies to any year.
462 Alternatively, MONTH, DAY, or YEAR can be a `*'; this matches any
463 month, day, or year, respectively.  Thus, a diary entry `3/*/*' matches
464 any day in March of any year; so does `march *'.
465
466    If you prefer the European style of writing dates--in which the day
467 comes before the month--type `M-x european-calendar' while in the
468 calendar, or set the variable `european-calendar-style' to `t' _before_
469 using any calendar or diary command.  This mode interprets all dates in
470 the diary in the European manner, and also uses European style for
471 displaying diary dates.  (Note that there is no comma after the
472 MONTHNAME in the European style.)  To go back to the (default) American
473 style of writing dates, type `M-x american-calendar'.
474
475    You can use the name of a day of the week as a generic date which
476 applies to any date falling on that day of the week.  You can abbreviate
477 the day of the week to three letters (with or without a period) or spell
478 it in full; case is not significant.
479
480 \1f
481 File: xemacs.info,  Node: Adding to Diary,  Next: Special Diary Entries,  Prev: Date Formats,  Up: Diary
482
483 Commands to Add to the Diary
484 ----------------------------
485
486    While in the calendar, there are several commands to create diary
487 entries:
488
489 `i d'
490      Add a diary entry for the selected date (`insert-diary-entry').
491
492 `i w'
493      Add a diary entry for the selected day of the week
494      (`insert-weekly-diary-entry').
495
496 `i m'
497      Add a diary entry for the selected day of the month
498      (`insert-monthly-diary-entry').
499
500 `i y'
501      Add a diary entry for the selected day of the year
502      (`insert-yearly-diary-entry').
503
504    You can make a diary entry for a specific date by selecting that date
505 in the calendar window and typing the `i d' command.  This command
506 displays the end of your diary file in another window and inserts the
507 date; you can then type the rest of the diary entry.
508
509    If you want to make a diary entry that applies to a specific day of
510 the week, select that day of the week (any occurrence will do) and type
511 `i w'.  This inserts the day-of-week as a generic date; you can then
512 type the rest of the diary entry.  You can make a monthly diary entry in
513 the same fashion.  Select the day of the month, use the `i m' command,
514 and type rest of the entry.  Similarly, you can insert a yearly diary
515 entry with the `i y' command.
516
517    All of the above commands make marking diary entries by default.  To
518 make a nonmarking diary entry, give a numeric argument to the command.
519 For example, `C-u i w' makes a nonmarking weekly diary entry.
520
521    When you modify the diary file, be sure to save the file before
522 exiting Emacs.
523
524 \1f
525 File: xemacs.info,  Node: Special Diary Entries,  Prev: Adding to Diary,  Up: Diary
526
527 Special Diary Entries
528 ---------------------
529
530    In addition to entries based on calendar dates, the diary file can
531 contain "sexp entries" for regular events such as anniversaries.  These
532 entries are based on Lisp expressions (sexps) that Emacs evaluates as
533 it scans the diary file.  Instead of a date, a sexp entry contains `%%'
534 followed by a Lisp expression which must begin and end with
535 parentheses.  The Lisp expression determines which dates the entry
536 applies to.
537
538    Calendar mode provides commands to insert certain commonly used sexp
539 entries:
540
541 `i a'
542      Add an anniversary diary entry for the selected date
543      (`insert-anniversary-diary-entry').
544
545 `i b'
546      Add a block diary entry for the current region
547      (`insert-block-diary-entry').
548
549 `i c'
550      Add a cyclic diary entry starting at the date
551      (`insert-cyclic-diary-entry').
552
553    If you want to make a diary entry that applies to the anniversary of
554 a specific date, move point to that date and use the `i a' command.
555 This displays the end of your diary file in another window and inserts
556 the anniversary description; you can then type the rest of the diary
557 entry. The entry looks like this:
558
559    The effect of `i a' is to add a `diary-anniversary' sexp to your
560 diary file.  You can also add one manually, for instance:
561
562      %%(diary-anniversary 10 31 1948) Arthur's birthday
563
564 This entry applies to October 31 in any year after 1948; `10 31 1948'
565 specifies the date.  (If you are using the European calendar style, the
566 month and day are interchanged.)  The reason this expression requires a
567 beginning year is that advanced diary functions can use it to calculate
568 the number of elapsed years.
569
570    A "block" diary entry applies to a specified range of consecutive
571 dates.  Here is a block diary entry that applies to all dates from June
572 24, 1990 through July 10, 1990:
573
574      %%(diary-block 6 24 1990 7 10 1990) Vacation
575
576 The `6 24 1990' indicates the starting date and the `7 10 1990'
577 indicates the stopping date.  (Again, if you are using the European
578 calendar style, the month and day are interchanged.)
579
580    To insert a block entry, place point and the mark on the two dates
581 that begin and end the range, and type `i b'.  This command displays
582 the end of your diary file in another window and inserts the block
583 description; you can then type the diary entry.
584
585    "Cyclic" diary entries repeat after a fixed interval of days.  To
586 create one, select the starting date and use the `i c' command.  The
587 command prompts for the length of interval, then inserts the entry,
588 which looks like this:
589
590      %%(diary-cyclic 50 3 1 1990) Renew medication
591
592 This entry applies to March 1, 1990 and every 50th day following; `3 1
593 1990' specifies the starting date.  (If you are using the European
594 calendar style, the month and day are interchanged.)
595
596    All three of these commands make marking diary entries.  To insert a
597 nonmarking entry, give a numeric argument to the command.  For example,
598 `C-u i a' makes a nonmarking anniversary diary entry.
599
600    Marking sexp diary entries in the calendar is _extremely_
601 time-consuming, since every date visible in the calendar window must be
602 individually checked.  So it's a good idea to make sexp diary entries
603 nonmarking (with `&') when possible.
604
605    Another sophisticated kind of sexp entry, a "floating" diary entry,
606 specifies a regularly occurring event by offsets specified in days,
607 weeks, and months.  It is comparable to a crontab entry interpreted by
608 the `cron' utility.  Here is a nonmarking, floating diary entry that
609 applies to the last Thursday in November:
610
611      &%%(diary-float 11 4 -1) American Thanksgiving
612
613 The 11 specifies November (the eleventh month), the 4 specifies Thursday
614 (the fourth day of the week, where Sunday is numbered zero), and the -1
615 specifies "last" (1 would mean "first", 2 would mean "second", -2 would
616 mean "second-to-last", and so on).  The month can be a single month or
617 a list of months.  Thus you could change the 11 above to `'(1 2 3)' and
618 have the entry apply to the last Thursday of January, February, and
619 March.  If the month is `t', the entry applies to all months of the
620 year.
621
622    The sexp feature of the diary allows you to specify diary entries
623 based on any Emacs Lisp expression.  You can use the library of built-in
624 functions or you can write your own functions.  The built-in functions
625 include the ones shown in this section, plus a few others (*note Sexp
626 Diary Entries::).
627
628    The generality of sexps lets you specify any diary entry that you can
629 describe algorithmically.  Suppose you get paid on the 21st of the month
630 if it is a weekday, and to the Friday before if the 21st is on a
631 weekend.  The diary entry
632
633      &%%(let ((dayname (calendar-day-of-week date))
634               (day (car (cdr date))))
635            (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
636                (and (memq day '(19 20)) (= dayname 5)))
637               ) Pay check deposited
638
639 to just those dates.  This example illustrates how the sexp can depend
640 on the variable `date'; this variable is a list (MONTH DAY YEAR) that
641 gives the Gregorian date for which the diary entries are being found.
642 If the value of the sexp is `t', the entry applies to that date.  If
643 the sexp evaluates to `nil', the entry does _not_ apply to that date.
644
645 \1f
646 File: xemacs.info,  Node: Calendar Customization,  Prev: Diary,  Up: Calendar/Diary
647
648 Customizing the Calendar and Diary
649 ----------------------------------
650
651    There are many customizations that you can use to make the calendar
652 and diary suit your personal tastes.
653
654 * Menu:
655
656 * Calendar Customizing::   Defaults you can set.
657 * Holiday Customizing::    Defining your own holidays.
658 * Date Display Format::    Changing the format.
659 * Time Display Format::    Changing the format.
660 * Daylight Savings::       Changing the default.
661 * Diary Customizing::      Defaults you can set.
662 * Hebrew/Islamic Entries:: How to obtain them.
663 * Fancy Diary Display::    Enhancing the diary display, sorting entries.
664 * Included Diary Files::   Sharing a common diary file.
665 * Sexp Diary Entries::     Fancy things you can do.
666 * Appt Customizing::       Customizing appointment reminders.
667
668 \1f
669 File: xemacs.info,  Node: Calendar Customizing,  Next: Holiday Customizing,  Up: Calendar Customization
670
671 Customizing the Calendar
672 ........................
673
674    If you set the variable `view-diary-entries-initially' to `t',
675 calling up the calendar automatically displays the diary entries for
676 the current date as well.  The diary dates appear only if the current
677 date is visible.  If you add both of the following lines to your
678 `.emacs' file:
679
680      (setq view-diary-entries-initially t)
681      (calendar)
682
683 this displays both the calendar and diary windows whenever you start
684 Emacs.
685
686    Similarly, if you set the variable
687 `view-calendar-holidays-initially' to `t', entering the calendar
688 automatically displays a list of holidays for the current three-month
689 period.  The holiday list appears in a separate window.
690
691    You can set the variable `mark-diary-entries-in-calendar' to `t' in
692 order to mark any dates with diary entries.  This takes effect whenever
693 the calendar window contents are recomputed.  There are two ways of
694 marking these dates: by changing the face (*note Faces::), if the
695 display supports that, or by placing a plus sign (`+') beside the date
696 otherwise.
697
698    Similarly, setting the variable `mark-holidays-in-calendar' to `t'
699 marks holiday dates, either with a change of face or with an asterisk
700 (`*').
701
702    The variable `calendar-holiday-marker' specifies how to mark a date
703 as being a holiday.  Its value may be a character to insert next to the
704 date, or a face name to use for displaying the date.  Likewise, the
705 variable `diary-entry-marker' specifies how to mark a date that has
706 diary entries.  The calendar creates faces named `holiday-face' and
707 `diary-face' for these purposes; those symbols are the default values
708 of these variables, when Emacs supports multiple faces on your terminal.
709
710    The variable `calendar-load-hook' is a normal hook run when the
711 calendar package is first loaded (before actually starting to display
712 the calendar).
713
714    Starting the calendar runs the normal hook
715 `initial-calendar-window-hook'.  Recomputation of the calendar display
716 does not run this hook.  But if you leave the calendar with the `q'
717 command and reenter it, the hook runs again.
718
719    The variable `today-visible-calendar-hook' is a normal hook run
720 after the calendar buffer has been prepared with the calendar when the
721 current date is visible in the window.  One use of this hook is to
722 replace today's date with asterisks; to do that, use the hook function
723 `calendar-star-date'.
724
725      (add-hook 'today-visible-calendar-hook 'calendar-star-date)
726
727 Another standard hook function marks the current date, either by
728 changing its face or by adding an asterisk.  Here's how to use it:
729
730      (add-hook 'today-visible-calendar-hook 'calendar-mark-today)
731
732 The variable `calendar-today-marker' specifies how to mark today's
733 date.  Its value should be a character to insert next to the date or a
734 face name to use for displaying the date.  A face named
735 `calendar-today-face' is provided for this purpose; that symbol is the
736 default for this variable when Emacs supports multiple faces on your
737 terminal.
738
739 A similar normal hook, `today-invisible-calendar-hook' is run if the
740 current date is _not_ visible in the window.
741
742 \1f
743 File: xemacs.info,  Node: Holiday Customizing,  Next: Date Display Format,  Prev: Calendar Customizing,  Up: Calendar Customization
744
745 Customizing the Holidays
746 ........................
747
748    Emacs knows about holidays defined by entries on one of several
749 lists.  You can customize these lists of holidays to your own needs,
750 adding or deleting holidays.  The lists of holidays that Emacs uses are
751 for general holidays (`general-holidays'), local holidays
752 (`local-holidays'), Christian holidays (`christian-holidays'), Hebrew
753 (Jewish) holidays (`hebrew-holidays'), Islamic (Moslem) holidays
754 (`islamic-holidays'), and other holidays (`other-holidays').
755
756    The general holidays are, by default, holidays common throughout the
757 United States.  To eliminate these holidays, set `general-holidays' to
758 `nil'.
759
760    There are no default local holidays (but sites may supply some).  You
761 can set the variable `local-holidays' to any list of holidays, as
762 described below.
763
764    By default, Emacs does not include all the holidays of the religions
765 that it knows, only those commonly found in secular calendars.  For a
766 more extensive collection of religious holidays, you can set any (or
767 all) of the variables `all-christian-calendar-holidays',
768 `all-hebrew-calendar-holidays', or `all-islamic-calendar-holidays' to
769 `t'.  If you want to eliminate the religious holidays, set any or all
770 of the corresponding variables `christian-holidays', `hebrew-holidays',
771 and `islamic-holidays' to `nil'.
772
773    You can set the variable `other-holidays' to any list of holidays.
774 This list, normally empty, is intended for individual use.
775
776    Each of the lists (`general-holidays', `local-holidays',
777 `christian-holidays', `hebrew-holidays', `islamic-holidays', and
778 `other-holidays') is a list of "holiday forms", each holiday form
779 describing a holiday (or sometimes a list of holidays).
780
781    Here is a table of the possible kinds of holiday form.  Day numbers
782 and month numbers count starting from 1, but "dayname" numbers count
783 Sunday as 0.  The element STRING is always the name of the holiday, as
784 a string.
785
786 `(holiday-fixed MONTH DAY STRING)'
787      A fixed date on the Gregorian calendar.  MONTH and DAY are
788      numbers, STRING is the name of the holiday.
789
790 `(holiday-float MONTH DAYNAME K STRING)'
791      The Kth DAYNAME in MONTH on the Gregorian calendar (DAYNAME=0 for
792      Sunday, and so on); negative K means count back from the end of
793      the month.  STRING is the name of the holiday.
794
795 `(holiday-hebrew MONTH DAY STRING)'
796      A fixed date on the Hebrew calendar.  MONTH and DAY are numbers,
797      STRING is the name of the holiday.
798
799 `(holiday-islamic MONTH DAY STRING)'
800      A fixed date on the Islamic calendar.  MONTH and DAY are numbers,
801      STRING is the name of the holiday.
802
803 `(holiday-julian MONTH DAY STRING)'
804      A fixed date on the Julian calendar.  MONTH and DAY are numbers,
805      STRING is the name of the holiday.
806
807 `(holiday-sexp SEXP STRING)'
808      A date calculated by the Lisp expression SEXP.  The expression
809      should use the variable `year' to compute and return the date of a
810      holiday, or `nil' if the holiday doesn't happen this year.  The
811      value of SEXP must represent the date as a list of the form
812      `(MONTH DAY YEAR)'.  STRING is the name of the holiday.
813
814 `(if CONDITION HOLIDAY-FORM &optional HOLIDAY-FORM)'
815      A holiday that happens only if CONDITION is true.
816
817 `(FUNCTION [ARGS])'
818      A list of dates calculated by the function FUNCTION, called with
819      arguments ARGS.
820
821    For example, suppose you want to add Bastille Day, celebrated in
822 France on July 14.  You can do this by adding the following line to
823 your `.emacs' file:
824
825      (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
826
827 The holiday form `(holiday-fixed 7 14 "Bastille Day")' specifies the
828 fourteenth day of the seventh month (July).
829
830    Many holidays occur on a specific day of the week, at a specific time
831 of month.  Here is a holiday form describing Hurricane Supplication Day,
832 celebrated in the Virgin Islands on the fourth Monday in August:
833
834      (holiday-float 8 1 4 "Hurricane Supplication Day")
835
836 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
837 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
838 the month (1 specifies the first occurrence, 2 the second occurrence,
839 -1 the last occurrence, -2 the second-to-last occurrence, and so on).
840
841    You can specify holidays that occur on fixed days of the Hebrew,
842 Islamic, and Julian calendars too.  For example,
843
844      (setq other-holidays
845            '((holiday-hebrew 10 2 "Last day of Hanukkah")
846              (holiday-islamic 3 12 "Mohammed's Birthday")
847              (holiday-julian 4 2 "Jefferson's Birthday")))
848
849 adds the last day of Hanukkah (since the Hebrew months are numbered with
850 1 starting from Nisan), the Islamic feast celebrating Mohammed's
851 birthday (since the Islamic months are numbered from 1 starting with
852 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
853 Julian calendar.
854
855    To include a holiday conditionally, use either Emacs Lisp's `if' or
856 the `holiday-sexp' form.  For example, American presidential elections
857 occur on the first Tuesday after the first Monday in November of years
858 divisible by 4:
859
860      (holiday-sexp (if (= 0 (% year 4))
861                         (calendar-gregorian-from-absolute
862                       (1+ (calendar-dayname-on-or-before
863                             1 (+ 6 (calendar-absolute-from-gregorian
864                                      (list 11 1 year))))))
865                    "US Presidential Election"))
866
867 or
868
869      (if (= 0 (% displayed-year 4))
870          (fixed 11
871                 (extract-calendar-day
872                   (calendar-gregorian-from-absolute
873                     (1+ (calendar-dayname-on-or-before
874                           1 (+ 6 (calendar-absolute-from-gregorian
875                                    (list 11 1 displayed-year)))))))
876                 "US Presidential Election"))
877
878    Some holidays just don't fit into any of these forms because special
879 calculations are involved in their determination.  In such cases you
880 must write a Lisp function to do the calculation.  To include eclipses,
881 for example, add `(eclipses)' to `other-holidays' and write an Emacs
882 Lisp function `eclipses' that returns a (possibly empty) list of the
883 relevant Gregorian dates among the range visible in the calendar
884 window, with descriptive strings, like this:
885
886      (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
887
888 \1f
889 File: xemacs.info,  Node: Date Display Format,  Next: Time Display Format,  Prev: Holiday Customizing,  Up: Calendar Customization
890
891 Date Display Format
892 ...................
893
894    You can customize the manner of displaying dates in the diary, in
895 mode lines, and in messages by setting `calendar-date-display-form'.
896 This variable holds a list of expressions that can involve the variables
897 `month', `day', and `year', which are all numbers in string form, and
898 `monthname' and `dayname', which are both alphabetic strings.  In the
899 American style, the default value of this list is as follows:
900
901      ((if dayname (concat dayname ", ")) monthname " " day ", " year)
902
903 while in the European style this value is the default:
904
905      ((if dayname (concat dayname ", ")) day " " monthname " " year)
906
907    + The ISO standard date representation is this:
908
909      (year "-" month "-" day)
910
911 This specifies a typical American format:
912
913      (month "/" day "/" (substring year -2))
914
915 \1f
916 File: xemacs.info,  Node: Time Display Format,  Next: Daylight Savings,  Prev: Date Display Format,  Up: Calendar Customization
917
918 Time Display Format
919 ...................
920
921    The calendar and diary by default display times of day in the
922 conventional American style with the hours from 1 through 12, minutes,
923 and either `am' or `pm'.  If you prefer the European style, also known
924 in the US as military, in which the hours go from 00 to 23, you can
925 alter the variable `calendar-time-display-form'.  This variable is a
926 list of expressions that can involve the variables `12-hours',
927 `24-hours', and `minutes', which are all numbers in string form, and
928 `am-pm' and `time-zone', which are both alphabetic strings.  The
929 default value of `calendar-time-display-form' is as follows:
930
931      (12-hours ":" minutes am-pm
932                (if time-zone " (") time-zone (if time-zone ")"))
933
934 Here is a value that provides European style times:
935
936      (24-hours ":" minutes
937                (if time-zone " (") time-zone (if time-zone ")"))
938
939 gives military-style times like `21:07 (UT)' if time zone names are
940 defined, and times like `21:07' if they are not.
941
942 \1f
943 File: xemacs.info,  Node: Daylight Savings,  Next: Diary Customizing,  Prev: Time Display Format,  Up: Calendar Customization
944
945 Daylight Savings Time
946 .....................
947
948    Emacs understands the difference between standard time and daylight
949 savings time--the times given for sunrise, sunset, solstices,
950 equinoxes, and the phases of the moon take that into account.  The rules
951 for daylight savings time vary from place to place and have also varied
952 historically from year to year.  To do the job properly, Emacs needs to
953 know which rules to use.
954
955    Some operating systems keep track of the rules that apply to the
956 place where you are; on these systems, Emacs gets the information it
957 needs from the system automatically.  If some or all of this
958 information is missing, Emacs fills in the gaps with the rules
959 currently used in Cambridge, Massachusetts.  If the resulting rules are
960 not what you want, you can tell Emacs the rules to use by setting
961 certain variables.
962
963    If the default choice of rules is not appropriate for your location,
964 you can tell Emacs the rules to use by setting the variables
965 `calendar-daylight-savings-starts' and
966 `calendar-daylight-savings-ends'.  Their values should be Lisp
967 expressions that refer to the variable `year', and evaluate to the
968 Gregorian date on which daylight savings time starts or (respectively)
969 ends, in the form of a list `(MONTH DAY YEAR)'.  The values should be
970 `nil' if your area does not use daylight savings time.
971
972    Emacs uses these expressions to determine the starting date of
973 daylight savings time for the holiday list  and for correcting times of
974 day in the solar and lunar calculations.
975
976    The values for Cambridge, Massachusetts are as follows:
977
978      (calendar-nth-named-day 1 0 4 year)
979      (calendar-nth-named-day -1 0 10 year)
980
981 That is, the first 0th day (Sunday) of the fourth month (April) in the
982 year specified by `year', and the last Sunday of the tenth month
983 (October) of that year.  If daylight savings time were changed to start
984 on October 1, you would set `calendar-daylight-savings-starts' to this:
985
986      (list 10 1 year)
987
988    For a more complex example, suppose daylight savings time begins on
989 the first of Nisan on the Hebrew calendar.  You should set
990 `calendar-daylight-savings-starts' to this value:
991
992      (calendar-gregorian-from-absolute
993        (calendar-absolute-from-hebrew
994          (list 1 1 (+ year 3760))))
995
996 because Nisan is the first month in the Hebrew calendar and the Hebrew
997 year differs from the Gregorian year by 3760 at Nisan.
998
999    If there is no daylight savings time at your location, or if you want
1000 all times in standard time, set `calendar-daylight-savings-starts' and
1001 `calendar-daylight-savings-ends' to `nil'.
1002
1003    The variable `calendar-daylight-time-offset' specifies the
1004 difference between daylight savings time and standard time, measured in
1005 minutes.  The value for Cambridge, Massachusetts is 60.
1006
1007    The two variables `calendar-daylight-savings-starts-time' and
1008 `calendar-daylight-savings-ends-time' specify the number of minutes
1009 after midnight local time when the transition to and from daylight
1010 savings time should occur.  For Cambridge, Massachusetts both variables'
1011 values are 120.
1012
1013 \1f
1014 File: xemacs.info,  Node: Diary Customizing,  Next: Hebrew/Islamic Entries,  Prev: Daylight Savings,  Up: Calendar Customization
1015
1016 Customizing the Diary
1017 .....................
1018
1019    Ordinarily, the mode line of the diary buffer window indicates any
1020 holidays that fall on the date of the diary entries.  The process of
1021 checking for holidays can take several seconds, so including holiday
1022 information delays the display of the diary buffer noticeably.  If you'd
1023 prefer to have a faster display of the diary buffer but without the
1024 holiday information, set the variable `holidays-in-diary-buffer' to
1025 `nil'.
1026
1027    The variable `number-of-diary-entries' controls the number of days
1028 of diary entries to be displayed at one time.  It affects the initial
1029 display when `view-diary-entries-initially' is `t', as well as the
1030 command `M-x diary'.  For example, the default value is 1, which says
1031 to display only the current day's diary entries.  If the value is 2,
1032 both the current day's and the next day's entries are displayed.  The
1033 value can also be a vector of seven elements: for example, if the value
1034 is `[0 2 2 2 2 4 1]' then no diary entries appear on Sunday, the
1035 current date's and the next day's diary entries appear Monday through
1036 Thursday, Friday through Monday's entries appear on Friday, while on
1037 Saturday only that day's entries appear.
1038
1039    The variable `print-diary-entries-hook' is a normal hook run after
1040 preparation of a temporary buffer containing just the diary entries
1041 currently visible in the diary buffer.  (The other, irrelevant diary
1042 entries are really absent from the temporary buffer; in the diary
1043 buffer, they are merely hidden.)  The default value of this hook does
1044 the printing with the command `lpr-buffer'.  If you want to use a
1045 different command to do the printing, just change the value of this
1046 hook.  Other uses might include, for example, rearranging the lines into
1047 order by day and time.
1048
1049    You can customize the form of dates in your diary file, if neither
1050 the standard American nor European styles suits your needs, by setting
1051 the variable `diary-date-forms'.  This variable is a list of patterns
1052 for recognizing a date.  Each date pattern is a list whose elements may
1053 be regular expressions (*note Regexps::) or the symbols `month', `day',
1054 `year', `monthname', and `dayname'.  All these elements serve as
1055 patterns that match certain kinds of text in the diary file.  In order
1056 for the date pattern, as a whole, to match, all of its elements must
1057 match consecutively.
1058
1059    A regular expression in a date pattern matches in its usual fashion,
1060 using the standard syntax table altered so that `*' is a word
1061 constituent.
1062
1063    The symbols `month', `day', `year', `monthname', and `dayname' match
1064 the month number, day number, year number, month name, and day name of
1065 the date being considered.  The symbols that match numbers allow
1066 leading zeros; those that match names allow three-letter abbreviations
1067 and capitalization.  All the symbols can match `*'; since `*' in a
1068 diary entry means "any day", "any month", and so on, it should match
1069 regardless of the date being considered.
1070
1071    The default value of `diary-date-forms' in the American style is
1072 this:
1073
1074      ((month "/" day "[^/0-9]")
1075       (month "/" day "/" year "[^0-9]")
1076       (monthname " *" day "[^,0-9]")
1077       (monthname " *" day ", *" year "[^0-9]")
1078       (dayname "\\W"))
1079
1080 Emacs matches of the diary entries with the date forms is done with the
1081 standard syntax table from Fundamental mode (*note Syntax Tables:
1082 (lispref)Syntax Tables.), but with the `*' changed so that it is a word
1083 constituent.
1084
1085    The date patterns in the list must be _mutually exclusive_ and must
1086 not match any portion of the diary entry itself, just the date and one
1087 character of whitespace.  If, to be mutually exclusive, the pattern
1088 must match a portion of the diary entry text--beyond the whitespace
1089 that ends the date--then the first element of the date pattern _must_
1090 be `backup'.  This causes the date recognizer to back up to the
1091 beginning of the current word of the diary entry, after finishing the
1092 match.  Even if you use `backup', the date pattern must absolutely not
1093 match more than a portion of the first word of the diary entry.  The
1094 default value of `diary-date-forms' in the European style is this list:
1095
1096      ((day "/" month "[^/0-9]")
1097       (day "/" month "/" year "[^0-9]")
1098       (backup day " *" monthname "\\W+\\<[^*0-9]")
1099       (day " *" monthname " *" year "[^0-9]")
1100       (dayname "\\W"))
1101
1102 Notice the use of `backup' in the third pattern, because it needs to
1103 match part of a word beyond the date itself to distinguish it from the
1104 fourth pattern.
1105
1106 \1f
1107 File: xemacs.info,  Node: Hebrew/Islamic Entries,  Next: Fancy Diary Display,  Prev: Diary Customizing,  Up: Calendar Customization
1108
1109 Hebrew- and Islamic-Date Diary Entries
1110 ......................................
1111
1112    Your diary file can have entries based on Hebrew or Islamic dates, as
1113 well as entries based on the world-standard Gregorian calendar.
1114 However, because recognition of such entries is time-consuming and most
1115 people don't use them, you must explicitly enable their use.  If you
1116 want the diary to recognize Hebrew-date diary entries, for example, you
1117 must do this:
1118
1119      (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
1120      (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
1121
1122 If you want Islamic-date entries, do this:
1123
1124      (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
1125      (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
1126
1127    Hebrew- and Islamic-date diary entries have the same formats as
1128 Gregorian-date diary entries, except that `H' precedes a Hebrew date
1129 and `I' precedes an Islamic date.  Moreover, because the Hebrew and
1130 Islamic month names are not uniquely specified by the first three
1131 letters, you may not abbreviate them.  For example, a diary entry for
1132 the Hebrew date Heshvan 25 could look like this:
1133
1134      HHeshvan 25 Happy Hebrew birthday!
1135
1136 and would appear in the diary for any date that corresponds to Heshvan
1137 25 on the Hebrew calendar.  And here is  Islamic-date diary entry  that
1138 matches Dhu al-Qada 25:
1139
1140      IDhu al-Qada 25 Happy Islamic birthday!
1141
1142 and would appear in the diary for any date that corresponds to Dhu
1143 al-Qada 25 on the Islamic calendar.
1144
1145    As with Gregorian-date diary entries, Hebrew- and Islamic-date
1146 entries are nonmarking if they are preceded with an ampersand (`&').
1147
1148    Here is a table of commands used in the calendar to create diary
1149 entries that match the selected date and other dates that are similar
1150 in the Hebrew or Islamic calendar:
1151
1152 `i h d'
1153      Add a diary entry for the Hebrew date corresponding to the
1154      selected date (`insert-hebrew-diary-entry').
1155
1156 `i h m'
1157      Add a diary entry for the day of the Hebrew month corresponding to
1158      the selected date (`insert-monthly-hebrew-diary-entry').  This
1159      diary entry matches any date that has the same Hebrew
1160      day-within-month as the selected date.
1161
1162 `i h y'
1163      Add a diary entry for the day of the Hebrew year corresponding to
1164      the selected date (`insert-yearly-hebrew-diary-entry').  This diary
1165      entry matches any date which has the same Hebrew month and
1166      day-within-month as the selected date.
1167
1168 `i i d'
1169      Add a diary entry for the Islamic date corresponding to the
1170      selected date (`insert-islamic-diary-entry').
1171
1172 `i i m'
1173      Add a diary entry for the day of the Islamic month corresponding
1174      to the selected date (`insert-monthly-islamic-diary-entry').
1175
1176 `i i y'
1177      Add a diary entry for the day of the Islamic year corresponding to
1178      the selected date (`insert-yearly-islamic-diary-entry').
1179
1180    These commands work much like the corresponding commands for ordinary
1181 diary entries: they apply to the date that point is on in the calendar
1182 window, and what they do is insert just the date portion of a diary
1183 entry at the end of your diary file.  You must then insert the rest of
1184 the diary entry.
1185