(M-10141): Separate U+5F98, G0-4547, K0-5B47, C1-5A38 and J90-5751.
[chise/xemacs-chise.git] / info / xemacs.info-15
1 This is ../info/xemacs.info, produced by makeinfo version 4.0 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: Adding to Diary,  Next: Special Diary Entries,  Prev: Date Formats,  Up: Diary
34
35 Commands to Add to the Diary
36 ----------------------------
37
38    While in the calendar, there are several commands to create diary
39 entries:
40
41 `i d'
42      Add a diary entry for the selected date (`insert-diary-entry').
43
44 `i w'
45      Add a diary entry for the selected day of the week
46      (`insert-weekly-diary-entry').
47
48 `i m'
49      Add a diary entry for the selected day of the month
50      (`insert-monthly-diary-entry').
51
52 `i y'
53      Add a diary entry for the selected day of the year
54      (`insert-yearly-diary-entry').
55
56    You can make a diary entry for a specific date by selecting that date
57 in the calendar window and typing the `i d' command.  This command
58 displays the end of your diary file in another window and inserts the
59 date; you can then type the rest of the diary entry.
60
61    If you want to make a diary entry that applies to a specific day of
62 the week, select that day of the week (any occurrence will do) and type
63 `i w'.  This inserts the day-of-week as a generic date; you can then
64 type the rest of the diary entry.  You can make a monthly diary entry in
65 the same fashion.  Select the day of the month, use the `i m' command,
66 and type rest of the entry.  Similarly, you can insert a yearly diary
67 entry with the `i y' command.
68
69    All of the above commands make marking diary entries by default.  To
70 make a nonmarking diary entry, give a numeric argument to the command.
71 For example, `C-u i w' makes a nonmarking weekly diary entry.
72
73    When you modify the diary file, be sure to save the file before
74 exiting Emacs.
75
76 \1f
77 File: xemacs.info,  Node: Special Diary Entries,  Prev: Adding to Diary,  Up: Diary
78
79 Special Diary Entries
80 ---------------------
81
82    In addition to entries based on calendar dates, the diary file can
83 contain "sexp entries" for regular events such as anniversaries.  These
84 entries are based on Lisp expressions (sexps) that Emacs evaluates as
85 it scans the diary file.  Instead of a date, a sexp entry contains `%%'
86 followed by a Lisp expression which must begin and end with
87 parentheses.  The Lisp expression determines which dates the entry
88 applies to.
89
90    Calendar mode provides commands to insert certain commonly used sexp
91 entries:
92
93 `i a'
94      Add an anniversary diary entry for the selected date
95      (`insert-anniversary-diary-entry').
96
97 `i b'
98      Add a block diary entry for the current region
99      (`insert-block-diary-entry').
100
101 `i c'
102      Add a cyclic diary entry starting at the date
103      (`insert-cyclic-diary-entry').
104
105    If you want to make a diary entry that applies to the anniversary of
106 a specific date, move point to that date and use the `i a' command.
107 This displays the end of your diary file in another window and inserts
108 the anniversary description; you can then type the rest of the diary
109 entry. The entry looks like this:
110
111    The effect of `i a' is to add a `diary-anniversary' sexp to your
112 diary file.  You can also add one manually, for instance:
113
114      %%(diary-anniversary 10 31 1948) Arthur's birthday
115
116 This entry applies to October 31 in any year after 1948; `10 31 1948'
117 specifies the date.  (If you are using the European calendar style, the
118 month and day are interchanged.)  The reason this expression requires a
119 beginning year is that advanced diary functions can use it to calculate
120 the number of elapsed years.
121
122    A "block" diary entry applies to a specified range of consecutive
123 dates.  Here is a block diary entry that applies to all dates from June
124 24, 1990 through July 10, 1990:
125
126      %%(diary-block 6 24 1990 7 10 1990) Vacation
127
128 The `6 24 1990' indicates the starting date and the `7 10 1990'
129 indicates the stopping date.  (Again, if you are using the European
130 calendar style, the month and day are interchanged.)
131
132    To insert a block entry, place point and the mark on the two dates
133 that begin and end the range, and type `i b'.  This command displays
134 the end of your diary file in another window and inserts the block
135 description; you can then type the diary entry.
136
137    "Cyclic" diary entries repeat after a fixed interval of days.  To
138 create one, select the starting date and use the `i c' command.  The
139 command prompts for the length of interval, then inserts the entry,
140 which looks like this:
141
142      %%(diary-cyclic 50 3 1 1990) Renew medication
143
144 This entry applies to March 1, 1990 and every 50th day following; `3 1
145 1990' specifies the starting date.  (If you are using the European
146 calendar style, the month and day are interchanged.)
147
148    All three of these commands make marking diary entries.  To insert a
149 nonmarking entry, give a numeric argument to the command.  For example,
150 `C-u i a' makes a nonmarking anniversary diary entry.
151
152    Marking sexp diary entries in the calendar is _extremely_
153 time-consuming, since every date visible in the calendar window must be
154 individually checked.  So it's a good idea to make sexp diary entries
155 nonmarking (with `&') when possible.
156
157    Another sophisticated kind of sexp entry, a "floating" diary entry,
158 specifies a regularly occurring event by offsets specified in days,
159 weeks, and months.  It is comparable to a crontab entry interpreted by
160 the `cron' utility.  Here is a nonmarking, floating diary entry that
161 applies to the last Thursday in November:
162
163      &%%(diary-float 11 4 -1) American Thanksgiving
164
165 The 11 specifies November (the eleventh month), the 4 specifies Thursday
166 (the fourth day of the week, where Sunday is numbered zero), and the -1
167 specifies "last" (1 would mean "first", 2 would mean "second", -2 would
168 mean "second-to-last", and so on).  The month can be a single month or
169 a list of months.  Thus you could change the 11 above to `'(1 2 3)' and
170 have the entry apply to the last Thursday of January, February, and
171 March.  If the month is `t', the entry applies to all months of the
172 year.
173
174    The sexp feature of the diary allows you to specify diary entries
175 based on any Emacs Lisp expression.  You can use the library of built-in
176 functions or you can write your own functions.  The built-in functions
177 include the ones shown in this section, plus a few others (*note Sexp
178 Diary Entries::).
179
180    The generality of sexps lets you specify any diary entry that you can
181 describe algorithmically.  Suppose you get paid on the 21st of the month
182 if it is a weekday, and to the Friday before if the 21st is on a
183 weekend.  The diary entry
184
185      &%%(let ((dayname (calendar-day-of-week date))
186               (day (car (cdr date))))
187            (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
188                (and (memq day '(19 20)) (= dayname 5)))
189               ) Pay check deposited
190
191 to just those dates.  This example illustrates how the sexp can depend
192 on the variable `date'; this variable is a list (MONTH DAY YEAR) that
193 gives the Gregorian date for which the diary entries are being found.
194 If the value of the sexp is `t', the entry applies to that date.  If
195 the sexp evaluates to `nil', the entry does _not_ apply to that date.
196
197 \1f
198 File: xemacs.info,  Node: Calendar Customization,  Prev: Diary,  Up: Calendar/Diary
199
200 Customizing the Calendar and Diary
201 ----------------------------------
202
203    There are many customizations that you can use to make the calendar
204 and diary suit your personal tastes.
205
206 * Menu:
207
208 * Calendar Customizing::   Defaults you can set.
209 * Holiday Customizing::    Defining your own holidays.
210 * Date Display Format::    Changing the format.
211 * Time Display Format::    Changing the format.
212 * Daylight Savings::       Changing the default.
213 * Diary Customizing::      Defaults you can set.
214 * Hebrew/Islamic Entries:: How to obtain them.
215 * Fancy Diary Display::    Enhancing the diary display, sorting entries.
216 * Included Diary Files::   Sharing a common diary file.
217 * Sexp Diary Entries::     Fancy things you can do.
218 * Appt Customizing::       Customizing appointment reminders.
219
220 \1f
221 File: xemacs.info,  Node: Calendar Customizing,  Next: Holiday Customizing,  Up: Calendar Customization
222
223 Customizing the Calendar
224 ........................
225
226    If you set the variable `view-diary-entries-initially' to `t',
227 calling up the calendar automatically displays the diary entries for
228 the current date as well.  The diary dates appear only if the current
229 date is visible.  If you add both of the following lines to your init
230 file:
231
232      (setq view-diary-entries-initially t)
233      (calendar)
234
235 this displays both the calendar and diary windows whenever you start
236 Emacs.  *Note Init File::.
237
238    Similarly, if you set the variable
239 `view-calendar-holidays-initially' to `t', entering the calendar
240 automatically displays a list of holidays for the current three-month
241 period.  The holiday list appears in a separate window.
242
243    You can set the variable `mark-diary-entries-in-calendar' to `t' in
244 order to mark any dates with diary entries.  This takes effect whenever
245 the calendar window contents are recomputed.  There are two ways of
246 marking these dates: by changing the face (*note Faces::), if the
247 display supports that, or by placing a plus sign (`+') beside the date
248 otherwise.
249
250    Similarly, setting the variable `mark-holidays-in-calendar' to `t'
251 marks holiday dates, either with a change of face or with an asterisk
252 (`*').
253
254    The variable `calendar-holiday-marker' specifies how to mark a date
255 as being a holiday.  Its value may be a character to insert next to the
256 date, or a face name to use for displaying the date.  Likewise, the
257 variable `diary-entry-marker' specifies how to mark a date that has
258 diary entries.  The calendar creates faces named `holiday-face' and
259 `diary-face' for these purposes; those symbols are the default values
260 of these variables, when Emacs supports multiple faces on your terminal.
261
262    The variable `calendar-load-hook' is a normal hook run when the
263 calendar package is first loaded (before actually starting to display
264 the calendar).
265
266    Starting the calendar runs the normal hook
267 `initial-calendar-window-hook'.  Recomputation of the calendar display
268 does not run this hook.  But if you leave the calendar with the `q'
269 command and reenter it, the hook runs again.
270
271    The variable `today-visible-calendar-hook' is a normal hook run
272 after the calendar buffer has been prepared with the calendar when the
273 current date is visible in the window.  One use of this hook is to
274 replace today's date with asterisks; to do that, use the hook function
275 `calendar-star-date'.
276
277      (add-hook 'today-visible-calendar-hook 'calendar-star-date)
278
279 Another standard hook function marks the current date, either by
280 changing its face or by adding an asterisk.  Here's how to use it:
281
282      (add-hook 'today-visible-calendar-hook 'calendar-mark-today)
283
284 The variable `calendar-today-marker' specifies how to mark today's
285 date.  Its value should be a character to insert next to the date or a
286 face name to use for displaying the date.  A face named
287 `calendar-today-face' is provided for this purpose; that symbol is the
288 default for this variable when Emacs supports multiple faces on your
289 terminal.
290
291 A similar normal hook, `today-invisible-calendar-hook' is run if the
292 current date is _not_ visible in the window.
293
294 \1f
295 File: xemacs.info,  Node: Holiday Customizing,  Next: Date Display Format,  Prev: Calendar Customizing,  Up: Calendar Customization
296
297 Customizing the Holidays
298 ........................
299
300    Emacs knows about holidays defined by entries on one of several
301 lists.  You can customize these lists of holidays to your own needs,
302 adding or deleting holidays.  The lists of holidays that Emacs uses are
303 for general holidays (`general-holidays'), local holidays
304 (`local-holidays'), Christian holidays (`christian-holidays'), Hebrew
305 (Jewish) holidays (`hebrew-holidays'), Islamic (Moslem) holidays
306 (`islamic-holidays'), and other holidays (`other-holidays').
307
308    The general holidays are, by default, holidays common throughout the
309 United States.  To eliminate these holidays, set `general-holidays' to
310 `nil'.
311
312    There are no default local holidays (but sites may supply some).  You
313 can set the variable `local-holidays' to any list of holidays, as
314 described below.
315
316    By default, Emacs does not include all the holidays of the religions
317 that it knows, only those commonly found in secular calendars.  For a
318 more extensive collection of religious holidays, you can set any (or
319 all) of the variables `all-christian-calendar-holidays',
320 `all-hebrew-calendar-holidays', or `all-islamic-calendar-holidays' to
321 `t'.  If you want to eliminate the religious holidays, set any or all
322 of the corresponding variables `christian-holidays', `hebrew-holidays',
323 and `islamic-holidays' to `nil'.
324
325    You can set the variable `other-holidays' to any list of holidays.
326 This list, normally empty, is intended for individual use.
327
328    Each of the lists (`general-holidays', `local-holidays',
329 `christian-holidays', `hebrew-holidays', `islamic-holidays', and
330 `other-holidays') is a list of "holiday forms", each holiday form
331 describing a holiday (or sometimes a list of holidays).
332
333    Here is a table of the possible kinds of holiday form.  Day numbers
334 and month numbers count starting from 1, but "dayname" numbers count
335 Sunday as 0.  The element STRING is always the name of the holiday, as
336 a string.
337
338 `(holiday-fixed MONTH DAY STRING)'
339      A fixed date on the Gregorian calendar.  MONTH and DAY are
340      numbers, STRING is the name of the holiday.
341
342 `(holiday-float MONTH DAYNAME K STRING)'
343      The Kth DAYNAME in MONTH on the Gregorian calendar (DAYNAME=0 for
344      Sunday, and so on); negative K means count back from the end of
345      the month.  STRING is the name of the holiday.
346
347 `(holiday-hebrew MONTH DAY STRING)'
348      A fixed date on the Hebrew calendar.  MONTH and DAY are numbers,
349      STRING is the name of the holiday.
350
351 `(holiday-islamic MONTH DAY STRING)'
352      A fixed date on the Islamic calendar.  MONTH and DAY are numbers,
353      STRING is the name of the holiday.
354
355 `(holiday-julian MONTH DAY STRING)'
356      A fixed date on the Julian calendar.  MONTH and DAY are numbers,
357      STRING is the name of the holiday.
358
359 `(holiday-sexp SEXP STRING)'
360      A date calculated by the Lisp expression SEXP.  The expression
361      should use the variable `year' to compute and return the date of a
362      holiday, or `nil' if the holiday doesn't happen this year.  The
363      value of SEXP must represent the date as a list of the form
364      `(MONTH DAY YEAR)'.  STRING is the name of the holiday.
365
366 `(if CONDITION HOLIDAY-FORM &optional HOLIDAY-FORM)'
367      A holiday that happens only if CONDITION is true.
368
369 `(FUNCTION [ARGS])'
370      A list of dates calculated by the function FUNCTION, called with
371      arguments ARGS.
372
373    For example, suppose you want to add Bastille Day, celebrated in
374 France on July 14.  You can do this by adding the following line to
375 your init file:
376
377      (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
378
379    *Note Init File::.
380
381 The holiday form `(holiday-fixed 7 14 "Bastille Day")' specifies the
382 fourteenth day of the seventh month (July).
383
384    Many holidays occur on a specific day of the week, at a specific time
385 of month.  Here is a holiday form describing Hurricane Supplication Day,
386 celebrated in the Virgin Islands on the fourth Monday in August:
387
388      (holiday-float 8 1 4 "Hurricane Supplication Day")
389
390 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
391 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
392 the month (1 specifies the first occurrence, 2 the second occurrence,
393 -1 the last occurrence, -2 the second-to-last occurrence, and so on).
394
395    You can specify holidays that occur on fixed days of the Hebrew,
396 Islamic, and Julian calendars too.  For example,
397
398      (setq other-holidays
399            '((holiday-hebrew 10 2 "Last day of Hanukkah")
400              (holiday-islamic 3 12 "Mohammed's Birthday")
401              (holiday-julian 4 2 "Jefferson's Birthday")))
402
403 adds the last day of Hanukkah (since the Hebrew months are numbered with
404 1 starting from Nisan), the Islamic feast celebrating Mohammed's
405 birthday (since the Islamic months are numbered from 1 starting with
406 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
407 Julian calendar.
408
409    To include a holiday conditionally, use either Emacs Lisp's `if' or
410 the `holiday-sexp' form.  For example, American presidential elections
411 occur on the first Tuesday after the first Monday in November of years
412 divisible by 4:
413
414      (holiday-sexp (if (= 0 (% year 4))
415                         (calendar-gregorian-from-absolute
416                       (1+ (calendar-dayname-on-or-before
417                             1 (+ 6 (calendar-absolute-from-gregorian
418                                      (list 11 1 year))))))
419                    "US Presidential Election"))
420
421 or
422
423      (if (= 0 (% displayed-year 4))
424          (fixed 11
425                 (extract-calendar-day
426                   (calendar-gregorian-from-absolute
427                     (1+ (calendar-dayname-on-or-before
428                           1 (+ 6 (calendar-absolute-from-gregorian
429                                    (list 11 1 displayed-year)))))))
430                 "US Presidential Election"))
431
432    Some holidays just don't fit into any of these forms because special
433 calculations are involved in their determination.  In such cases you
434 must write a Lisp function to do the calculation.  To include eclipses,
435 for example, add `(eclipses)' to `other-holidays' and write an Emacs
436 Lisp function `eclipses' that returns a (possibly empty) list of the
437 relevant Gregorian dates among the range visible in the calendar
438 window, with descriptive strings, like this:
439
440      (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
441
442 \1f
443 File: xemacs.info,  Node: Date Display Format,  Next: Time Display Format,  Prev: Holiday Customizing,  Up: Calendar Customization
444
445 Date Display Format
446 ...................
447
448    You can customize the manner of displaying dates in the diary, in
449 mode lines, and in messages by setting `calendar-date-display-form'.
450 This variable holds a list of expressions that can involve the variables
451 `month', `day', and `year', which are all numbers in string form, and
452 `monthname' and `dayname', which are both alphabetic strings.  In the
453 American style, the default value of this list is as follows:
454
455      ((if dayname (concat dayname ", ")) monthname " " day ", " year)
456
457 while in the European style this value is the default:
458
459      ((if dayname (concat dayname ", ")) day " " monthname " " year)
460
461    + The ISO standard date representation is this:
462
463      (year "-" month "-" day)
464
465 This specifies a typical American format:
466
467      (month "/" day "/" (substring year -2))
468
469 \1f
470 File: xemacs.info,  Node: Time Display Format,  Next: Daylight Savings,  Prev: Date Display Format,  Up: Calendar Customization
471
472 Time Display Format
473 ...................
474
475    The calendar and diary by default display times of day in the
476 conventional American style with the hours from 1 through 12, minutes,
477 and either `am' or `pm'.  If you prefer the European style, also known
478 in the US as military, in which the hours go from 00 to 23, you can
479 alter the variable `calendar-time-display-form'.  This variable is a
480 list of expressions that can involve the variables `12-hours',
481 `24-hours', and `minutes', which are all numbers in string form, and
482 `am-pm' and `time-zone', which are both alphabetic strings.  The
483 default value of `calendar-time-display-form' is as follows:
484
485      (12-hours ":" minutes am-pm
486                (if time-zone " (") time-zone (if time-zone ")"))
487
488 Here is a value that provides European style times:
489
490      (24-hours ":" minutes
491                (if time-zone " (") time-zone (if time-zone ")"))
492
493 gives military-style times like `21:07 (UT)' if time zone names are
494 defined, and times like `21:07' if they are not.
495
496 \1f
497 File: xemacs.info,  Node: Daylight Savings,  Next: Diary Customizing,  Prev: Time Display Format,  Up: Calendar Customization
498
499 Daylight Savings Time
500 .....................
501
502    Emacs understands the difference between standard time and daylight
503 savings time--the times given for sunrise, sunset, solstices,
504 equinoxes, and the phases of the moon take that into account.  The rules
505 for daylight savings time vary from place to place and have also varied
506 historically from year to year.  To do the job properly, Emacs needs to
507 know which rules to use.
508
509    Some operating systems keep track of the rules that apply to the
510 place where you are; on these systems, Emacs gets the information it
511 needs from the system automatically.  If some or all of this
512 information is missing, Emacs fills in the gaps with the rules
513 currently used in Cambridge, Massachusetts.  If the resulting rules are
514 not what you want, you can tell Emacs the rules to use by setting
515 certain variables.
516
517    If the default choice of rules is not appropriate for your location,
518 you can tell Emacs the rules to use by setting the variables
519 `calendar-daylight-savings-starts' and
520 `calendar-daylight-savings-ends'.  Their values should be Lisp
521 expressions that refer to the variable `year', and evaluate to the
522 Gregorian date on which daylight savings time starts or (respectively)
523 ends, in the form of a list `(MONTH DAY YEAR)'.  The values should be
524 `nil' if your area does not use daylight savings time.
525
526    Emacs uses these expressions to determine the starting date of
527 daylight savings time for the holiday list  and for correcting times of
528 day in the solar and lunar calculations.
529
530    The values for Cambridge, Massachusetts are as follows:
531
532      (calendar-nth-named-day 1 0 4 year)
533      (calendar-nth-named-day -1 0 10 year)
534
535 That is, the first 0th day (Sunday) of the fourth month (April) in the
536 year specified by `year', and the last Sunday of the tenth month
537 (October) of that year.  If daylight savings time were changed to start
538 on October 1, you would set `calendar-daylight-savings-starts' to this:
539
540      (list 10 1 year)
541
542    For a more complex example, suppose daylight savings time begins on
543 the first of Nisan on the Hebrew calendar.  You should set
544 `calendar-daylight-savings-starts' to this value:
545
546      (calendar-gregorian-from-absolute
547        (calendar-absolute-from-hebrew
548          (list 1 1 (+ year 3760))))
549
550 because Nisan is the first month in the Hebrew calendar and the Hebrew
551 year differs from the Gregorian year by 3760 at Nisan.
552
553    If there is no daylight savings time at your location, or if you want
554 all times in standard time, set `calendar-daylight-savings-starts' and
555 `calendar-daylight-savings-ends' to `nil'.
556
557    The variable `calendar-daylight-time-offset' specifies the
558 difference between daylight savings time and standard time, measured in
559 minutes.  The value for Cambridge, Massachusetts is 60.
560
561    The two variables `calendar-daylight-savings-starts-time' and
562 `calendar-daylight-savings-ends-time' specify the number of minutes
563 after midnight local time when the transition to and from daylight
564 savings time should occur.  For Cambridge, Massachusetts both variables'
565 values are 120.
566
567 \1f
568 File: xemacs.info,  Node: Diary Customizing,  Next: Hebrew/Islamic Entries,  Prev: Daylight Savings,  Up: Calendar Customization
569
570 Customizing the Diary
571 .....................
572
573    Ordinarily, the mode line of the diary buffer window indicates any
574 holidays that fall on the date of the diary entries.  The process of
575 checking for holidays can take several seconds, so including holiday
576 information delays the display of the diary buffer noticeably.  If you'd
577 prefer to have a faster display of the diary buffer but without the
578 holiday information, set the variable `holidays-in-diary-buffer' to
579 `nil'.
580
581    The variable `number-of-diary-entries' controls the number of days
582 of diary entries to be displayed at one time.  It affects the initial
583 display when `view-diary-entries-initially' is `t', as well as the
584 command `M-x diary'.  For example, the default value is 1, which says
585 to display only the current day's diary entries.  If the value is 2,
586 both the current day's and the next day's entries are displayed.  The
587 value can also be a vector of seven elements: for example, if the value
588 is `[0 2 2 2 2 4 1]' then no diary entries appear on Sunday, the
589 current date's and the next day's diary entries appear Monday through
590 Thursday, Friday through Monday's entries appear on Friday, while on
591 Saturday only that day's entries appear.
592
593    The variable `print-diary-entries-hook' is a normal hook run after
594 preparation of a temporary buffer containing just the diary entries
595 currently visible in the diary buffer.  (The other, irrelevant diary
596 entries are really absent from the temporary buffer; in the diary
597 buffer, they are merely hidden.)  The default value of this hook does
598 the printing with the command `lpr-buffer'.  If you want to use a
599 different command to do the printing, just change the value of this
600 hook.  Other uses might include, for example, rearranging the lines into
601 order by day and time.
602
603    You can customize the form of dates in your diary file, if neither
604 the standard American nor European styles suits your needs, by setting
605 the variable `diary-date-forms'.  This variable is a list of patterns
606 for recognizing a date.  Each date pattern is a list whose elements may
607 be regular expressions (*note Regexps::) or the symbols `month', `day',
608 `year', `monthname', and `dayname'.  All these elements serve as
609 patterns that match certain kinds of text in the diary file.  In order
610 for the date pattern, as a whole, to match, all of its elements must
611 match consecutively.
612
613    A regular expression in a date pattern matches in its usual fashion,
614 using the standard syntax table altered so that `*' is a word
615 constituent.
616
617    The symbols `month', `day', `year', `monthname', and `dayname' match
618 the month number, day number, year number, month name, and day name of
619 the date being considered.  The symbols that match numbers allow
620 leading zeros; those that match names allow three-letter abbreviations
621 and capitalization.  All the symbols can match `*'; since `*' in a
622 diary entry means "any day", "any month", and so on, it should match
623 regardless of the date being considered.
624
625    The default value of `diary-date-forms' in the American style is
626 this:
627
628      ((month "/" day "[^/0-9]")
629       (month "/" day "/" year "[^0-9]")
630       (monthname " *" day "[^,0-9]")
631       (monthname " *" day ", *" year "[^0-9]")
632       (dayname "\\W"))
633
634 Emacs matches of the diary entries with the date forms is done with the
635 standard syntax table from Fundamental mode (*note Syntax Tables:
636 (lispref)Syntax Tables.), but with the `*' changed so that it is a word
637 constituent.
638
639    The date patterns in the list must be _mutually exclusive_ and must
640 not match any portion of the diary entry itself, just the date and one
641 character of whitespace.  If, to be mutually exclusive, the pattern
642 must match a portion of the diary entry text--beyond the whitespace
643 that ends the date--then the first element of the date pattern _must_
644 be `backup'.  This causes the date recognizer to back up to the
645 beginning of the current word of the diary entry, after finishing the
646 match.  Even if you use `backup', the date pattern must absolutely not
647 match more than a portion of the first word of the diary entry.  The
648 default value of `diary-date-forms' in the European style is this list:
649
650      ((day "/" month "[^/0-9]")
651       (day "/" month "/" year "[^0-9]")
652       (backup day " *" monthname "\\W+\\<[^*0-9]")
653       (day " *" monthname " *" year "[^0-9]")
654       (dayname "\\W"))
655
656 Notice the use of `backup' in the third pattern, because it needs to
657 match part of a word beyond the date itself to distinguish it from the
658 fourth pattern.
659
660 \1f
661 File: xemacs.info,  Node: Hebrew/Islamic Entries,  Next: Fancy Diary Display,  Prev: Diary Customizing,  Up: Calendar Customization
662
663 Hebrew- and Islamic-Date Diary Entries
664 ......................................
665
666    Your diary file can have entries based on Hebrew or Islamic dates, as
667 well as entries based on the world-standard Gregorian calendar.
668 However, because recognition of such entries is time-consuming and most
669 people don't use them, you must explicitly enable their use.  If you
670 want the diary to recognize Hebrew-date diary entries, for example, you
671 must do this:
672
673      (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
674      (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
675
676 If you want Islamic-date entries, do this:
677
678      (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
679      (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
680
681    Hebrew- and Islamic-date diary entries have the same formats as
682 Gregorian-date diary entries, except that `H' precedes a Hebrew date
683 and `I' precedes an Islamic date.  Moreover, because the Hebrew and
684 Islamic month names are not uniquely specified by the first three
685 letters, you may not abbreviate them.  For example, a diary entry for
686 the Hebrew date Heshvan 25 could look like this:
687
688      HHeshvan 25 Happy Hebrew birthday!
689
690 and would appear in the diary for any date that corresponds to Heshvan
691 25 on the Hebrew calendar.  And here is  Islamic-date diary entry  that
692 matches Dhu al-Qada 25:
693
694      IDhu al-Qada 25 Happy Islamic birthday!
695
696 and would appear in the diary for any date that corresponds to Dhu
697 al-Qada 25 on the Islamic calendar.
698
699    As with Gregorian-date diary entries, Hebrew- and Islamic-date
700 entries are nonmarking if they are preceded with an ampersand (`&').
701
702    Here is a table of commands used in the calendar to create diary
703 entries that match the selected date and other dates that are similar
704 in the Hebrew or Islamic calendar:
705
706 `i h d'
707      Add a diary entry for the Hebrew date corresponding to the
708      selected date (`insert-hebrew-diary-entry').
709
710 `i h m'
711      Add a diary entry for the day of the Hebrew month corresponding to
712      the selected date (`insert-monthly-hebrew-diary-entry').  This
713      diary entry matches any date that has the same Hebrew
714      day-within-month as the selected date.
715
716 `i h y'
717      Add a diary entry for the day of the Hebrew year corresponding to
718      the selected date (`insert-yearly-hebrew-diary-entry').  This diary
719      entry matches any date which has the same Hebrew month and
720      day-within-month as the selected date.
721
722 `i i d'
723      Add a diary entry for the Islamic date corresponding to the
724      selected date (`insert-islamic-diary-entry').
725
726 `i i m'
727      Add a diary entry for the day of the Islamic month corresponding
728      to the selected date (`insert-monthly-islamic-diary-entry').
729
730 `i i y'
731      Add a diary entry for the day of the Islamic year corresponding to
732      the selected date (`insert-yearly-islamic-diary-entry').
733
734    These commands work much like the corresponding commands for ordinary
735 diary entries: they apply to the date that point is on in the calendar
736 window, and what they do is insert just the date portion of a diary
737 entry at the end of your diary file.  You must then insert the rest of
738 the diary entry.
739
740 \1f
741 File: xemacs.info,  Node: Fancy Diary Display,  Next: Included Diary Files,  Prev: Hebrew/Islamic Entries,  Up: Calendar Customization
742
743 Fancy Diary Display
744 ...................
745
746    Diary display works by preparing the diary buffer and then running
747 the hook `diary-display-hook'.  The default value of this hook
748 (`simple-diary-display') hides the irrelevant diary entries and then
749 displays the buffer.  However, if you specify the hook as follows,
750
751      (add-hook 'diary-display-hook 'fancy-diary-display)
752
753 this enables fancy diary display.  It displays diary entries and
754 holidays by copying them into a special buffer that exists only for the
755 sake of display.  Copying to a separate buffer provides an opportunity
756 to change the displayed text to make it prettier--for example, to sort
757 the entries by the dates they apply to.
758
759    As with simple diary display, you can print a hard copy of the buffer
760 with `print-diary-entries'.  To print a hard copy of a day-by-day diary
761 for a week by positioning point on Sunday of that week, type `7 d' and
762 then do `M-x print-diary-entries'.  As usual, the inclusion of the
763 holidays slows down the display slightly; you can speed things up by
764 setting the variable `holidays-in-diary-buffer' to `nil'.
765
766    Ordinarily, the fancy diary buffer does not show days for which
767 there are no diary entries, even if that day is a holiday.  If you want
768 such days to be shown in the fancy diary buffer, set the variable
769 `diary-list-include-blanks' to `t'.
770
771    If you use the fancy diary display, you can use the normal hook
772 `list-diary-entries-hook' to sort each day's diary entries by their
773 time of day.  Add this line to your init file:
774
775      (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
776
777    *Note Init File::.
778
779 For each day, this sorts diary entries that begin with a recognizable
780 time of day according to their times.  Diary entries without times come
781 first within each day.
782
783 \1f
784 File: xemacs.info,  Node: Included Diary Files,  Next: Sexp Diary Entries,  Prev: Fancy Diary Display,  Up: Calendar Customization
785
786 Included Diary Files
787 ....................
788
789    Fancy diary display also has the ability to process included diary
790 files.  This permits a group of people to share a diary file for events
791 that apply to all of them.  Lines in the diary file of this form:
792
793      #include "FILENAME"
794
795 includes the diary entries from the file FILENAME in the fancy diary
796 buffer.  The include mechanism is recursive, so that included files can
797 include other files, and so on; you must be careful not to have a cycle
798 of inclusions, of course.  Here is how to enable the include facility:
799
800      (add-hook 'list-diary-entries-hook 'include-other-diary-files)
801      (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
802
803    The include mechanism works only with the fancy diary display,
804 because ordinary diary display shows the entries directly from your
805 diary file.
806
807 \1f
808 File: xemacs.info,  Node: Sexp Diary Entries,  Next: Appt Customizing,  Prev: Included Diary Files,  Up: Calendar Customization
809
810 Sexp Entries and the Fancy Diary Display
811 ........................................
812
813    Sexp diary entries allow you to do more than just have complicated
814 conditions under which a diary entry applies.  If you use the fancy
815 diary display, sexp entries can generate the text of the entry depending
816 on the date itself.  For example, an anniversary diary entry can insert
817 the number of years since the anniversary date into the text of the
818 diary entry.  Thus the `%d' in this dairy entry:
819
820      %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
821
822 gets replaced by the age, so on October 31, 1990 the entry appears in
823 the fancy diary buffer like this:
824
825      Arthur's birthday (42 years old)
826
827 If the diary file instead contains this entry:
828
829      %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
830
831 the entry in the fancy diary buffer for October 31, 1990 appears like
832 this:
833
834      Arthur's 42nd birthday
835
836    Similarly, cyclic diary entries can interpolate the number of
837 repetitions that have occurred:
838
839      %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
840
841 looks like this:
842
843      Renew medication (5th time)
844
845 in the fancy diary display on September 8, 1990.
846
847    The generality of sexp diary entries lets you specify any diary entry
848 that you can describe algorithmically.  A sexp diary entry contains an
849 expression that computes whether the entry applies to any given date.
850 If its value is non-`nil', the entry applies to that date; otherwise,
851 it does not.  The expression can use the variable  `date' to find the
852 date being considered; its value is a list (MONTH DAY YEAR) that refers
853 to the Gregorian calendar.
854
855    Suppose you get paid on the 21st of the month if it is a weekday, and
856 on the Friday before if the 21st is on a weekend.  Here is how to write
857 a sexp diary entry that matches those dates:
858
859      &%%(let ((dayname (calendar-day-of-week date))
860               (day (car (cdr date))))
861            (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
862                (and (memq day '(19 20)) (= dayname 5)))
863               ) Pay check deposited
864
865 applies to just those dates.  This example illustrates how the sexp can
866 depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
867 that gives the Gregorian date for which the diary entries are being
868 found.  If the value of the expression is `t', the entry applies to
869 that date.  If the expression evaluates to `nil', the entry does _not_
870 apply to that date.
871
872    The following sexp diary entries take advantage of the ability (in
873 the fancy diary display) to concoct diary entries whose text varies
874 based on the date:
875
876 `%%(diary-sunrise-sunset)'
877      Make a diary entry for the local times of today's sunrise and
878      sunset.
879
880 `%%(diary-phases-of-moon)'
881      Make a diary entry for the phases (quarters) of the moon.
882
883 `%%(diary-day-of-year)'
884      Make a diary entry with today's day number in the current year and
885      the number of days remaining in the current year.
886
887 `%%(diary-iso-date)'
888      Make a diary entry with today's equivalent ISO commercial date.
889
890 `%%(diary-julian-date)'
891      Make a diary entry with today's equivalent date on the Julian
892      calendar.
893
894 `%%(diary-astro-day-number)'
895      Make a diary entry with today's equivalent astronomical (Julian)
896      day number.
897
898 `%%(diary-hebrew-date)'
899      Make a diary entry with today's equivalent date on the Hebrew
900      calendar.
901
902 `%%(diary-islamic-date)'
903      Make a diary entry with today's equivalent date on the Islamic
904      calendar.
905
906 `%%(diary-french-date)'
907      Make a diary entry with today's equivalent date on the French
908      Revolutionary calendar.
909
910 `%%(diary-mayan-date)'
911      Make a diary entry with today's equivalent date on the Mayan
912      calendar.
913
914 Thus including the diary entry
915
916      &%%(diary-hebrew-date)
917
918 causes every day's diary display to contain the equivalent date on the
919 Hebrew calendar, if you are using the fancy diary display.  (With simple
920 diary display, the line `&%%(diary-hebrew-date)' appears in the diary
921 for any date, but does nothing particularly useful.)
922
923    These functions can be used to construct sexp diary entries based on
924 the Hebrew calendar in certain standard ways:
925
926 `%%(diary-rosh-hodesh)'
927      Make a diary entry that tells the occurrence and ritual
928      announcement of each new Hebrew month.
929
930 `%%(diary-parasha)'
931      Make a Saturday diary entry that tells the weekly synagogue
932      scripture reading.
933
934 `%%(diary-sabbath-candles)'
935      Make a Friday diary entry that tells the _local time_ of Sabbath
936      candle lighting.
937
938 `%%(diary-omer)'
939      Make a diary entry that gives the omer count, when appropriate.
940
941 `%%(diary-yahrzeit MONTH DAY YEAR) NAME'
942      Make a diary entry marking the anniversary of a date of death.
943      The date is the _Gregorian_ (civil) date of death.  The diary
944      entry appears on the proper Hebrew calendar anniversary and on the
945      day before.  (In the European style, the order of the parameters
946      is changed to DAY, MONTH, YEAR.)
947
948 \1f
949 File: xemacs.info,  Node: Appt Customizing,  Prev: Sexp Diary Entries,  Up: Calendar Customization
950
951 Customizing Appointment Reminders
952 .................................
953
954    You can specify exactly how Emacs reminds you of an appointment, and
955 how far in advance it begins doing so, by setting these variables:
956
957 `appt-message-warning-time'
958      The time in minutes before an appointment that the reminder
959      begins.  The default is 10 minutes.
960
961 `appt-audible'
962      If this is `t' (the default), Emacs rings the terminal bell for
963      appointment reminders.
964
965 `appt-visible'
966      If this is `t' (the default), Emacs displays the appointment
967      message in echo area.
968
969 `appt-display-mode-line'
970      If this is `t' (the default), Emacs displays the number of minutes
971      to the appointment on the mode line.
972
973 `appt-msg-window'
974      If this is `t' (the default), Emacs displays the appointment
975      message in another window.
976
977 `appt-display-duration'
978      The number of seconds an appointment message is displayed.  The
979      default is 5 seconds.
980
981 \1f
982 File: xemacs.info,  Node: Sorting,  Next: Shell,  Prev: Calendar/Diary,  Up: Top
983
984 Sorting Text
985 ============
986
987    XEmacs provides several commands for sorting text in a buffer.  All
988 operate on the contents of the region (the text between point and the
989 mark).  They divide the text of the region into many "sort records",
990 identify a "sort key" for each record, and then reorder the records
991 using the order determined by the sort keys.  The records are ordered so
992 that their keys are in alphabetical order, or, for numerical sorting, in
993 numerical order.  In alphabetical sorting, all upper-case letters `A'
994 through `Z' come before lower-case `a', in accordance with the ASCII
995 character sequence.
996
997    The sort commands differ in how they divide the text into sort
998 records and in which part of each record they use as the sort key.
999 Most of the commands make each line a separate sort record, but some
1000 commands use paragraphs or pages as sort records.  Most of the sort
1001 commands use each entire sort record as its own sort key, but some use
1002 only a portion of the record as the sort key.
1003
1004 `M-x sort-lines'
1005      Divide the region into lines and sort by comparing the entire text
1006      of a line.  A prefix argument means sort in descending order.
1007
1008 `M-x sort-paragraphs'
1009      Divide the region into paragraphs and sort by comparing the entire
1010      text of a paragraph (except for leading blank lines).  A prefix
1011      argument means sort in descending order.
1012
1013 `M-x sort-pages'
1014      Divide the region into pages and sort by comparing the entire text
1015      of a page (except for leading blank lines).  A prefix argument
1016      means sort in descending order.
1017
1018 `M-x sort-fields'
1019      Divide the region into lines and sort by comparing the contents of
1020      one field in each line.  Fields are defined as separated by
1021      whitespace, so the first run of consecutive non-whitespace
1022      characters in a line constitutes field 1, the second such run
1023      constitutes field 2, etc.
1024
1025      You specify which field to sort by with a numeric argument: 1 to
1026      sort by field 1, etc.  A negative argument means sort in descending
1027      order.  Thus, minus 2 means sort by field 2 in reverse-alphabetical
1028      order.
1029
1030 `M-x sort-numeric-fields'
1031      Like `M-x sort-fields', except the specified field is converted to
1032      a number for each line and the numbers are compared.  `10' comes
1033      before `2' when considered as text, but after it when considered
1034      as a number.
1035
1036 `M-x sort-columns'
1037      Like `M-x sort-fields', except that the text within each line used
1038      for comparison comes from a fixed range of columns.  An explanation
1039      is given below.
1040
1041    For example, if the buffer contains:
1042
1043      On systems where clash detection (locking of files being edited) is
1044      implemented, XEmacs also checks the first time you modify a buffer
1045      whether the file has changed on disk since it was last visited or
1046      saved.  If it has, you are asked to confirm that you want to change
1047      the buffer.
1048
1049 then if you apply `M-x sort-lines' to the entire buffer you get:
1050
1051      On systems where clash detection (locking of files being edited) is
1052      implemented, XEmacs also checks the first time you modify a buffer
1053      saved.  If it has, you are asked to confirm that you want to change
1054      the buffer.
1055      whether the file has changed on disk since it was last visited or
1056
1057 where the upper case `O' comes before all lower case letters.  If you
1058 apply instead `C-u 2 M-x sort-fields' you get:
1059
1060      saved.  If it has, you are asked to confirm that you want to change
1061      implemented, XEmacs also checks the first time you modify a buffer
1062      the buffer.
1063      On systems where clash detection (locking of files being edited) is
1064      whether the file has changed on disk since it was last visited or
1065
1066 where the sort keys were `If', `XEmacs', `buffer', `systems', and `the'.
1067
1068    `M-x sort-columns' requires more explanation.  You specify the
1069 columns by putting point at one of the columns and the mark at the other
1070 column.  Because this means you cannot put point or the mark at the
1071 beginning of the first line to sort, this command uses an unusual
1072 definition of `region': all of the line point is in is considered part
1073 of the region, and so is all of the line the mark is in.
1074
1075    For example, to sort a table by information found in columns 10 to
1076 15, you could put the mark on column 10 in the first line of the table,
1077 and point on column 15 in the last line of the table, and then use this
1078 command.  Or you could put the mark on column 15 in the first line and
1079 point on column 10 in the last line.
1080
1081    This can be thought of as sorting the rectangle specified by point
1082 and the mark, except that the text on each line to the left or right of
1083 the rectangle moves along with the text inside the rectangle.  *Note
1084 Rectangles::.
1085
1086 \1f
1087 File: xemacs.info,  Node: Shell,  Next: Narrowing,  Prev: Sorting,  Up: Top
1088
1089 Running Shell Commands from XEmacs
1090 ==================================
1091
1092    XEmacs has commands for passing single command lines to inferior
1093 shell processes; it can also run a shell interactively with input and
1094 output to an XEmacs buffer `*shell*'.
1095
1096 `M-!'
1097      Run a specified shell command line and display the output
1098      (`shell-command').
1099
1100 `M-|'
1101      Run a specified shell command line with region contents as input;
1102      optionally replace the region with the output
1103      (`shell-command-on-region').
1104
1105 `M-x shell'
1106      Run a subshell with input and output through an XEmacs buffer.
1107      You can then give commands interactively.
1108
1109 `M-x term'
1110      Run a subshell with input and output through an XEmacs buffer.
1111      You can then give commands interactively.  Full terminal emulation
1112      is available.
1113
1114 * Menu:
1115
1116 * Single Shell::         How to run one shell command and return.
1117 * Interactive Shell::    Permanent shell taking input via XEmacs.
1118 * Shell Mode::           Special XEmacs commands used with permanent shell.
1119 * Terminal emulator::    An XEmacs window as a terminal emulator.
1120 * Term Mode::            Special XEmacs commands used in Term mode.
1121 * Paging in Term::       Paging in the terminal emulator.
1122
1123 \1f
1124 File: xemacs.info,  Node: Single Shell,  Next: Interactive Shell,  Prev: Shell,  Up: Shell
1125
1126 Single Shell Commands
1127 ---------------------
1128
1129    `M-!' (`shell-command') reads a line of text using the minibuffer
1130 and creates an inferior shell to execute the line as a command.
1131 Standard input from the command comes from the null device.  If the
1132 shell command produces any output, the output goes to an XEmacs buffer
1133 named `*Shell Command Output*', which is displayed in another window
1134 but not selected.  A numeric argument, as in `M-1 M-!', directs this
1135 command to insert any output into the current buffer.  In that case,
1136 point is left before the output and the mark is set after the output.
1137
1138    `M-|' (`shell-command-on-region') is like `M-!' but passes the
1139 contents of the region as input to the shell command, instead of no
1140 input.  If a numeric argument is used to direct  output to the current
1141 buffer, then the old region is deleted first and the output replaces it
1142 as the contents of the region.
1143
1144    Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
1145 use.  This variable is initialized based on your `SHELL' environment
1146 variable when you start XEmacs.  If the file name does not specify a
1147 directory, the directories in the list `exec-path' are searched; this
1148 list is initialized based on the `PATH' environment variable when you
1149 start XEmacs.  You can override either or both of these default
1150 initializations in your init file. *Note Init File::.
1151
1152    When you use `M-!' and `M-|', XEmacs has to wait until the shell
1153 command completes.  You can quit with `C-g'; that terminates the shell
1154 command.
1155