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