1 This is Info file ../info/xemacs.info, produced by Makeinfo version
2 1.68 from the input file xemacs/xemacs.texi.
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents the XEmacs editor.
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.
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.
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.
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.
33 File: xemacs.info, Node: Sunrise/Sunset, Next: Lunar Phases, Prev: Holidays, Up: Calendar/Diary
35 Times of Sunrise and Sunset
36 ---------------------------
38 Special calendar commands can tell you, to within a minute or two,
39 the times of sunrise and sunset for any date.
42 Display times of sunrise and sunset for the selected date
43 (`calendar-sunrise-sunset').
45 `Button2 Sunrise/Sunset'
46 Display times of sunrise and sunset for the date you click on.
49 Display times of sunrise and sunset for today's date.
51 `C-u M-x sunrise-sunset'
52 Display times of sunrise and sunset for a specified date.
54 Within the calendar, to display the *local times* of sunrise and
55 sunset in the echo area, move point to the date you want, and type `S'.
56 Alternatively, click `Button2' on the date, then choose
57 `Sunrise/Sunset' from the menu that appears. The command `M-x
58 sunrise-sunset' is available outside the calendar to display this
59 information for today's date or a specified date. To specify a date
60 other than today, use `C-u M-x sunrise-sunset', which prompts for the
63 You can display the times of sunrise and sunset for any location and
64 any date with `C-u C-u M-x sunrise-sunset'. This asks you for a
65 longitude, latitude, number of minutes difference from Coordinated
66 Universal Time, and date, and then tells you the times of sunrise and
67 sunset for that location on that date.
69 Because the times of sunrise and sunset depend on the location on
70 earth, you need to tell Emacs your latitude, longitude, and location
71 name before using these commands. Here is an example of what to set:
73 (setq calendar-latitude 40.1)
74 (setq calendar-longitude -88.2)
75 (setq calendar-location-name "Urbana, IL")
77 Use one decimal place in the values of `calendar-latitude' and
80 Your time zone also affects the local time of sunrise and sunset.
81 Emacs usually gets time zone information from the operating system, but
82 if these values are not what you want (or if the operating system does
83 not supply them), you must set them yourself. Here is an example:
85 (setq calendar-time-zone -360)
86 (setq calendar-standard-time-zone-name "CST")
87 (setq calendar-daylight-time-zone-name "CDT")
89 The value of `calendar-time-zone' is the number of minutes difference
90 between your local standard time and Coordinated Universal Time
91 (Greenwich time). The values of `calendar-standard-time-zone-name' and
92 `calendar-daylight-time-zone-name' are the abbreviations used in your
93 time zone. Emacs displays the times of sunrise and sunset *corrected
94 for daylight savings time*. *Note Daylight Savings::, for how daylight
95 savings time is determined.
97 As a user, you might find it convenient to set the calendar location
98 variables for your usual physical location in your `.emacs' file. And
99 when you install Emacs on a machine, you can create a `default.el' file
100 which sets them properly for the typical location of most users of that
101 machine. *Note Init File::.
104 File: xemacs.info, Node: Lunar Phases, Next: Other Calendars, Prev: Sunrise/Sunset, Up: Calendar/Diary
109 These calendar commands display the dates and times of the phases of
110 the moon (new moon, first quarter, full moon, last quarter). This
111 feature is useful for debugging problems that "depend on the phase of
115 Display the dates and times for all the quarters of the moon for
116 the three-month period shown (`calendar-phases-of-moon').
119 Display dates and times of the quarters of the moon for three
120 months around today's date.
122 Within the calendar, use the `M' command to display a separate
123 buffer of the phases of the moon for the current three-month range. The
124 dates and times listed are accurate to within a few minutes.
126 Outside the calendar, use the command `M-x phases-of-moon' to
127 display the list of the phases of the moon for the current month and the
128 preceding and succeeding months. For information about a different
129 month, use `C-u M-x phases-of-moon', which prompts for the month and
132 The dates and times given for the phases of the moon are given in
133 local time (corrected for daylight savings, when appropriate); but if
134 the variable `calendar-time-zone' is void, Coordinated Universal Time
135 (the Greenwich time zone) is used. *Note Daylight Savings::.
138 File: xemacs.info, Node: Other Calendars, Next: Calendar Systems, Prev: Lunar Phases, Up: Calendar/Diary
140 Conversion To and From Other Calendars
141 --------------------------------------
143 The Emacs calendar displayed is *always* the Gregorian calendar,
144 sometimes called the "new style" calendar, which is used in most of the
145 world today. However, this calendar did not exist before the sixteenth
146 century and was not widely used before the eighteenth century; it did
147 not fully displace the Julian calendar and gain universal acceptance
148 until the early twentieth century. The Emacs calendar can display any
149 month since January, year 1 of the current era, but the calendar
150 displayed is the Gregorian, even for a date at which the Gregorian
151 calendar did not exist.
153 While Emacs cannot display other calendars, it can convert dates to
154 and from several other calendars.
158 * Calendar Systems:: The calendars Emacs understands
159 (aside from Gregorian).
160 * To Other Calendar:: Converting the selected date to various calendars.
161 * From Other Calendar:: Moving to a date specified in another calendar.
162 * Mayan Calendar:: Moving to a date specified in a Mayan calendar.
164 If you are interested in these calendars, you can convert dates one
165 at a time. Put point on the desired date of the Gregorian calendar and
166 press the appropriate keys. The `p' is a mnemonic for "print" since
167 Emacs "prints' the equivalent date in the echo area.
170 File: xemacs.info, Node: Calendar Systems, Next: To Other Calendar, Prev: Other Calendars, Up: Other Calendars
172 Supported Calendar Systems
173 ==========================
175 The ISO commercial calendar is used largely in Europe.
177 The Julian calendar, named after Julius Caesar, was the one used in
178 Europe throughout medieval times, and in many countries up until the
181 Astronomers use a simple counting of days elapsed since noon, Monday,
182 January 1, 4713 B.C. on the Julian calendar. The number of days elapsed
183 is called the *Julian day number* or the *Astronomical day number*.
185 The Hebrew calendar is used by tradition in the Jewish religion. The
186 Emacs calendar program uses the Hebrew calendar to determine the dates
187 of Jewish holidays. Hebrew calendar dates begin and end at sunset.
189 The Islamic calendar is used in many predominantly Islamic countries.
190 Emacs uses it to determine the dates of Islamic holidays. There is no
191 universal agreement in the Islamic world about the calendar; Emacs uses
192 a widely accepted version, but the precise dates of Islamic holidays
193 often depend on proclamation by religious authorities, not on
194 calculations. As a consequence, the actual dates of observance can vary
195 slightly from the dates computed by Emacs. Islamic calendar dates begin
198 The French Revolutionary calendar was created by the Jacobins after
199 the 1789 revolution, to represent a more secular and nature-based view
200 of the annual cycle, and to install a 10-day week in a rationalization
201 measure similar to the metric system. The French government officially
202 abandoned this calendar at the end of 1805.
204 The Maya of Central America used three separate, overlapping calendar
205 systems, the *long count*, the *tzolkin*, and the *haab*. Emacs knows
206 about all three of these calendars. Experts dispute the exact
207 correlation between the Mayan calendar and our calendar; Emacs uses the
208 Goodman-Martinez-Thompson correlation in its calculations.
210 The Copts use a calendar based on the ancient Egyptian solar
211 calendar. Their calendar consists of twelve 30-day months followed by
212 an extra five-day period. Once every fourth year they add a leap day
213 to this extra period to make it six days. The Ethiopic calendar is
214 identical in structure, but has different year numbers and month names.
216 The Persians use a solar calendar based on a design of Omar Khayyam.
217 Their calendar consists of twelve months of which the first six have 31
218 days, the next five have 30 days, and the last has 29 in ordinary years
219 and 30 in leap years. Leap years occur in a complicated pattern every
222 The Chinese calendar is a complicated system of lunar months arranged
223 into solar years. The years go in cycles of sixty, each year containing
224 either twelve months in an ordinary year or thirteen months in a leap
225 year; each month has either 29 or 30 days. Years, ordinary months, and
226 days are named by combining one of ten "celestial stems" with one of
227 twelve "terrestrial branches" for a total of sixty names that are
228 repeated in a cycle of sixty.
231 File: xemacs.info, Node: To Other Calendar, Next: From Other Calendar, Prev: Calendar Systems, Up: Other Calendars
233 Converting To Other Calendars
234 =============================
236 The following commands describe the selected date (the date at point)
237 in various other calendar systems:
239 `Button2 Other Calendars'
240 Display the date that you click on, expressed in various other
244 Display ISO commercial calendar equivalent for selected day
245 (`calendar-print-iso-date').
248 Display Julian date for selected day
249 (`calendar-print-julian-date').
252 Display astronomical (Julian) day number for selected day
253 (`calendar-print-astro-day-number').
256 Display Hebrew date for selected day
257 (`calendar-print-hebrew-date').
260 Display Islamic date for selected day
261 (`calendar-print-islamic-date').
264 Display French Revolutionary date for selected day
265 (`calendar-print-french-date').
268 Display Chinese date for selected day
269 (`calendar-print-chinese-date').
272 Display Coptic date for selected day
273 (`calendar-print-coptic-date').
276 Display Ethiopic date for selected day
277 (`calendar-print-ethiopic-date').
280 Display Persian date for selected day
281 (`calendar-print-persian-date').
284 Display Mayan date for selected day (`calendar-print-mayan-date').
286 If you are using X, the easiest way to translate a date into other
287 calendars is to click on it with `Button2', then choose `Other
288 Calendars' from the menu that appears. This displays the equivalent
289 forms of the date in all the calendars Emacs understands, in the form of
290 a menu. (Choosing an alternative from this menu doesn't actually do
291 anything--the menu is used only for display.)
293 Put point on the desired date of the Gregorian calendar, then type
294 the appropriate keys. The `p' is a mnemonic for "print" since Emacs
295 "prints" the equivalent date in the echo area.
298 File: xemacs.info, Node: From Other Calendar, Next: Mayan Calendar, Prev: To Other Calendar, Up: Other Calendars
300 Converting From Other Calendars
301 ===============================
303 You can use the other supported calendars to specify a date to move
304 to. This section describes the commands for doing this using calendars
305 other than Mayan; for the Mayan calendar, see the following section.
308 Move to a date specified in the ISO commercial calendar
309 (`calendar-goto-iso-date').
312 Move to a date specified in the Julian calendar
313 (`calendar-goto-julian-date').
316 Move to a date specified in astronomical (Julian) day number
317 (`calendar-goto-astro-day-number').
320 Move to a date specified in the Hebrew calendar
321 (`calendar-goto-hebrew-date').
324 Move to a date specified in the Islamic calendar
325 (`calendar-goto-islamic-date').
328 Move to a date specified in the French Revolutionary calendar
329 (`calendar-goto-french-date').
332 Move to a date specified in the Chinese calendar
333 (`calendar-goto-chinese-date').
336 Move to a date specified in the Persian calendar
337 (`calendar-goto-persian-date').
340 Move to a date specified in the Coptic calendar
341 (`calendar-goto-coptic-date').
344 Move to a date specified in the Ethiopic calendar
345 (`calendar-goto-ethiopic-date').
347 These commands ask you for a date on the other calendar, move point
348 to the Gregorian calendar date equivalent to that date, and display the
349 other calendar's date in the echo area. Emacs uses strict completion
350 (*note Completion::.) whenever it asks you to type a month name, so you
351 don't have to worry about the spelling of Hebrew, Islamic, or French
354 One common question concerning the Hebrew calendar is the computation
355 of the anniversary of a date of death, called a "yahrzeit." The Emacs
356 calendar includes a facility for such calculations. If you are in the
357 calendar, the command `M-x list-yahrzeit-dates' asks you for a range of
358 years and then displays a list of the yahrzeit dates for those years
359 for the date given by point. If you are not in the calendar, this
360 command first asks you for the date of death and the range of years,
361 and then displays the list of yahrzeit dates.
364 File: xemacs.info, Node: Mayan Calendar, Next: Diary, Prev: From Other Calendar, Up: Other Calendars
366 Converting from the Mayan Calendar
367 ----------------------------------
369 Here are the commands to select dates based on the Mayan calendar:
372 Move to a date specified by the long count calendar
373 (`calendar-goto-mayan-long-count-date').
376 Move to the next occurrence of a place in the tzolkin calendar
377 (`calendar-next-tzolkin-date').
380 Move to the previous occurrence of a place in the tzolkin calendar
381 (`calendar-previous-tzolkin-date').
384 Move to the next occurrence of a place in the haab calendar
385 (`calendar-next-haab-date').
388 Move to the previous occurrence of a place in the haab calendar
389 (`calendar-previous-haab-date').
392 Move to the next occurrence of a place in the calendar round
393 (`calendar-next-calendar-round-date').
396 Move to the previous occurrence of a place in the calendar round
397 (`calendar-previous-calendar-round-date').
399 To understand these commands, you need to understand the Mayan
400 calendars. The "long count" is a counting of days with these units:
402 1 kin = 1 day 1 uinal = 20 kin 1 tun = 18 uinal
403 1 katun = 20 tun 1 baktun = 20 katun
405 Thus, the long count date 12.16.11.16.6 means 12 baktun, 16 katun, 11
406 tun, 16 uinal, and 6 kin. The Emacs calendar can handle Mayan long
407 count dates as early as 7.17.18.13.1, but no earlier. When you use the
408 `g m l' command, type the Mayan long count date with the baktun, katun,
409 tun, uinal, and kin separated by periods.
411 The Mayan tzolkin calendar is a cycle of 260 days formed by a pair of
412 independent cycles of 13 and 20 days. Since this cycle repeats
413 endlessly, Emacs provides commands to move backward and forward to the
414 previous or next point in the cycle. Type `g m p t' to go to the
415 previous tzolkin date; Emacs asks you for a tzolkin date and moves point
416 to the previous occurrence of that date. Similarly, type `g m n t' to
417 go to the next occurrence of a tzolkin date.
419 The Mayan haab calendar is a cycle of 365 days arranged as 18 months
420 of 20 days each, followed a 5-day monthless period. Like the tzolkin
421 cycle, this cycle repeats endlessly, and there are commands to move
422 backward and forward to the previous or next point in the cycle. Type
423 `g m p h' to go to the previous haab date; Emacs asks you for a haab
424 date and moves point to the previous occurrence of that date.
425 Similarly, type `g m n h' to go to the next occurrence of a haab date.
427 The Maya also used the combination of the tzolkin date and the haab
428 date. This combination is a cycle of about 52 years called a *calendar
429 round*. If you type `g m p c', Emacs asks you for both a haab and a
430 tzolkin date and then moves point to the previous occurrence of that
431 combination. Use `g m n c' to move point to the next occurrence of a
432 combination. These commands signal an error if the haab/tzolkin date
433 combination you have typed is impossible.
435 Emacs uses strict completion (*note Completion::.) whenever it asks
436 you to type a Mayan name, so you don't have to worry about spelling.
439 File: xemacs.info, Node: Diary, Next: Calendar Customization, Prev: Mayan Calendar, Up: Calendar/Diary
444 The Emacs diary keeps track of appointments or other events on a
445 daily basis, in conjunction with the calendar. To use the diary
446 feature, you must first create a "diary file" containing a list of
447 events and their dates. Then Emacs can automatically pick out and
448 display the events for today, for the immediate future, or for any
451 By default, Emacs uses `~/diary' as the diary file. This is the
452 same file that the `calendar' utility uses. A sample `~/diary' file is:
454 12/22/1988 Twentieth wedding anniversary!!
455 &1/1. Happy New Year!
456 10/22 Ruth's birthday.
458 Tuesday--weekly meeting with grad students at 10am
459 Supowit, Shen, Bitner, and Kapoor to attend.
460 1/13/89 Friday the thirteenth!!
461 &thu 4pm squash game with Lloyd.
462 mar 16 Dad's birthday
463 April 15, 1989 Income tax due.
464 &* 15 time cards due.
466 This example uses extra spaces to align the event descriptions of most
467 of the entries. Such formatting is purely a matter of taste.
469 Although you probably will start by creating a diary manually, Emacs
470 provides a number of commands to let you view, add, and change diary
471 entries. You can also share diary entries with other users (*note
472 Included Diary Files::.).
476 * Diary Commands:: Viewing diary entries and associated calendar dates.
477 * Format of Diary File:: Entering events in your diary.
478 * Date Formats:: Various ways you can specify dates.
479 * Adding to Diary:: Commands to create diary entries.
480 * Special Diary Entries:: Anniversaries, blocks of dates, cyclic entries, etc.
483 File: xemacs.info, Node: Diary Commands, Next: Format of Diary File, Prev: Diary, Up: Diary
485 Commands Displaying Diary Entries
486 ---------------------------------
488 Once you have created a `~/diary' file, you can use the calendar to
489 view it. You can also view today's events outside of Calendar mode.
492 Display all diary entries for the selected date
493 (`view-diary-entries').
496 Display all diary entries for the date you click on.
499 Display the entire diary file (`show-all-diary-entries').
502 Mark all visible dates that have diary entries
503 (`mark-diary-entries').
506 Unmark the calendar window (`calendar-unmark').
508 `M-x print-diary-entries'
509 Print hard copy of the diary display as it appears.
512 Display all diary entries for today's date.
514 `M-x diary-mail-entries'
515 Mail yourself email reminders about upcoming diary entries.
517 Displaying the diary entries with `d' shows in a separate window the
518 diary entries for the selected date in the calendar. The mode line of
519 the new window shows the date of the diary entries and any holidays
520 that fall on that date. If you specify a numeric argument with `d', it
521 shows all the diary entries for that many successive days. Thus, `2 d'
522 displays all the entries for the selected date and for the following
525 Another way to display the diary entries for a date is to click
526 `Button2' on the date, and then choose `Diary' from the menu that
529 To get a broader view of which days are mentioned in the diary, use
530 the `m' command. This displays the dates that have diary entries in a
531 different face (or places a `+' after these dates, if display with
532 multiple faces is not available). The command applies both to the
533 currently visible months and to other months that subsequently become
534 visible by scrolling. To turn marking off and erase the current marks,
535 type `u', which also turns off holiday marks (*note Holidays::.).
537 To see the full diary file, rather than just some of the entries, use
540 Display of selected diary entries uses the selective display feature
541 to hide entries that don't apply.
543 The diary buffer as you see it is an illusion, so simply printing the
544 buffer does not print what you see on your screen. There is a special
545 command to print hard copy of the diary buffer *as it appears*; this
546 command is `M-x print-diary-entries'. It sends the data directly to
547 the printer. You can customize it like `lpr-region' (*note
550 The command `M-x diary' displays the diary entries for the current
551 date, independently of the calendar display, and optionally for the next
552 few days as well; the variable `number-of-diary-entries' specifies how
553 many days to include (*note Customization::.).
555 If you put `(diary)' in your `.emacs' file, this automatically
556 displays a window with the day's diary entries, when you enter Emacs.
557 The mode line of the displayed window shows the date and any holidays
558 that fall on that date.
560 Many users like to receive notice of events in their diary as email.
561 To send such mail to yourself, use the command `M-x
562 diary-mail-entries'. A prefix argument specifies how many days
563 (starting with today) to check; otherwise, the variable
564 `diary-mail-days' says how many days.
567 File: xemacs.info, Node: Format of Diary File, Next: Date Formats, Prev: Diary Commands, Up: Diary
572 Your "diary file" is a file that records events associated with
573 particular dates. The name of the diary file is specified by the
574 variable `diary-file'; `~/diary' is the default. The `calendar'
575 utility program supports a subset of the format allowed by the Emacs
576 diary facilities, so you can use that utility to view the diary file,
577 with reasonable results aside from the entries it cannot understand.
579 Each entry in the diary file describes one event and consists of one
580 or more lines. An entry always begins with a date specification at the
581 left margin. The rest of the entry is simply text to describe the
582 event. If the entry has more than one line, then the lines after the
583 first must begin with whitespace to indicate they continue a previous
584 entry. Lines that do not begin with valid dates and do not continue a
585 preceding entry are ignored.
587 You can inhibit the marking of certain diary entries in the calendar
588 window; to do this, insert an ampersand (`&') at the beginning of the
589 entry, before the date. This has no effect on display of the entry in
590 the diary window; it affects only marks on dates in the calendar
591 window. Nonmarking entries are especially useful for generic entries
592 that would otherwise mark many different dates.
594 If the first line of a diary entry consists only of the date or day
595 name with no following blanks or punctuation, then the diary window
596 display doesn't include that line; only the continuation lines appear.
597 For example, this entry:
600 Bill B. visits Princeton today
601 2pm Cognitive Studies Committee meeting
602 2:30-5:30 Liz at Lawrenceville
604 7:30pm Dinner at George's
607 appears in the diary window without the date line at the beginning.
608 This style of entry looks neater when you display just a single day's
609 entries, but can cause confusion if you ask for more than one day's
612 You can edit the diary entries as they appear in the window, but it
613 is important to remember that the buffer displayed contains the *entire*
614 diary file, with portions of it concealed from view. This means, for
615 instance, that the `C-f' (`forward-char') command can put point at what
616 appears to be the end of the line, but what is in reality the middle of
619 *Be careful when editing the diary entries!* Inserting additional
620 lines or adding/deleting characters in the middle of a visible line
621 cannot cause problems, but editing at the end of a line may not do what
622 you expect. Deleting a line may delete other invisible entries that
623 follow it. Before editing the diary, it is best to display the entire
624 file with `s' (`show-all-diary-entries').
627 File: xemacs.info, Node: Date Formats, Next: Adding to Diary, Prev: Format of Diary File, Up: Diary
632 Here are some sample diary entries, illustrating different ways of
633 formatting a date. The examples all show dates in American order
634 (month, day, year), but Calendar mode supports European order (day,
635 month, year) as an option.
637 4/20/93 Switch-over to new tabulation system
638 apr. 25 Start tabulating annual results
639 4/30 Results for April are due
640 */25 Monthly cycle finishes
641 Friday Don't leave without backing up files
643 The first entry appears only once, on April 20, 1993. The second and
644 third appear every year on the specified dates, and the fourth uses a
645 wildcard (asterisk) for the month, so it appears on the 25th of every
646 month. The final entry appears every week on Friday.
648 You can use just numbers to express a date, as in `MONTH/DAY' or
649 `MONTH/DAY/YEAR'. This must be followed by a nondigit. In the date
650 itself, MONTH and DAY are numbers of one or two digits. The optional
651 YEAR is also a number, and may be abbreviated to the last two digits;
652 that is, you can use `11/12/1989' or `11/12/89'.
654 Dates can also have the form `MONTHNAME DAY' or `MONTHNAME DAY,
655 YEAR', where the month's name can be spelled in full or abbreviated to
656 three characters (with or without a period). Case is not significant.
658 A date may be "generic"; that is, partially unspecified. Then the
659 entry applies to all dates that match the specification. If the date
660 does not contain a year, it is generic and applies to any year.
661 Alternatively, MONTH, DAY, or YEAR can be a `*'; this matches any
662 month, day, or year, respectively. Thus, a diary entry `3/*/*' matches
663 any day in March of any year; so does `march *'.
665 If you prefer the European style of writing dates--in which the day
666 comes before the month--type `M-x european-calendar' while in the
667 calendar, or set the variable `european-calendar-style' to `t' *before*
668 using any calendar or diary command. This mode interprets all dates in
669 the diary in the European manner, and also uses European style for
670 displaying diary dates. (Note that there is no comma after the
671 MONTHNAME in the European style.) To go back to the (default) American
672 style of writing dates, type `M-x american-calendar'.
674 You can use the name of a day of the week as a generic date which
675 applies to any date falling on that day of the week. You can abbreviate
676 the day of the week to three letters (with or without a period) or spell
677 it in full; case is not significant.
680 File: xemacs.info, Node: Adding to Diary, Next: Special Diary Entries, Prev: Date Formats, Up: Diary
682 Commands to Add to the Diary
683 ----------------------------
685 While in the calendar, there are several commands to create diary
689 Add a diary entry for the selected date (`insert-diary-entry').
692 Add a diary entry for the selected day of the week
693 (`insert-weekly-diary-entry').
696 Add a diary entry for the selected day of the month
697 (`insert-monthly-diary-entry').
700 Add a diary entry for the selected day of the year
701 (`insert-yearly-diary-entry').
703 You can make a diary entry for a specific date by selecting that date
704 in the calendar window and typing the `i d' command. This command
705 displays the end of your diary file in another window and inserts the
706 date; you can then type the rest of the diary entry.
708 If you want to make a diary entry that applies to a specific day of
709 the week, select that day of the week (any occurrence will do) and type
710 `i w'. This inserts the day-of-week as a generic date; you can then
711 type the rest of the diary entry. You can make a monthly diary entry in
712 the same fashion. Select the day of the month, use the `i m' command,
713 and type rest of the entry. Similarly, you can insert a yearly diary
714 entry with the `i y' command.
716 All of the above commands make marking diary entries by default. To
717 make a nonmarking diary entry, give a numeric argument to the command.
718 For example, `C-u i w' makes a nonmarking weekly diary entry.
720 When you modify the diary file, be sure to save the file before
724 File: xemacs.info, Node: Special Diary Entries, Prev: Adding to Diary, Up: Diary
726 Special Diary Entries
727 ---------------------
729 In addition to entries based on calendar dates, the diary file can
730 contain "sexp entries" for regular events such as anniversaries. These
731 entries are based on Lisp expressions (sexps) that Emacs evaluates as
732 it scans the diary file. Instead of a date, a sexp entry contains `%%'
733 followed by a Lisp expression which must begin and end with
734 parentheses. The Lisp expression determines which dates the entry
737 Calendar mode provides commands to insert certain commonly used sexp
741 Add an anniversary diary entry for the selected date
742 (`insert-anniversary-diary-entry').
745 Add a block diary entry for the current region
746 (`insert-block-diary-entry').
749 Add a cyclic diary entry starting at the date
750 (`insert-cyclic-diary-entry').
752 If you want to make a diary entry that applies to the anniversary of
753 a specific date, move point to that date and use the `i a' command.
754 This displays the end of your diary file in another window and inserts
755 the anniversary description; you can then type the rest of the diary
756 entry. The entry looks like this:
758 The effect of `i a' is to add a `diary-anniversary' sexp to your
759 diary file. You can also add one manually, for instance:
761 %%(diary-anniversary 10 31 1948) Arthur's birthday
763 This entry applies to October 31 in any year after 1948; `10 31 1948'
764 specifies the date. (If you are using the European calendar style, the
765 month and day are interchanged.) The reason this expression requires a
766 beginning year is that advanced diary functions can use it to calculate
767 the number of elapsed years.
769 A "block" diary entry applies to a specified range of consecutive
770 dates. Here is a block diary entry that applies to all dates from June
771 24, 1990 through July 10, 1990:
773 %%(diary-block 6 24 1990 7 10 1990) Vacation
775 The `6 24 1990' indicates the starting date and the `7 10 1990'
776 indicates the stopping date. (Again, if you are using the European
777 calendar style, the month and day are interchanged.)
779 To insert a block entry, place point and the mark on the two dates
780 that begin and end the range, and type `i b'. This command displays
781 the end of your diary file in another window and inserts the block
782 description; you can then type the diary entry.
784 "Cyclic" diary entries repeat after a fixed interval of days. To
785 create one, select the starting date and use the `i c' command. The
786 command prompts for the length of interval, then inserts the entry,
787 which looks like this:
789 %%(diary-cyclic 50 3 1 1990) Renew medication
791 This entry applies to March 1, 1990 and every 50th day following; `3 1
792 1990' specifies the starting date. (If you are using the European
793 calendar style, the month and day are interchanged.)
795 All three of these commands make marking diary entries. To insert a
796 nonmarking entry, give a numeric argument to the command. For example,
797 `C-u i a' makes a nonmarking anniversary diary entry.
799 Marking sexp diary entries in the calendar is *extremely*
800 time-consuming, since every date visible in the calendar window must be
801 individually checked. So it's a good idea to make sexp diary entries
802 nonmarking (with `&') when possible.
804 Another sophisticated kind of sexp entry, a "floating" diary entry,
805 specifies a regularly occurring event by offsets specified in days,
806 weeks, and months. It is comparable to a crontab entry interpreted by
807 the `cron' utility. Here is a nonmarking, floating diary entry that
808 applies to the last Thursday in November:
810 &%%(diary-float 11 4 -1) American Thanksgiving
812 The 11 specifies November (the eleventh month), the 4 specifies Thursday
813 (the fourth day of the week, where Sunday is numbered zero), and the -1
814 specifies "last" (1 would mean "first", 2 would mean "second", -2 would
815 mean "second-to-last", and so on). The month can be a single month or
816 a list of months. Thus you could change the 11 above to `'(1 2 3)' and
817 have the entry apply to the last Thursday of January, February, and
818 March. If the month is `t', the entry applies to all months of the
821 The sexp feature of the diary allows you to specify diary entries
822 based on any Emacs Lisp expression. You can use the library of built-in
823 functions or you can write your own functions. The built-in functions
824 include the ones shown in this section, plus a few others (*note Sexp
827 The generality of sexps lets you specify any diary entry that you can
828 describe algorithmically. Suppose you get paid on the 21st of the month
829 if it is a weekday, and to the Friday before if the 21st is on a
830 weekend. The diary entry
832 &%%(let ((dayname (calendar-day-of-week date))
833 (day (car (cdr date))))
834 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
835 (and (memq day '(19 20)) (= dayname 5)))
836 ) Pay check deposited
838 to just those dates. This example illustrates how the sexp can depend
839 on the variable `date'; this variable is a list (MONTH DAY YEAR) that
840 gives the Gregorian date for which the diary entries are being found.
841 If the value of the sexp is `t', the entry applies to that date. If
842 the sexp evaluates to `nil', the entry does *not* apply to that date.
845 File: xemacs.info, Node: Calendar Customization, Prev: Diary, Up: Calendar/Diary
847 Customizing the Calendar and Diary
848 ----------------------------------
850 There are many customizations that you can use to make the calendar
851 and diary suit your personal tastes.
855 * Calendar Customizing:: Defaults you can set.
856 * Holiday Customizing:: Defining your own holidays.
857 * Date Display Format:: Changing the format.
858 * Time Display Format:: Changing the format.
859 * Daylight Savings:: Changing the default.
860 * Diary Customizing:: Defaults you can set.
861 * Hebrew/Islamic Entries:: How to obtain them.
862 * Fancy Diary Display:: Enhancing the diary display, sorting entries.
863 * Included Diary Files:: Sharing a common diary file.
864 * Sexp Diary Entries:: Fancy things you can do.
865 * Appt Customizing:: Customizing appointment reminders.
868 File: xemacs.info, Node: Calendar Customizing, Next: Holiday Customizing, Up: Calendar Customization
870 Customizing the Calendar
871 ........................
873 If you set the variable `view-diary-entries-initially' to `t',
874 calling up the calendar automatically displays the diary entries for
875 the current date as well. The diary dates appear only if the current
876 date is visible. If you add both of the following lines to your
879 (setq view-diary-entries-initially t)
882 this displays both the calendar and diary windows whenever you start
885 Similarly, if you set the variable
886 `view-calendar-holidays-initially' to `t', entering the calendar
887 automatically displays a list of holidays for the current three-month
888 period. The holiday list appears in a separate window.
890 You can set the variable `mark-diary-entries-in-calendar' to `t' in
891 order to mark any dates with diary entries. This takes effect whenever
892 the calendar window contents are recomputed. There are two ways of
893 marking these dates: by changing the face (*note Faces::.), if the
894 display supports that, or by placing a plus sign (`+') beside the date
897 Similarly, setting the variable `mark-holidays-in-calendar' to `t'
898 marks holiday dates, either with a change of face or with an asterisk
901 The variable `calendar-holiday-marker' specifies how to mark a date
902 as being a holiday. Its value may be a character to insert next to the
903 date, or a face name to use for displaying the date. Likewise, the
904 variable `diary-entry-marker' specifies how to mark a date that has
905 diary entries. The calendar creates faces named `holiday-face' and
906 `diary-face' for these purposes; those symbols are the default values
907 of these variables, when Emacs supports multiple faces on your terminal.
909 The variable `calendar-load-hook' is a normal hook run when the
910 calendar package is first loaded (before actually starting to display
913 Starting the calendar runs the normal hook
914 `initial-calendar-window-hook'. Recomputation of the calendar display
915 does not run this hook. But if you leave the calendar with the `q'
916 command and reenter it, the hook runs again.
918 The variable `today-visible-calendar-hook' is a normal hook run
919 after the calendar buffer has been prepared with the calendar when the
920 current date is visible in the window. One use of this hook is to
921 replace today's date with asterisks; to do that, use the hook function
922 `calendar-star-date'.
924 (add-hook 'today-visible-calendar-hook 'calendar-star-date)
926 Another standard hook function marks the current date, either by
927 changing its face or by adding an asterisk. Here's how to use it:
929 (add-hook 'today-visible-calendar-hook 'calendar-mark-today)
931 The variable `calendar-today-marker' specifies how to mark today's
932 date. Its value should be a character to insert next to the date or a
933 face name to use for displaying the date. A face named
934 `calendar-today-face' is provided for this purpose; that symbol is the
935 default for this variable when Emacs supports multiple faces on your
938 A similar normal hook, `today-invisible-calendar-hook' is run if the
939 current date is *not* visible in the window.
942 File: xemacs.info, Node: Holiday Customizing, Next: Date Display Format, Prev: Calendar Customizing, Up: Calendar Customization
944 Customizing the Holidays
945 ........................
947 Emacs knows about holidays defined by entries on one of several
948 lists. You can customize these lists of holidays to your own needs,
949 adding or deleting holidays. The lists of holidays that Emacs uses are
950 for general holidays (`general-holidays'), local holidays
951 (`local-holidays'), Christian holidays (`christian-holidays'), Hebrew
952 (Jewish) holidays (`hebrew-holidays'), Islamic (Moslem) holidays
953 (`islamic-holidays'), and other holidays (`other-holidays').
955 The general holidays are, by default, holidays common throughout the
956 United States. To eliminate these holidays, set `general-holidays' to
959 There are no default local holidays (but sites may supply some). You
960 can set the variable `local-holidays' to any list of holidays, as
963 By default, Emacs does not include all the holidays of the religions
964 that it knows, only those commonly found in secular calendars. For a
965 more extensive collection of religious holidays, you can set any (or
966 all) of the variables `all-christian-calendar-holidays',
967 `all-hebrew-calendar-holidays', or `all-islamic-calendar-holidays' to
968 `t'. If you want to eliminate the religious holidays, set any or all
969 of the corresponding variables `christian-holidays', `hebrew-holidays',
970 and `islamic-holidays' to `nil'.
972 You can set the variable `other-holidays' to any list of holidays.
973 This list, normally empty, is intended for individual use.
975 Each of the lists (`general-holidays', `local-holidays',
976 `christian-holidays', `hebrew-holidays', `islamic-holidays', and
977 `other-holidays') is a list of "holiday forms", each holiday form
978 describing a holiday (or sometimes a list of holidays).
980 Here is a table of the possible kinds of holiday form. Day numbers
981 and month numbers count starting from 1, but "dayname" numbers count
982 Sunday as 0. The element STRING is always the name of the holiday, as
985 `(holiday-fixed MONTH DAY STRING)'
986 A fixed date on the Gregorian calendar. MONTH and DAY are
987 numbers, STRING is the name of the holiday.
989 `(holiday-float MONTH DAYNAME K STRING)'
990 The Kth DAYNAME in MONTH on the Gregorian calendar (DAYNAME=0 for
991 Sunday, and so on); negative K means count back from the end of
992 the month. STRING is the name of the holiday.
994 `(holiday-hebrew MONTH DAY STRING)'
995 A fixed date on the Hebrew calendar. MONTH and DAY are numbers,
996 STRING is the name of the holiday.
998 `(holiday-islamic MONTH DAY STRING)'
999 A fixed date on the Islamic calendar. MONTH and DAY are numbers,
1000 STRING is the name of the holiday.
1002 `(holiday-julian MONTH DAY STRING)'
1003 A fixed date on the Julian calendar. MONTH and DAY are numbers,
1004 STRING is the name of the holiday.
1006 `(holiday-sexp SEXP STRING)'
1007 A date calculated by the Lisp expression SEXP. The expression
1008 should use the variable `year' to compute and return the date of a
1009 holiday, or `nil' if the holiday doesn't happen this year. The
1010 value of SEXP must represent the date as a list of the form
1011 `(MONTH DAY YEAR)'. STRING is the name of the holiday.
1013 `(if CONDITION HOLIDAY-FORM &optional HOLIDAY-FORM)'
1014 A holiday that happens only if CONDITION is true.
1017 A list of dates calculated by the function FUNCTION, called with
1020 For example, suppose you want to add Bastille Day, celebrated in
1021 France on July 14. You can do this by adding the following line to
1024 (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
1026 The holiday form `(holiday-fixed 7 14 "Bastille Day")' specifies the
1027 fourteenth day of the seventh month (July).
1029 Many holidays occur on a specific day of the week, at a specific time
1030 of month. Here is a holiday form describing Hurricane Supplication Day,
1031 celebrated in the Virgin Islands on the fourth Monday in August:
1033 (holiday-float 8 1 4 "Hurricane Supplication Day")
1035 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
1036 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
1037 the month (1 specifies the first occurrence, 2 the second occurrence,
1038 -1 the last occurrence, -2 the second-to-last occurrence, and so on).
1040 You can specify holidays that occur on fixed days of the Hebrew,
1041 Islamic, and Julian calendars too. For example,
1043 (setq other-holidays
1044 '((holiday-hebrew 10 2 "Last day of Hanukkah")
1045 (holiday-islamic 3 12 "Mohammed's Birthday")
1046 (holiday-julian 4 2 "Jefferson's Birthday")))
1048 adds the last day of Hanukkah (since the Hebrew months are numbered with
1049 1 starting from Nisan), the Islamic feast celebrating Mohammed's
1050 birthday (since the Islamic months are numbered from 1 starting with
1051 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
1054 To include a holiday conditionally, use either Emacs Lisp's `if' or
1055 the `holiday-sexp' form. For example, American presidential elections
1056 occur on the first Tuesday after the first Monday in November of years
1059 (holiday-sexp (if (= 0 (% year 4))
1060 (calendar-gregorian-from-absolute
1061 (1+ (calendar-dayname-on-or-before
1062 1 (+ 6 (calendar-absolute-from-gregorian
1063 (list 11 1 year))))))
1064 "US Presidential Election"))
1068 (if (= 0 (% displayed-year 4))
1070 (extract-calendar-day
1071 (calendar-gregorian-from-absolute
1072 (1+ (calendar-dayname-on-or-before
1073 1 (+ 6 (calendar-absolute-from-gregorian
1074 (list 11 1 displayed-year)))))))
1075 "US Presidential Election"))
1077 Some holidays just don't fit into any of these forms because special
1078 calculations are involved in their determination. In such cases you
1079 must write a Lisp function to do the calculation. To include eclipses,
1080 for example, add `(eclipses)' to `other-holidays' and write an Emacs
1081 Lisp function `eclipses' that returns a (possibly empty) list of the
1082 relevant Gregorian dates among the range visible in the calendar
1083 window, with descriptive strings, like this:
1085 (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
1088 File: xemacs.info, Node: Date Display Format, Next: Time Display Format, Prev: Holiday Customizing, Up: Calendar Customization
1093 You can customize the manner of displaying dates in the diary, in
1094 mode lines, and in messages by setting `calendar-date-display-form'.
1095 This variable holds a list of expressions that can involve the variables
1096 `month', `day', and `year', which are all numbers in string form, and
1097 `monthname' and `dayname', which are both alphabetic strings. In the
1098 American style, the default value of this list is as follows:
1100 ((if dayname (concat dayname ", ")) monthname " " day ", " year)
1102 while in the European style this value is the default:
1104 ((if dayname (concat dayname ", ")) day " " monthname " " year)
1106 + The ISO standard date representation is this:
1108 (year "-" month "-" day)
1110 This specifies a typical American format:
1112 (month "/" day "/" (substring year -2))
1115 File: xemacs.info, Node: Time Display Format, Next: Daylight Savings, Prev: Date Display Format, Up: Calendar Customization
1120 The calendar and diary by default display times of day in the
1121 conventional American style with the hours from 1 through 12, minutes,
1122 and either `am' or `pm'. If you prefer the European style, also known
1123 in the US as military, in which the hours go from 00 to 23, you can
1124 alter the variable `calendar-time-display-form'. This variable is a
1125 list of expressions that can involve the variables `12-hours',
1126 `24-hours', and `minutes', which are all numbers in string form, and
1127 `am-pm' and `time-zone', which are both alphabetic strings. The
1128 default value of `calendar-time-display-form' is as follows:
1130 (12-hours ":" minutes am-pm
1131 (if time-zone " (") time-zone (if time-zone ")"))
1133 Here is a value that provides European style times:
1135 (24-hours ":" minutes
1136 (if time-zone " (") time-zone (if time-zone ")"))
1138 gives military-style times like `21:07 (UT)' if time zone names are
1139 defined, and times like `21:07' if they are not.
1142 File: xemacs.info, Node: Daylight Savings, Next: Diary Customizing, Prev: Time Display Format, Up: Calendar Customization
1144 Daylight Savings Time
1145 .....................
1147 Emacs understands the difference between standard time and daylight
1148 savings time--the times given for sunrise, sunset, solstices,
1149 equinoxes, and the phases of the moon take that into account. The rules
1150 for daylight savings time vary from place to place and have also varied
1151 historically from year to year. To do the job properly, Emacs needs to
1152 know which rules to use.
1154 Some operating systems keep track of the rules that apply to the
1155 place where you are; on these systems, Emacs gets the information it
1156 needs from the system automatically. If some or all of this
1157 information is missing, Emacs fills in the gaps with the rules
1158 currently used in Cambridge, Massachusetts. If the resulting rules are
1159 not what you want, you can tell Emacs the rules to use by setting
1162 If the default choice of rules is not appropriate for your location,
1163 you can tell Emacs the rules to use by setting the variables
1164 `calendar-daylight-savings-starts' and
1165 `calendar-daylight-savings-ends'. Their values should be Lisp
1166 expressions that refer to the variable `year', and evaluate to the
1167 Gregorian date on which daylight savings time starts or (respectively)
1168 ends, in the form of a list `(MONTH DAY YEAR)'. The values should be
1169 `nil' if your area does not use daylight savings time.
1171 Emacs uses these expressions to determine the starting date of
1172 daylight savings time for the holiday list and for correcting times of
1173 day in the solar and lunar calculations.
1175 The values for Cambridge, Massachusetts are as follows:
1177 (calendar-nth-named-day 1 0 4 year)
1178 (calendar-nth-named-day -1 0 10 year)
1180 That is, the first 0th day (Sunday) of the fourth month (April) in the
1181 year specified by `year', and the last Sunday of the tenth month
1182 (October) of that year. If daylight savings time were changed to start
1183 on October 1, you would set `calendar-daylight-savings-starts' to this:
1187 For a more complex example, suppose daylight savings time begins on
1188 the first of Nisan on the Hebrew calendar. You should set
1189 `calendar-daylight-savings-starts' to this value:
1191 (calendar-gregorian-from-absolute
1192 (calendar-absolute-from-hebrew
1193 (list 1 1 (+ year 3760))))
1195 because Nisan is the first month in the Hebrew calendar and the Hebrew
1196 year differs from the Gregorian year by 3760 at Nisan.
1198 If there is no daylight savings time at your location, or if you want
1199 all times in standard time, set `calendar-daylight-savings-starts' and
1200 `calendar-daylight-savings-ends' to `nil'.
1202 The variable `calendar-daylight-time-offset' specifies the
1203 difference between daylight savings time and standard time, measured in
1204 minutes. The value for Cambridge, Massachusetts is 60.
1206 The two variables `calendar-daylight-savings-starts-time' and
1207 `calendar-daylight-savings-ends-time' specify the number of minutes
1208 after midnight local time when the transition to and from daylight
1209 savings time should occur. For Cambridge, Massachusetts both variables'