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