1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
4 INFO-DIR-SECTION XEmacs Editor
6 * XEmacs: (xemacs). XEmacs Editor.
9 This file documents the XEmacs editor.
11 Copyright (C) 1985, 1986, 1988 Richard M. Stallman. Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc. Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc. Copyright (C) 1995 Amdahl Corporation.
15 Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
19 Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
26 Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
33 File: xemacs.info, Node: Calendar Customization, Prev: Diary, Up: Calendar/Diary
35 Customizing the Calendar and Diary
36 ----------------------------------
38 There are many customizations that you can use to make the calendar
39 and diary suit your personal tastes.
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.
56 File: xemacs.info, Node: Calendar Customizing, Next: Holiday Customizing, Up: Calendar Customization
58 Customizing the Calendar
59 ........................
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
67 (setq view-diary-entries-initially t)
70 this displays both the calendar and diary windows whenever you start
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.
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
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
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.
97 The variable `calendar-load-hook' is a normal hook run when the
98 calendar package is first loaded (before actually starting to display
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.
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'.
112 (add-hook 'today-visible-calendar-hook 'calendar-star-date)
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:
117 (add-hook 'today-visible-calendar-hook 'calendar-mark-today)
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
126 A similar normal hook, `today-invisible-calendar-hook' is run if the
127 current date is _not_ visible in the window.
130 File: xemacs.info, Node: Holiday Customizing, Next: Date Display Format, Prev: Calendar Customizing, Up: Calendar Customization
132 Customizing the Holidays
133 ........................
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').
143 The general holidays are, by default, holidays common throughout the
144 United States. To eliminate these holidays, set `general-holidays' to
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
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'.
160 You can set the variable `other-holidays' to any list of holidays.
161 This list, normally empty, is intended for individual use.
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).
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
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.
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.
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.
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.
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.
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.
201 `(if CONDITION HOLIDAY-FORM &optional HOLIDAY-FORM)'
202 A holiday that happens only if CONDITION is true.
205 A list of dates calculated by the function FUNCTION, called with
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
212 (setq other-holidays '((holiday-fixed 7 14 "Bastille Day")))
214 The holiday form `(holiday-fixed 7 14 "Bastille Day")' specifies the
215 fourteenth day of the seventh month (July).
217 Many holidays occur on a specific day of the week, at a specific time
218 of month. Here is a holiday form describing Hurricane Supplication Day,
219 celebrated in the Virgin Islands on the fourth Monday in August:
221 (holiday-float 8 1 4 "Hurricane Supplication Day")
223 Here the 8 specifies August, the 1 specifies Monday (Sunday is 0,
224 Tuesday is 2, and so on), and the 4 specifies the fourth occurrence in
225 the month (1 specifies the first occurrence, 2 the second occurrence,
226 -1 the last occurrence, -2 the second-to-last occurrence, and so on).
228 You can specify holidays that occur on fixed days of the Hebrew,
229 Islamic, and Julian calendars too. For example,
232 '((holiday-hebrew 10 2 "Last day of Hanukkah")
233 (holiday-islamic 3 12 "Mohammed's Birthday")
234 (holiday-julian 4 2 "Jefferson's Birthday")))
236 adds the last day of Hanukkah (since the Hebrew months are numbered with
237 1 starting from Nisan), the Islamic feast celebrating Mohammed's
238 birthday (since the Islamic months are numbered from 1 starting with
239 Muharram), and Thomas Jefferson's birthday, which is 2 April 1743 on the
242 To include a holiday conditionally, use either Emacs Lisp's `if' or
243 the `holiday-sexp' form. For example, American presidential elections
244 occur on the first Tuesday after the first Monday in November of years
247 (holiday-sexp (if (= 0 (% year 4))
248 (calendar-gregorian-from-absolute
249 (1+ (calendar-dayname-on-or-before
250 1 (+ 6 (calendar-absolute-from-gregorian
251 (list 11 1 year))))))
252 "US Presidential Election"))
256 (if (= 0 (% displayed-year 4))
258 (extract-calendar-day
259 (calendar-gregorian-from-absolute
260 (1+ (calendar-dayname-on-or-before
261 1 (+ 6 (calendar-absolute-from-gregorian
262 (list 11 1 displayed-year)))))))
263 "US Presidential Election"))
265 Some holidays just don't fit into any of these forms because special
266 calculations are involved in their determination. In such cases you
267 must write a Lisp function to do the calculation. To include eclipses,
268 for example, add `(eclipses)' to `other-holidays' and write an Emacs
269 Lisp function `eclipses' that returns a (possibly empty) list of the
270 relevant Gregorian dates among the range visible in the calendar
271 window, with descriptive strings, like this:
273 (((6 27 1991) "Lunar Eclipse") ((7 11 1991) "Solar Eclipse") ... )
276 File: xemacs.info, Node: Date Display Format, Next: Time Display Format, Prev: Holiday Customizing, Up: Calendar Customization
281 You can customize the manner of displaying dates in the diary, in
282 mode lines, and in messages by setting `calendar-date-display-form'.
283 This variable holds a list of expressions that can involve the variables
284 `month', `day', and `year', which are all numbers in string form, and
285 `monthname' and `dayname', which are both alphabetic strings. In the
286 American style, the default value of this list is as follows:
288 ((if dayname (concat dayname ", ")) monthname " " day ", " year)
290 while in the European style this value is the default:
292 ((if dayname (concat dayname ", ")) day " " monthname " " year)
294 + The ISO standard date representation is this:
296 (year "-" month "-" day)
298 This specifies a typical American format:
300 (month "/" day "/" (substring year -2))
303 File: xemacs.info, Node: Time Display Format, Next: Daylight Savings, Prev: Date Display Format, Up: Calendar Customization
308 The calendar and diary by default display times of day in the
309 conventional American style with the hours from 1 through 12, minutes,
310 and either `am' or `pm'. If you prefer the European style, also known
311 in the US as military, in which the hours go from 00 to 23, you can
312 alter the variable `calendar-time-display-form'. This variable is a
313 list of expressions that can involve the variables `12-hours',
314 `24-hours', and `minutes', which are all numbers in string form, and
315 `am-pm' and `time-zone', which are both alphabetic strings. The
316 default value of `calendar-time-display-form' is as follows:
318 (12-hours ":" minutes am-pm
319 (if time-zone " (") time-zone (if time-zone ")"))
321 Here is a value that provides European style times:
323 (24-hours ":" minutes
324 (if time-zone " (") time-zone (if time-zone ")"))
326 gives military-style times like `21:07 (UT)' if time zone names are
327 defined, and times like `21:07' if they are not.
330 File: xemacs.info, Node: Daylight Savings, Next: Diary Customizing, Prev: Time Display Format, Up: Calendar Customization
332 Daylight Savings Time
333 .....................
335 Emacs understands the difference between standard time and daylight
336 savings time--the times given for sunrise, sunset, solstices,
337 equinoxes, and the phases of the moon take that into account. The rules
338 for daylight savings time vary from place to place and have also varied
339 historically from year to year. To do the job properly, Emacs needs to
340 know which rules to use.
342 Some operating systems keep track of the rules that apply to the
343 place where you are; on these systems, Emacs gets the information it
344 needs from the system automatically. If some or all of this
345 information is missing, Emacs fills in the gaps with the rules
346 currently used in Cambridge, Massachusetts. If the resulting rules are
347 not what you want, you can tell Emacs the rules to use by setting
350 If the default choice of rules is not appropriate for your location,
351 you can tell Emacs the rules to use by setting the variables
352 `calendar-daylight-savings-starts' and
353 `calendar-daylight-savings-ends'. Their values should be Lisp
354 expressions that refer to the variable `year', and evaluate to the
355 Gregorian date on which daylight savings time starts or (respectively)
356 ends, in the form of a list `(MONTH DAY YEAR)'. The values should be
357 `nil' if your area does not use daylight savings time.
359 Emacs uses these expressions to determine the starting date of
360 daylight savings time for the holiday list and for correcting times of
361 day in the solar and lunar calculations.
363 The values for Cambridge, Massachusetts are as follows:
365 (calendar-nth-named-day 1 0 4 year)
366 (calendar-nth-named-day -1 0 10 year)
368 That is, the first 0th day (Sunday) of the fourth month (April) in the
369 year specified by `year', and the last Sunday of the tenth month
370 (October) of that year. If daylight savings time were changed to start
371 on October 1, you would set `calendar-daylight-savings-starts' to this:
375 For a more complex example, suppose daylight savings time begins on
376 the first of Nisan on the Hebrew calendar. You should set
377 `calendar-daylight-savings-starts' to this value:
379 (calendar-gregorian-from-absolute
380 (calendar-absolute-from-hebrew
381 (list 1 1 (+ year 3760))))
383 because Nisan is the first month in the Hebrew calendar and the Hebrew
384 year differs from the Gregorian year by 3760 at Nisan.
386 If there is no daylight savings time at your location, or if you want
387 all times in standard time, set `calendar-daylight-savings-starts' and
388 `calendar-daylight-savings-ends' to `nil'.
390 The variable `calendar-daylight-time-offset' specifies the
391 difference between daylight savings time and standard time, measured in
392 minutes. The value for Cambridge, Massachusetts is 60.
394 The two variables `calendar-daylight-savings-starts-time' and
395 `calendar-daylight-savings-ends-time' specify the number of minutes
396 after midnight local time when the transition to and from daylight
397 savings time should occur. For Cambridge, Massachusetts both variables'
401 File: xemacs.info, Node: Diary Customizing, Next: Hebrew/Islamic Entries, Prev: Daylight Savings, Up: Calendar Customization
403 Customizing the Diary
404 .....................
406 Ordinarily, the mode line of the diary buffer window indicates any
407 holidays that fall on the date of the diary entries. The process of
408 checking for holidays can take several seconds, so including holiday
409 information delays the display of the diary buffer noticeably. If you'd
410 prefer to have a faster display of the diary buffer but without the
411 holiday information, set the variable `holidays-in-diary-buffer' to
414 The variable `number-of-diary-entries' controls the number of days
415 of diary entries to be displayed at one time. It affects the initial
416 display when `view-diary-entries-initially' is `t', as well as the
417 command `M-x diary'. For example, the default value is 1, which says
418 to display only the current day's diary entries. If the value is 2,
419 both the current day's and the next day's entries are displayed. The
420 value can also be a vector of seven elements: for example, if the value
421 is `[0 2 2 2 2 4 1]' then no diary entries appear on Sunday, the
422 current date's and the next day's diary entries appear Monday through
423 Thursday, Friday through Monday's entries appear on Friday, while on
424 Saturday only that day's entries appear.
426 The variable `print-diary-entries-hook' is a normal hook run after
427 preparation of a temporary buffer containing just the diary entries
428 currently visible in the diary buffer. (The other, irrelevant diary
429 entries are really absent from the temporary buffer; in the diary
430 buffer, they are merely hidden.) The default value of this hook does
431 the printing with the command `lpr-buffer'. If you want to use a
432 different command to do the printing, just change the value of this
433 hook. Other uses might include, for example, rearranging the lines into
434 order by day and time.
436 You can customize the form of dates in your diary file, if neither
437 the standard American nor European styles suits your needs, by setting
438 the variable `diary-date-forms'. This variable is a list of patterns
439 for recognizing a date. Each date pattern is a list whose elements may
440 be regular expressions (*note Regexps::) or the symbols `month', `day',
441 `year', `monthname', and `dayname'. All these elements serve as
442 patterns that match certain kinds of text in the diary file. In order
443 for the date pattern, as a whole, to match, all of its elements must
446 A regular expression in a date pattern matches in its usual fashion,
447 using the standard syntax table altered so that `*' is a word
450 The symbols `month', `day', `year', `monthname', and `dayname' match
451 the month number, day number, year number, month name, and day name of
452 the date being considered. The symbols that match numbers allow
453 leading zeros; those that match names allow three-letter abbreviations
454 and capitalization. All the symbols can match `*'; since `*' in a
455 diary entry means "any day", "any month", and so on, it should match
456 regardless of the date being considered.
458 The default value of `diary-date-forms' in the American style is
461 ((month "/" day "[^/0-9]")
462 (month "/" day "/" year "[^0-9]")
463 (monthname " *" day "[^,0-9]")
464 (monthname " *" day ", *" year "[^0-9]")
467 Emacs matches of the diary entries with the date forms is done with the
468 standard syntax table from Fundamental mode (*note Syntax Tables:
469 (lispref)Syntax Tables.), but with the `*' changed so that it is a word
472 The date patterns in the list must be _mutually exclusive_ and must
473 not match any portion of the diary entry itself, just the date and one
474 character of whitespace. If, to be mutually exclusive, the pattern
475 must match a portion of the diary entry text--beyond the whitespace
476 that ends the date--then the first element of the date pattern _must_
477 be `backup'. This causes the date recognizer to back up to the
478 beginning of the current word of the diary entry, after finishing the
479 match. Even if you use `backup', the date pattern must absolutely not
480 match more than a portion of the first word of the diary entry. The
481 default value of `diary-date-forms' in the European style is this list:
483 ((day "/" month "[^/0-9]")
484 (day "/" month "/" year "[^0-9]")
485 (backup day " *" monthname "\\W+\\<[^*0-9]")
486 (day " *" monthname " *" year "[^0-9]")
489 Notice the use of `backup' in the third pattern, because it needs to
490 match part of a word beyond the date itself to distinguish it from the
494 File: xemacs.info, Node: Hebrew/Islamic Entries, Next: Fancy Diary Display, Prev: Diary Customizing, Up: Calendar Customization
496 Hebrew- and Islamic-Date Diary Entries
497 ......................................
499 Your diary file can have entries based on Hebrew or Islamic dates, as
500 well as entries based on the world-standard Gregorian calendar.
501 However, because recognition of such entries is time-consuming and most
502 people don't use them, you must explicitly enable their use. If you
503 want the diary to recognize Hebrew-date diary entries, for example, you
506 (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
507 (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
509 If you want Islamic-date entries, do this:
511 (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
512 (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
514 Hebrew- and Islamic-date diary entries have the same formats as
515 Gregorian-date diary entries, except that `H' precedes a Hebrew date
516 and `I' precedes an Islamic date. Moreover, because the Hebrew and
517 Islamic month names are not uniquely specified by the first three
518 letters, you may not abbreviate them. For example, a diary entry for
519 the Hebrew date Heshvan 25 could look like this:
521 HHeshvan 25 Happy Hebrew birthday!
523 and would appear in the diary for any date that corresponds to Heshvan
524 25 on the Hebrew calendar. And here is Islamic-date diary entry that
525 matches Dhu al-Qada 25:
527 IDhu al-Qada 25 Happy Islamic birthday!
529 and would appear in the diary for any date that corresponds to Dhu
530 al-Qada 25 on the Islamic calendar.
532 As with Gregorian-date diary entries, Hebrew- and Islamic-date
533 entries are nonmarking if they are preceded with an ampersand (`&').
535 Here is a table of commands used in the calendar to create diary
536 entries that match the selected date and other dates that are similar
537 in the Hebrew or Islamic calendar:
540 Add a diary entry for the Hebrew date corresponding to the
541 selected date (`insert-hebrew-diary-entry').
544 Add a diary entry for the day of the Hebrew month corresponding to
545 the selected date (`insert-monthly-hebrew-diary-entry'). This
546 diary entry matches any date that has the same Hebrew
547 day-within-month as the selected date.
550 Add a diary entry for the day of the Hebrew year corresponding to
551 the selected date (`insert-yearly-hebrew-diary-entry'). This diary
552 entry matches any date which has the same Hebrew month and
553 day-within-month as the selected date.
556 Add a diary entry for the Islamic date corresponding to the
557 selected date (`insert-islamic-diary-entry').
560 Add a diary entry for the day of the Islamic month corresponding
561 to the selected date (`insert-monthly-islamic-diary-entry').
564 Add a diary entry for the day of the Islamic year corresponding to
565 the selected date (`insert-yearly-islamic-diary-entry').
567 These commands work much like the corresponding commands for ordinary
568 diary entries: they apply to the date that point is on in the calendar
569 window, and what they do is insert just the date portion of a diary
570 entry at the end of your diary file. You must then insert the rest of
574 File: xemacs.info, Node: Fancy Diary Display, Next: Included Diary Files, Prev: Hebrew/Islamic Entries, Up: Calendar Customization
579 Diary display works by preparing the diary buffer and then running
580 the hook `diary-display-hook'. The default value of this hook
581 (`simple-diary-display') hides the irrelevant diary entries and then
582 displays the buffer. However, if you specify the hook as follows,
584 (add-hook 'diary-display-hook 'fancy-diary-display)
586 this enables fancy diary display. It displays diary entries and
587 holidays by copying them into a special buffer that exists only for the
588 sake of display. Copying to a separate buffer provides an opportunity
589 to change the displayed text to make it prettier--for example, to sort
590 the entries by the dates they apply to.
592 As with simple diary display, you can print a hard copy of the buffer
593 with `print-diary-entries'. To print a hard copy of a day-by-day diary
594 for a week by positioning point on Sunday of that week, type `7 d' and
595 then do `M-x print-diary-entries'. As usual, the inclusion of the
596 holidays slows down the display slightly; you can speed things up by
597 setting the variable `holidays-in-diary-buffer' to `nil'.
599 Ordinarily, the fancy diary buffer does not show days for which
600 there are no diary entries, even if that day is a holiday. If you want
601 such days to be shown in the fancy diary buffer, set the variable
602 `diary-list-include-blanks' to `t'.
604 If you use the fancy diary display, you can use the normal hook
605 `list-diary-entries-hook' to sort each day's diary entries by their
606 time of day. Add this line to your `.emacs' file:
608 (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
610 For each day, this sorts diary entries that begin with a recognizable
611 time of day according to their times. Diary entries without times come
612 first within each day.
615 File: xemacs.info, Node: Included Diary Files, Next: Sexp Diary Entries, Prev: Fancy Diary Display, Up: Calendar Customization
620 Fancy diary display also has the ability to process included diary
621 files. This permits a group of people to share a diary file for events
622 that apply to all of them. Lines in the diary file of this form:
626 includes the diary entries from the file FILENAME in the fancy diary
627 buffer. The include mechanism is recursive, so that included files can
628 include other files, and so on; you must be careful not to have a cycle
629 of inclusions, of course. Here is how to enable the include facility:
631 (add-hook 'list-diary-entries-hook 'include-other-diary-files)
632 (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
634 The include mechanism works only with the fancy diary display,
635 because ordinary diary display shows the entries directly from your
639 File: xemacs.info, Node: Sexp Diary Entries, Next: Appt Customizing, Prev: Included Diary Files, Up: Calendar Customization
641 Sexp Entries and the Fancy Diary Display
642 ........................................
644 Sexp diary entries allow you to do more than just have complicated
645 conditions under which a diary entry applies. If you use the fancy
646 diary display, sexp entries can generate the text of the entry depending
647 on the date itself. For example, an anniversary diary entry can insert
648 the number of years since the anniversary date into the text of the
649 diary entry. Thus the `%d' in this dairy entry:
651 %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
653 gets replaced by the age, so on October 31, 1990 the entry appears in
654 the fancy diary buffer like this:
656 Arthur's birthday (42 years old)
658 If the diary file instead contains this entry:
660 %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
662 the entry in the fancy diary buffer for October 31, 1990 appears like
665 Arthur's 42nd birthday
667 Similarly, cyclic diary entries can interpolate the number of
668 repetitions that have occurred:
670 %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
674 Renew medication (5th time)
676 in the fancy diary display on September 8, 1990.
678 The generality of sexp diary entries lets you specify any diary entry
679 that you can describe algorithmically. A sexp diary entry contains an
680 expression that computes whether the entry applies to any given date.
681 If its value is non-`nil', the entry applies to that date; otherwise,
682 it does not. The expression can use the variable `date' to find the
683 date being considered; its value is a list (MONTH DAY YEAR) that refers
684 to the Gregorian calendar.
686 Suppose you get paid on the 21st of the month if it is a weekday, and
687 on the Friday before if the 21st is on a weekend. Here is how to write
688 a sexp diary entry that matches those dates:
690 &%%(let ((dayname (calendar-day-of-week date))
691 (day (car (cdr date))))
692 (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
693 (and (memq day '(19 20)) (= dayname 5)))
694 ) Pay check deposited
696 applies to just those dates. This example illustrates how the sexp can
697 depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
698 that gives the Gregorian date for which the diary entries are being
699 found. If the value of the expression is `t', the entry applies to
700 that date. If the expression evaluates to `nil', the entry does _not_
703 The following sexp diary entries take advantage of the ability (in
704 the fancy diary display) to concoct diary entries whose text varies
707 `%%(diary-sunrise-sunset)'
708 Make a diary entry for the local times of today's sunrise and
711 `%%(diary-phases-of-moon)'
712 Make a diary entry for the phases (quarters) of the moon.
714 `%%(diary-day-of-year)'
715 Make a diary entry with today's day number in the current year and
716 the number of days remaining in the current year.
719 Make a diary entry with today's equivalent ISO commercial date.
721 `%%(diary-julian-date)'
722 Make a diary entry with today's equivalent date on the Julian
725 `%%(diary-astro-day-number)'
726 Make a diary entry with today's equivalent astronomical (Julian)
729 `%%(diary-hebrew-date)'
730 Make a diary entry with today's equivalent date on the Hebrew
733 `%%(diary-islamic-date)'
734 Make a diary entry with today's equivalent date on the Islamic
737 `%%(diary-french-date)'
738 Make a diary entry with today's equivalent date on the French
739 Revolutionary calendar.
741 `%%(diary-mayan-date)'
742 Make a diary entry with today's equivalent date on the Mayan
745 Thus including the diary entry
747 &%%(diary-hebrew-date)
749 causes every day's diary display to contain the equivalent date on the
750 Hebrew calendar, if you are using the fancy diary display. (With simple
751 diary display, the line `&%%(diary-hebrew-date)' appears in the diary
752 for any date, but does nothing particularly useful.)
754 These functions can be used to construct sexp diary entries based on
755 the Hebrew calendar in certain standard ways:
757 `%%(diary-rosh-hodesh)'
758 Make a diary entry that tells the occurrence and ritual
759 announcement of each new Hebrew month.
762 Make a Saturday diary entry that tells the weekly synagogue
765 `%%(diary-sabbath-candles)'
766 Make a Friday diary entry that tells the _local time_ of Sabbath
770 Make a diary entry that gives the omer count, when appropriate.
772 `%%(diary-yahrzeit MONTH DAY YEAR) NAME'
773 Make a diary entry marking the anniversary of a date of death.
774 The date is the _Gregorian_ (civil) date of death. The diary
775 entry appears on the proper Hebrew calendar anniversary and on the
776 day before. (In the European style, the order of the parameters
777 is changed to DAY, MONTH, YEAR.)
780 File: xemacs.info, Node: Appt Customizing, Prev: Sexp Diary Entries, Up: Calendar Customization
782 Customizing Appointment Reminders
783 .................................
785 You can specify exactly how Emacs reminds you of an appointment, and
786 how far in advance it begins doing so, by setting these variables:
788 `appt-message-warning-time'
789 The time in minutes before an appointment that the reminder
790 begins. The default is 10 minutes.
793 If this is `t' (the default), Emacs rings the terminal bell for
794 appointment reminders.
797 If this is `t' (the default), Emacs displays the appointment
798 message in echo area.
800 `appt-display-mode-line'
801 If this is `t' (the default), Emacs displays the number of minutes
802 to the appointment on the mode line.
805 If this is `t' (the default), Emacs displays the appointment
806 message in another window.
808 `appt-display-duration'
809 The number of seconds an appointment message is displayed. The
810 default is 5 seconds.
813 File: xemacs.info, Node: Sorting, Next: Shell, Prev: Calendar/Diary, Up: Top
818 XEmacs provides several commands for sorting text in a buffer. All
819 operate on the contents of the region (the text between point and the
820 mark). They divide the text of the region into many "sort records",
821 identify a "sort key" for each record, and then reorder the records
822 using the order determined by the sort keys. The records are ordered so
823 that their keys are in alphabetical order, or, for numerical sorting, in
824 numerical order. In alphabetical sorting, all upper-case letters `A'
825 through `Z' come before lower-case `a', in accordance with the ASCII
828 The sort commands differ in how they divide the text into sort
829 records and in which part of each record they use as the sort key.
830 Most of the commands make each line a separate sort record, but some
831 commands use paragraphs or pages as sort records. Most of the sort
832 commands use each entire sort record as its own sort key, but some use
833 only a portion of the record as the sort key.
836 Divide the region into lines and sort by comparing the entire text
837 of a line. A prefix argument means sort in descending order.
839 `M-x sort-paragraphs'
840 Divide the region into paragraphs and sort by comparing the entire
841 text of a paragraph (except for leading blank lines). A prefix
842 argument means sort in descending order.
845 Divide the region into pages and sort by comparing the entire text
846 of a page (except for leading blank lines). A prefix argument
847 means sort in descending order.
850 Divide the region into lines and sort by comparing the contents of
851 one field in each line. Fields are defined as separated by
852 whitespace, so the first run of consecutive non-whitespace
853 characters in a line constitutes field 1, the second such run
854 constitutes field 2, etc.
856 You specify which field to sort by with a numeric argument: 1 to
857 sort by field 1, etc. A negative argument means sort in descending
858 order. Thus, minus 2 means sort by field 2 in reverse-alphabetical
861 `M-x sort-numeric-fields'
862 Like `M-x sort-fields', except the specified field is converted to
863 a number for each line and the numbers are compared. `10' comes
864 before `2' when considered as text, but after it when considered
868 Like `M-x sort-fields', except that the text within each line used
869 for comparison comes from a fixed range of columns. An explanation
872 For example, if the buffer contains:
874 On systems where clash detection (locking of files being edited) is
875 implemented, XEmacs also checks the first time you modify a buffer
876 whether the file has changed on disk since it was last visited or
877 saved. If it has, you are asked to confirm that you want to change
880 then if you apply `M-x sort-lines' to the entire buffer you get:
882 On systems where clash detection (locking of files being edited) is
883 implemented, XEmacs also checks the first time you modify a buffer
884 saved. If it has, you are asked to confirm that you want to change
886 whether the file has changed on disk since it was last visited or
888 where the upper case `O' comes before all lower case letters. If you
889 apply instead `C-u 2 M-x sort-fields' you get:
891 saved. If it has, you are asked to confirm that you want to change
892 implemented, XEmacs also checks the first time you modify a buffer
894 On systems where clash detection (locking of files being edited) is
895 whether the file has changed on disk since it was last visited or
897 where the sort keys were `If', `XEmacs', `buffer', `systems', and `the'.
899 `M-x sort-columns' requires more explanation. You specify the
900 columns by putting point at one of the columns and the mark at the other
901 column. Because this means you cannot put point or the mark at the
902 beginning of the first line to sort, this command uses an unusual
903 definition of `region': all of the line point is in is considered part
904 of the region, and so is all of the line the mark is in.
906 For example, to sort a table by information found in columns 10 to
907 15, you could put the mark on column 10 in the first line of the table,
908 and point on column 15 in the last line of the table, and then use this
909 command. Or you could put the mark on column 15 in the first line and
910 point on column 10 in the last line.
912 This can be thought of as sorting the rectangle specified by point
913 and the mark, except that the text on each line to the left or right of
914 the rectangle moves along with the text inside the rectangle. *Note
918 File: xemacs.info, Node: Shell, Next: Narrowing, Prev: Sorting, Up: Top
920 Running Shell Commands from XEmacs
921 ==================================
923 XEmacs has commands for passing single command lines to inferior
924 shell processes; it can also run a shell interactively with input and
925 output to an XEmacs buffer `*shell*'.
928 Run a specified shell command line and display the output
932 Run a specified shell command line with region contents as input;
933 optionally replace the region with the output
934 (`shell-command-on-region').
937 Run a subshell with input and output through an XEmacs buffer.
938 You can then give commands interactively.
941 Run a subshell with input and output through an XEmacs buffer.
942 You can then give commands interactively. Full terminal emulation
947 * Single Shell:: How to run one shell command and return.
948 * Interactive Shell:: Permanent shell taking input via XEmacs.
949 * Shell Mode:: Special XEmacs commands used with permanent shell.
950 * Terminal emulator:: An XEmacs window as a terminal emulator.
951 * Term Mode:: Special XEmacs commands used in Term mode.
952 * Paging in Term:: Paging in the terminal emulator.
955 File: xemacs.info, Node: Single Shell, Next: Interactive Shell, Prev: Shell, Up: Shell
957 Single Shell Commands
958 ---------------------
960 `M-!' (`shell-command') reads a line of text using the minibuffer
961 and creates an inferior shell to execute the line as a command.
962 Standard input from the command comes from the null device. If the
963 shell command produces any output, the output goes to an XEmacs buffer
964 named `*Shell Command Output*', which is displayed in another window
965 but not selected. A numeric argument, as in `M-1 M-!', directs this
966 command to insert any output into the current buffer. In that case,
967 point is left before the output and the mark is set after the output.
969 `M-|' (`shell-command-on-region') is like `M-!' but passes the
970 contents of the region as input to the shell command, instead of no
971 input. If a numeric argument is used to direct output to the current
972 buffer, then the old region is deleted first and the output replaces it
973 as the contents of the region.
975 Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
976 use. This variable is initialized based on your `SHELL' environment
977 variable when you start XEmacs. If the file name does not specify a
978 directory, the directories in the list `exec-path' are searched; this
979 list is initialized based on the `PATH' environment variable when you
980 start XEmacs. You can override either or both of these default
981 initializations in your `.emacs' file.
983 When you use `M-!' and `M-|', XEmacs has to wait until the shell
984 command completes. You can quit with `C-g'; that terminates the shell
988 File: xemacs.info, Node: Interactive Shell, Next: Shell Mode, Prev: Single Shell, Up: Shell
990 Interactive Inferior Shell
991 --------------------------
993 To run a subshell interactively with its typescript in an XEmacs
994 buffer, use `M-x shell'. This creates (or reuses) a buffer named
995 `*shell*' and runs a subshell with input coming from and output going
996 to that buffer. That is to say, any "terminal output" from the subshell
997 will go into the buffer, advancing point, and any "terminal input" for
998 the subshell comes from text in the buffer. To give input to the
999 subshell, go to the end of the buffer and type the input, terminated by
1002 XEmacs does not wait for the subshell to do anything. You can switch
1003 windows or buffers and edit them while the shell is waiting, or while
1004 it is running a command. Output from the subshell waits until XEmacs
1005 has time to process it; this happens whenever XEmacs is waiting for
1006 keyboard input or for time to elapse.
1008 To get multiple subshells, change the name of buffer `*shell*' to
1009 something different by using `M-x rename-buffer'. The next use of `M-x
1010 shell' creates a new buffer `*shell*' with its own subshell. By
1011 renaming this buffer as well you can create a third one, and so on.
1012 All the subshells run independently and in parallel.
1014 The file name used to load the subshell is the value of the variable
1015 `explicit-shell-file-name', if that is non-`nil'. Otherwise, the
1016 environment variable `ESHELL' is used, or the environment variable
1017 `SHELL' if there is no `ESHELL'. If the file name specified is
1018 relative, the directories in the list `exec-path' are searched (*note
1019 Single Shell Commands: Single Shell.).
1021 As soon as the subshell is started, it is sent as input the contents
1022 of the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME
1023 is the name of the file that the shell was loaded from. For example,
1024 if you use `csh', the file sent to it is `~/.emacs_csh'.
1026 `cd', `pushd', and `popd' commands given to the inferior shell are
1027 watched by XEmacs so it can keep the `*shell*' buffer's default
1028 directory the same as the shell's working directory. These commands
1029 are recognized syntactically by examining lines of input that are sent.
1030 If you use aliases for these commands, you can tell XEmacs to
1031 recognize them also. For example, if the value of the variable
1032 `shell-pushd-regexp' matches the beginning of a shell command line,
1033 that line is regarded as a `pushd' command. Change this variable when
1034 you add aliases for `pushd'. Likewise, `shell-popd-regexp' and
1035 `shell-cd-regexp' are used to recognize commands with the meaning of
1038 `M-x shell-resync-dirs' queries the shell and resynchronizes XEmacs'
1039 idea of what the current directory stack is. `M-x
1040 shell-dirtrack-toggle' turns directory tracking on and off.
1042 XEmacs keeps a history of the most recent commands you have typed in
1043 the `*shell*' buffer. If you are at the beginning of a shell command
1044 line and type <M-p>, the previous shell input is inserted into the
1045 buffer before point. Immediately typing <M-p> again deletes that input
1046 and inserts the one before it. By repeating <M-p> you can move
1047 backward through your commands until you find one you want to repeat.
1048 You may then edit the command before typing <RET> if you wish. <M-n>
1049 moves forward through the command history, in case you moved backward
1050 past the one you wanted while using <M-p>. If you type the first few
1051 characters of a previous command and then type <M-p>, the most recent
1052 shell input starting with those characters is inserted. This can be
1053 very convenient when you are repeating a sequence of shell commands.
1054 The variable `input-ring-size' controls how many commands are saved in
1055 your input history. The default is 30.
1058 File: xemacs.info, Node: Shell Mode, Next: Terminal emulator, Prev: Interactive Shell, Up: Shell
1063 The shell buffer uses Shell mode, which defines several special keys
1064 attached to the `C-c' prefix. They are chosen to resemble the usual
1065 editing and job control characters present in shells that are not under
1066 XEmacs, except that you must type `C-c' first. Here is a list of the
1067 special key bindings of Shell mode:
1070 At end of buffer send line as input; otherwise, copy current line
1071 to end of buffer and send it (`send-shell-input'). When a line is
1072 copied, any text at the beginning of the line that matches the
1073 variable `shell-prompt-pattern' is left out; this variable's value
1074 should be a regexp string that matches the prompts that you use in
1078 Send end-of-file as input, probably causing the shell or its
1079 current subjob to finish (`shell-send-eof').
1082 If point is not at the end of the buffer, delete the next
1083 character just like most other modes. If point is at the end of
1084 the buffer, send end-of-file as input, instead of generating an
1085 error as in other modes (`comint-delchar-or-maybe-eof').
1088 Kill all text that has yet to be sent as input
1089 (`kill-shell-input').
1092 Kill a word before point (`backward-kill-word').
1095 Interrupt the shell or its current subjob if any
1096 (`interrupt-shell-subjob').
1099 Stop the shell or its current subjob if any (`stop-shell-subjob').
1102 Send quit signal to the shell or its current subjob if any
1103 (`quit-shell-subjob').
1106 Delete last batch of output from shell (`kill-output-from-shell').
1109 Scroll top of last batch of output to top of window
1110 (`show-output-from-shell').
1113 Copy the previous bunch of shell input and insert it into the
1114 buffer before point (`copy-last-shell-input'). No final newline
1115 is inserted, and the input copied is not resubmitted until you type
1119 Move backward through the input history. Search for a matching
1120 command if you have typed the beginning of a command
1121 (`comint-previous-input').
1124 Move forward through the input history. Useful when you are using
1125 <M-p> quickly and go past the desired command
1126 (`comint-next-input').
1129 Complete the file name preceding point (`comint-dynamic-complete').
1132 File: xemacs.info, Node: Terminal emulator, Next: Term Mode, Prev: Shell Mode, Up: Shell
1134 Interactive Inferior Shell with Terminal Emulator
1135 -------------------------------------------------
1137 To run a subshell in a terminal emulator, putting its typescript in
1138 an XEmacs buffer, use `M-x term'. This creates (or reuses) a buffer
1139 named `*term*' and runs a subshell with input coming from your keyboard
1140 and output going to that buffer.
1142 All the normal keys that you type are sent without any interpretation
1143 by XEmacs directly to the subshell, as "terminal input." Any "echo" of
1144 your input is the responsibility of the subshell. (The exception is
1145 the terminal escape character, which by default is `C-c'. *note Term
1146 Mode::.) Any "terminal output" from the subshell goes into the buffer,
1149 Some programs (such as XEmacs itself) need to control the appearance
1150 on the terminal screen in detail. They do this by sending special
1151 control codes. The exact control codes needed vary from terminal to
1152 terminal, but nowadays most terminals and terminal emulators (including
1153 xterm) understand the so-called "ANSI escape sequences" (first
1154 popularized by the Digital's VT100 family of terminal). The term mode
1155 also understands these escape sequences, and for each control code does
1156 the appropriate thing to change the buffer so that the appearance of
1157 the window will match what it would be on a real terminal. Thus you
1158 can actually run XEmacs inside an XEmacs Term window!
1160 XEmacs does not wait for the subshell to do anything. You can switch
1161 windows or buffers and edit them while the shell is waiting, or while
1162 it is running a command. Output from the subshell waits until XEmacs
1163 has time to process it; this happens whenever XEmacs is waiting for
1164 keyboard input or for time to elapse.
1166 To make multiple terminal emulators, rename the buffer `*term*' to
1167 something different using `M-x rename-uniquely', just as with Shell
1170 The file name used to load the subshell is determined the same way
1173 Unlike Shell mode, Term mode does not track the current directory by
1174 examining your input. Instead, if you use a programmable shell, you
1175 can have it tell Term what the current directory is. This is done
1176 automatically by bash for version 1.15 and later.
1179 File: xemacs.info, Node: Term Mode, Next: Paging in Term, Prev: Terminal emulator, Up: Shell
1184 Term uses Term mode, which has two input modes: In line mode, Term
1185 basically acts like Shell mode. *Note Shell Mode::. In Char mode,
1186 each character is sent directly to the inferior subshell, except for
1187 the Term escape character, normally `C-c'.
1189 To switch between line and char mode, use these commands:
1190 findex term-char-mode
1193 Switch to line mode. Do nothing if already in line mode.
1196 Switch to char mode. Do nothing if already in char mode.
1198 The following commands are only available in Char mode:
1200 Send a literal <C-c> to the sub-shell.
1203 A prefix command to conveniently access the global <C-x> commands.
1204 For example, `C-c C-x o' invokes the global binding of `C-x o',
1205 which is normally `other-window'.