4b02aadc988523e1a711c9165b36d2f954c7067e
[chise/xemacs-chise.git-] / info / xemacs.info-16
1 This is ../info/xemacs.info, produced by makeinfo version 4.0 from
2 xemacs/xemacs.texi.
3
4 INFO-DIR-SECTION XEmacs Editor
5 START-INFO-DIR-ENTRY
6 * XEmacs: (xemacs).             XEmacs Editor.
7 END-INFO-DIR-ENTRY
8
9    This file documents the XEmacs editor.
10
11    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
12 1991, 1992, 1993, 1994 Lucid, Inc.  Copyright (C) 1993, 1994 Sun
13 Microsystems, Inc.  Copyright (C) 1995 Amdahl Corporation.
14
15    Permission is granted to make and distribute verbatim copies of this
16 manual provided the copyright notice and this permission notice are
17 preserved on all copies.
18
19    Permission is granted to copy and distribute modified versions of
20 this manual under the conditions for verbatim copying, provided also
21 that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
22 General Public License" are included exactly as in the original, and
23 provided that the entire resulting derived work is distributed under the
24 terms of a permission notice identical to this one.
25
26    Permission is granted to copy and distribute translations of this
27 manual into another language, under the above conditions for modified
28 versions, except that the sections entitled "The GNU Manifesto",
29 "Distribution" and "GNU General Public License" may be included in a
30 translation approved by the author instead of in the original English.
31
32 \1f
33 File: xemacs.info,  Node: Diary Customizing,  Next: Hebrew/Islamic Entries,  Prev: Daylight Savings,  Up: Calendar Customization
34
35 Customizing the Diary
36 .....................
37
38    Ordinarily, the mode line of the diary buffer window indicates any
39 holidays that fall on the date of the diary entries.  The process of
40 checking for holidays can take several seconds, so including holiday
41 information delays the display of the diary buffer noticeably.  If you'd
42 prefer to have a faster display of the diary buffer but without the
43 holiday information, set the variable `holidays-in-diary-buffer' to
44 `nil'.
45
46    The variable `number-of-diary-entries' controls the number of days
47 of diary entries to be displayed at one time.  It affects the initial
48 display when `view-diary-entries-initially' is `t', as well as the
49 command `M-x diary'.  For example, the default value is 1, which says
50 to display only the current day's diary entries.  If the value is 2,
51 both the current day's and the next day's entries are displayed.  The
52 value can also be a vector of seven elements: for example, if the value
53 is `[0 2 2 2 2 4 1]' then no diary entries appear on Sunday, the
54 current date's and the next day's diary entries appear Monday through
55 Thursday, Friday through Monday's entries appear on Friday, while on
56 Saturday only that day's entries appear.
57
58    The variable `print-diary-entries-hook' is a normal hook run after
59 preparation of a temporary buffer containing just the diary entries
60 currently visible in the diary buffer.  (The other, irrelevant diary
61 entries are really absent from the temporary buffer; in the diary
62 buffer, they are merely hidden.)  The default value of this hook does
63 the printing with the command `lpr-buffer'.  If you want to use a
64 different command to do the printing, just change the value of this
65 hook.  Other uses might include, for example, rearranging the lines into
66 order by day and time.
67
68    You can customize the form of dates in your diary file, if neither
69 the standard American nor European styles suits your needs, by setting
70 the variable `diary-date-forms'.  This variable is a list of patterns
71 for recognizing a date.  Each date pattern is a list whose elements may
72 be regular expressions (*note Regexps::) or the symbols `month', `day',
73 `year', `monthname', and `dayname'.  All these elements serve as
74 patterns that match certain kinds of text in the diary file.  In order
75 for the date pattern, as a whole, to match, all of its elements must
76 match consecutively.
77
78    A regular expression in a date pattern matches in its usual fashion,
79 using the standard syntax table altered so that `*' is a word
80 constituent.
81
82    The symbols `month', `day', `year', `monthname', and `dayname' match
83 the month number, day number, year number, month name, and day name of
84 the date being considered.  The symbols that match numbers allow
85 leading zeros; those that match names allow three-letter abbreviations
86 and capitalization.  All the symbols can match `*'; since `*' in a
87 diary entry means "any day", "any month", and so on, it should match
88 regardless of the date being considered.
89
90    The default value of `diary-date-forms' in the American style is
91 this:
92
93      ((month "/" day "[^/0-9]")
94       (month "/" day "/" year "[^0-9]")
95       (monthname " *" day "[^,0-9]")
96       (monthname " *" day ", *" year "[^0-9]")
97       (dayname "\\W"))
98
99 Emacs matches of the diary entries with the date forms is done with the
100 standard syntax table from Fundamental mode (*note Syntax Tables:
101 (lispref)Syntax Tables.), but with the `*' changed so that it is a word
102 constituent.
103
104    The date patterns in the list must be _mutually exclusive_ and must
105 not match any portion of the diary entry itself, just the date and one
106 character of whitespace.  If, to be mutually exclusive, the pattern
107 must match a portion of the diary entry text--beyond the whitespace
108 that ends the date--then the first element of the date pattern _must_
109 be `backup'.  This causes the date recognizer to back up to the
110 beginning of the current word of the diary entry, after finishing the
111 match.  Even if you use `backup', the date pattern must absolutely not
112 match more than a portion of the first word of the diary entry.  The
113 default value of `diary-date-forms' in the European style is this list:
114
115      ((day "/" month "[^/0-9]")
116       (day "/" month "/" year "[^0-9]")
117       (backup day " *" monthname "\\W+\\<[^*0-9]")
118       (day " *" monthname " *" year "[^0-9]")
119       (dayname "\\W"))
120
121 Notice the use of `backup' in the third pattern, because it needs to
122 match part of a word beyond the date itself to distinguish it from the
123 fourth pattern.
124
125 \1f
126 File: xemacs.info,  Node: Hebrew/Islamic Entries,  Next: Fancy Diary Display,  Prev: Diary Customizing,  Up: Calendar Customization
127
128 Hebrew- and Islamic-Date Diary Entries
129 ......................................
130
131    Your diary file can have entries based on Hebrew or Islamic dates, as
132 well as entries based on the world-standard Gregorian calendar.
133 However, because recognition of such entries is time-consuming and most
134 people don't use them, you must explicitly enable their use.  If you
135 want the diary to recognize Hebrew-date diary entries, for example, you
136 must do this:
137
138      (add-hook 'nongregorian-diary-listing-hook 'list-hebrew-diary-entries)
139      (add-hook 'nongregorian-diary-marking-hook 'mark-hebrew-diary-entries)
140
141 If you want Islamic-date entries, do this:
142
143      (add-hook 'nongregorian-diary-listing-hook 'list-islamic-diary-entries)
144      (add-hook 'nongregorian-diary-marking-hook 'mark-islamic-diary-entries)
145
146    Hebrew- and Islamic-date diary entries have the same formats as
147 Gregorian-date diary entries, except that `H' precedes a Hebrew date
148 and `I' precedes an Islamic date.  Moreover, because the Hebrew and
149 Islamic month names are not uniquely specified by the first three
150 letters, you may not abbreviate them.  For example, a diary entry for
151 the Hebrew date Heshvan 25 could look like this:
152
153      HHeshvan 25 Happy Hebrew birthday!
154
155 and would appear in the diary for any date that corresponds to Heshvan
156 25 on the Hebrew calendar.  And here is  Islamic-date diary entry  that
157 matches Dhu al-Qada 25:
158
159      IDhu al-Qada 25 Happy Islamic birthday!
160
161 and would appear in the diary for any date that corresponds to Dhu
162 al-Qada 25 on the Islamic calendar.
163
164    As with Gregorian-date diary entries, Hebrew- and Islamic-date
165 entries are nonmarking if they are preceded with an ampersand (`&').
166
167    Here is a table of commands used in the calendar to create diary
168 entries that match the selected date and other dates that are similar
169 in the Hebrew or Islamic calendar:
170
171 `i h d'
172      Add a diary entry for the Hebrew date corresponding to the
173      selected date (`insert-hebrew-diary-entry').
174
175 `i h m'
176      Add a diary entry for the day of the Hebrew month corresponding to
177      the selected date (`insert-monthly-hebrew-diary-entry').  This
178      diary entry matches any date that has the same Hebrew
179      day-within-month as the selected date.
180
181 `i h y'
182      Add a diary entry for the day of the Hebrew year corresponding to
183      the selected date (`insert-yearly-hebrew-diary-entry').  This diary
184      entry matches any date which has the same Hebrew month and
185      day-within-month as the selected date.
186
187 `i i d'
188      Add a diary entry for the Islamic date corresponding to the
189      selected date (`insert-islamic-diary-entry').
190
191 `i i m'
192      Add a diary entry for the day of the Islamic month corresponding
193      to the selected date (`insert-monthly-islamic-diary-entry').
194
195 `i i y'
196      Add a diary entry for the day of the Islamic year corresponding to
197      the selected date (`insert-yearly-islamic-diary-entry').
198
199    These commands work much like the corresponding commands for ordinary
200 diary entries: they apply to the date that point is on in the calendar
201 window, and what they do is insert just the date portion of a diary
202 entry at the end of your diary file.  You must then insert the rest of
203 the diary entry.
204
205 \1f
206 File: xemacs.info,  Node: Fancy Diary Display,  Next: Included Diary Files,  Prev: Hebrew/Islamic Entries,  Up: Calendar Customization
207
208 Fancy Diary Display
209 ...................
210
211    Diary display works by preparing the diary buffer and then running
212 the hook `diary-display-hook'.  The default value of this hook
213 (`simple-diary-display') hides the irrelevant diary entries and then
214 displays the buffer.  However, if you specify the hook as follows,
215
216      (add-hook 'diary-display-hook 'fancy-diary-display)
217
218 this enables fancy diary display.  It displays diary entries and
219 holidays by copying them into a special buffer that exists only for the
220 sake of display.  Copying to a separate buffer provides an opportunity
221 to change the displayed text to make it prettier--for example, to sort
222 the entries by the dates they apply to.
223
224    As with simple diary display, you can print a hard copy of the buffer
225 with `print-diary-entries'.  To print a hard copy of a day-by-day diary
226 for a week by positioning point on Sunday of that week, type `7 d' and
227 then do `M-x print-diary-entries'.  As usual, the inclusion of the
228 holidays slows down the display slightly; you can speed things up by
229 setting the variable `holidays-in-diary-buffer' to `nil'.
230
231    Ordinarily, the fancy diary buffer does not show days for which
232 there are no diary entries, even if that day is a holiday.  If you want
233 such days to be shown in the fancy diary buffer, set the variable
234 `diary-list-include-blanks' to `t'.
235
236    If you use the fancy diary display, you can use the normal hook
237 `list-diary-entries-hook' to sort each day's diary entries by their
238 time of day.  Add this line to your init file:
239
240      (add-hook 'list-diary-entries-hook 'sort-diary-entries t)
241
242    *Note Init File::.
243
244 For each day, this sorts diary entries that begin with a recognizable
245 time of day according to their times.  Diary entries without times come
246 first within each day.
247
248 \1f
249 File: xemacs.info,  Node: Included Diary Files,  Next: Sexp Diary Entries,  Prev: Fancy Diary Display,  Up: Calendar Customization
250
251 Included Diary Files
252 ....................
253
254    Fancy diary display also has the ability to process included diary
255 files.  This permits a group of people to share a diary file for events
256 that apply to all of them.  Lines in the diary file of this form:
257
258      #include "FILENAME"
259
260 includes the diary entries from the file FILENAME in the fancy diary
261 buffer.  The include mechanism is recursive, so that included files can
262 include other files, and so on; you must be careful not to have a cycle
263 of inclusions, of course.  Here is how to enable the include facility:
264
265      (add-hook 'list-diary-entries-hook 'include-other-diary-files)
266      (add-hook 'mark-diary-entries-hook 'mark-included-diary-files)
267
268    The include mechanism works only with the fancy diary display,
269 because ordinary diary display shows the entries directly from your
270 diary file.
271
272 \1f
273 File: xemacs.info,  Node: Sexp Diary Entries,  Next: Appt Customizing,  Prev: Included Diary Files,  Up: Calendar Customization
274
275 Sexp Entries and the Fancy Diary Display
276 ........................................
277
278    Sexp diary entries allow you to do more than just have complicated
279 conditions under which a diary entry applies.  If you use the fancy
280 diary display, sexp entries can generate the text of the entry depending
281 on the date itself.  For example, an anniversary diary entry can insert
282 the number of years since the anniversary date into the text of the
283 diary entry.  Thus the `%d' in this dairy entry:
284
285      %%(diary-anniversary 10 31 1948) Arthur's birthday (%d years old)
286
287 gets replaced by the age, so on October 31, 1990 the entry appears in
288 the fancy diary buffer like this:
289
290      Arthur's birthday (42 years old)
291
292 If the diary file instead contains this entry:
293
294      %%(diary-anniversary 10 31 1948) Arthur's %d%s birthday
295
296 the entry in the fancy diary buffer for October 31, 1990 appears like
297 this:
298
299      Arthur's 42nd birthday
300
301    Similarly, cyclic diary entries can interpolate the number of
302 repetitions that have occurred:
303
304      %%(diary-cyclic 50 1 1 1990) Renew medication (%d%s time)
305
306 looks like this:
307
308      Renew medication (5th time)
309
310 in the fancy diary display on September 8, 1990.
311
312    The generality of sexp diary entries lets you specify any diary entry
313 that you can describe algorithmically.  A sexp diary entry contains an
314 expression that computes whether the entry applies to any given date.
315 If its value is non-`nil', the entry applies to that date; otherwise,
316 it does not.  The expression can use the variable  `date' to find the
317 date being considered; its value is a list (MONTH DAY YEAR) that refers
318 to the Gregorian calendar.
319
320    Suppose you get paid on the 21st of the month if it is a weekday, and
321 on the Friday before if the 21st is on a weekend.  Here is how to write
322 a sexp diary entry that matches those dates:
323
324      &%%(let ((dayname (calendar-day-of-week date))
325               (day (car (cdr date))))
326            (or (and (= day 21) (memq dayname '(1 2 3 4 5)))
327                (and (memq day '(19 20)) (= dayname 5)))
328               ) Pay check deposited
329
330 applies to just those dates.  This example illustrates how the sexp can
331 depend on the variable `date'; this variable is a list (MONTH DAY YEAR)
332 that gives the Gregorian date for which the diary entries are being
333 found.  If the value of the expression is `t', the entry applies to
334 that date.  If the expression evaluates to `nil', the entry does _not_
335 apply to that date.
336
337    The following sexp diary entries take advantage of the ability (in
338 the fancy diary display) to concoct diary entries whose text varies
339 based on the date:
340
341 `%%(diary-sunrise-sunset)'
342      Make a diary entry for the local times of today's sunrise and
343      sunset.
344
345 `%%(diary-phases-of-moon)'
346      Make a diary entry for the phases (quarters) of the moon.
347
348 `%%(diary-day-of-year)'
349      Make a diary entry with today's day number in the current year and
350      the number of days remaining in the current year.
351
352 `%%(diary-iso-date)'
353      Make a diary entry with today's equivalent ISO commercial date.
354
355 `%%(diary-julian-date)'
356      Make a diary entry with today's equivalent date on the Julian
357      calendar.
358
359 `%%(diary-astro-day-number)'
360      Make a diary entry with today's equivalent astronomical (Julian)
361      day number.
362
363 `%%(diary-hebrew-date)'
364      Make a diary entry with today's equivalent date on the Hebrew
365      calendar.
366
367 `%%(diary-islamic-date)'
368      Make a diary entry with today's equivalent date on the Islamic
369      calendar.
370
371 `%%(diary-french-date)'
372      Make a diary entry with today's equivalent date on the French
373      Revolutionary calendar.
374
375 `%%(diary-mayan-date)'
376      Make a diary entry with today's equivalent date on the Mayan
377      calendar.
378
379 Thus including the diary entry
380
381      &%%(diary-hebrew-date)
382
383 causes every day's diary display to contain the equivalent date on the
384 Hebrew calendar, if you are using the fancy diary display.  (With simple
385 diary display, the line `&%%(diary-hebrew-date)' appears in the diary
386 for any date, but does nothing particularly useful.)
387
388    These functions can be used to construct sexp diary entries based on
389 the Hebrew calendar in certain standard ways:
390
391 `%%(diary-rosh-hodesh)'
392      Make a diary entry that tells the occurrence and ritual
393      announcement of each new Hebrew month.
394
395 `%%(diary-parasha)'
396      Make a Saturday diary entry that tells the weekly synagogue
397      scripture reading.
398
399 `%%(diary-sabbath-candles)'
400      Make a Friday diary entry that tells the _local time_ of Sabbath
401      candle lighting.
402
403 `%%(diary-omer)'
404      Make a diary entry that gives the omer count, when appropriate.
405
406 `%%(diary-yahrzeit MONTH DAY YEAR) NAME'
407      Make a diary entry marking the anniversary of a date of death.
408      The date is the _Gregorian_ (civil) date of death.  The diary
409      entry appears on the proper Hebrew calendar anniversary and on the
410      day before.  (In the European style, the order of the parameters
411      is changed to DAY, MONTH, YEAR.)
412
413 \1f
414 File: xemacs.info,  Node: Appt Customizing,  Prev: Sexp Diary Entries,  Up: Calendar Customization
415
416 Customizing Appointment Reminders
417 .................................
418
419    You can specify exactly how Emacs reminds you of an appointment, and
420 how far in advance it begins doing so, by setting these variables:
421
422 `appt-message-warning-time'
423      The time in minutes before an appointment that the reminder
424      begins.  The default is 10 minutes.
425
426 `appt-audible'
427      If this is `t' (the default), Emacs rings the terminal bell for
428      appointment reminders.
429
430 `appt-visible'
431      If this is `t' (the default), Emacs displays the appointment
432      message in echo area.
433
434 `appt-display-mode-line'
435      If this is `t' (the default), Emacs displays the number of minutes
436      to the appointment on the mode line.
437
438 `appt-msg-window'
439      If this is `t' (the default), Emacs displays the appointment
440      message in another window.
441
442 `appt-display-duration'
443      The number of seconds an appointment message is displayed.  The
444      default is 5 seconds.
445
446 \1f
447 File: xemacs.info,  Node: Sorting,  Next: Shell,  Prev: Calendar/Diary,  Up: Top
448
449 Sorting Text
450 ============
451
452    XEmacs provides several commands for sorting text in a buffer.  All
453 operate on the contents of the region (the text between point and the
454 mark).  They divide the text of the region into many "sort records",
455 identify a "sort key" for each record, and then reorder the records
456 using the order determined by the sort keys.  The records are ordered so
457 that their keys are in alphabetical order, or, for numerical sorting, in
458 numerical order.  In alphabetical sorting, all upper-case letters `A'
459 through `Z' come before lower-case `a', in accordance with the ASCII
460 character sequence.
461
462    The sort commands differ in how they divide the text into sort
463 records and in which part of each record they use as the sort key.
464 Most of the commands make each line a separate sort record, but some
465 commands use paragraphs or pages as sort records.  Most of the sort
466 commands use each entire sort record as its own sort key, but some use
467 only a portion of the record as the sort key.
468
469 `M-x sort-lines'
470      Divide the region into lines and sort by comparing the entire text
471      of a line.  A prefix argument means sort in descending order.
472
473 `M-x sort-paragraphs'
474      Divide the region into paragraphs and sort by comparing the entire
475      text of a paragraph (except for leading blank lines).  A prefix
476      argument means sort in descending order.
477
478 `M-x sort-pages'
479      Divide the region into pages and sort by comparing the entire text
480      of a page (except for leading blank lines).  A prefix argument
481      means sort in descending order.
482
483 `M-x sort-fields'
484      Divide the region into lines and sort by comparing the contents of
485      one field in each line.  Fields are defined as separated by
486      whitespace, so the first run of consecutive non-whitespace
487      characters in a line constitutes field 1, the second such run
488      constitutes field 2, etc.
489
490      You specify which field to sort by with a numeric argument: 1 to
491      sort by field 1, etc.  A negative argument means sort in descending
492      order.  Thus, minus 2 means sort by field 2 in reverse-alphabetical
493      order.
494
495 `M-x sort-numeric-fields'
496      Like `M-x sort-fields', except the specified field is converted to
497      a number for each line and the numbers are compared.  `10' comes
498      before `2' when considered as text, but after it when considered
499      as a number.
500
501 `M-x sort-columns'
502      Like `M-x sort-fields', except that the text within each line used
503      for comparison comes from a fixed range of columns.  An explanation
504      is given below.
505
506    For example, if the buffer contains:
507
508      On systems where clash detection (locking of files being edited) is
509      implemented, XEmacs also checks the first time you modify a buffer
510      whether the file has changed on disk since it was last visited or
511      saved.  If it has, you are asked to confirm that you want to change
512      the buffer.
513
514 then if you apply `M-x sort-lines' to the entire buffer you get:
515
516      On systems where clash detection (locking of files being edited) is
517      implemented, XEmacs also checks the first time you modify a buffer
518      saved.  If it has, you are asked to confirm that you want to change
519      the buffer.
520      whether the file has changed on disk since it was last visited or
521
522 where the upper case `O' comes before all lower case letters.  If you
523 apply instead `C-u 2 M-x sort-fields' you get:
524
525      saved.  If it has, you are asked to confirm that you want to change
526      implemented, XEmacs also checks the first time you modify a buffer
527      the buffer.
528      On systems where clash detection (locking of files being edited) is
529      whether the file has changed on disk since it was last visited or
530
531 where the sort keys were `If', `XEmacs', `buffer', `systems', and `the'.
532
533    `M-x sort-columns' requires more explanation.  You specify the
534 columns by putting point at one of the columns and the mark at the other
535 column.  Because this means you cannot put point or the mark at the
536 beginning of the first line to sort, this command uses an unusual
537 definition of `region': all of the line point is in is considered part
538 of the region, and so is all of the line the mark is in.
539
540    For example, to sort a table by information found in columns 10 to
541 15, you could put the mark on column 10 in the first line of the table,
542 and point on column 15 in the last line of the table, and then use this
543 command.  Or you could put the mark on column 15 in the first line and
544 point on column 10 in the last line.
545
546    This can be thought of as sorting the rectangle specified by point
547 and the mark, except that the text on each line to the left or right of
548 the rectangle moves along with the text inside the rectangle.  *Note
549 Rectangles::.
550
551 \1f
552 File: xemacs.info,  Node: Shell,  Next: Narrowing,  Prev: Sorting,  Up: Top
553
554 Running Shell Commands from XEmacs
555 ==================================
556
557    XEmacs has commands for passing single command lines to inferior
558 shell processes; it can also run a shell interactively with input and
559 output to an XEmacs buffer `*shell*'.
560
561 `M-!'
562      Run a specified shell command line and display the output
563      (`shell-command').
564
565 `M-|'
566      Run a specified shell command line with region contents as input;
567      optionally replace the region with the output
568      (`shell-command-on-region').
569
570 `M-x shell'
571      Run a subshell with input and output through an XEmacs buffer.
572      You can then give commands interactively.
573
574 `M-x term'
575      Run a subshell with input and output through an XEmacs buffer.
576      You can then give commands interactively.  Full terminal emulation
577      is available.
578
579 * Menu:
580
581 * Single Shell::         How to run one shell command and return.
582 * Interactive Shell::    Permanent shell taking input via XEmacs.
583 * Shell Mode::           Special XEmacs commands used with permanent shell.
584 * Terminal emulator::    An XEmacs window as a terminal emulator.
585 * Term Mode::            Special XEmacs commands used in Term mode.
586 * Paging in Term::       Paging in the terminal emulator.
587
588 \1f
589 File: xemacs.info,  Node: Single Shell,  Next: Interactive Shell,  Prev: Shell,  Up: Shell
590
591 Single Shell Commands
592 ---------------------
593
594    `M-!' (`shell-command') reads a line of text using the minibuffer
595 and creates an inferior shell to execute the line as a command.
596 Standard input from the command comes from the null device.  If the
597 shell command produces any output, the output goes to an XEmacs buffer
598 named `*Shell Command Output*', which is displayed in another window
599 but not selected.  A numeric argument, as in `M-1 M-!', directs this
600 command to insert any output into the current buffer.  In that case,
601 point is left before the output and the mark is set after the output.
602
603    `M-|' (`shell-command-on-region') is like `M-!' but passes the
604 contents of the region as input to the shell command, instead of no
605 input.  If a numeric argument is used to direct  output to the current
606 buffer, then the old region is deleted first and the output replaces it
607 as the contents of the region.
608
609    Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
610 use.  This variable is initialized based on your `SHELL' environment
611 variable when you start XEmacs.  If the file name does not specify a
612 directory, the directories in the list `exec-path' are searched; this
613 list is initialized based on the `PATH' environment variable when you
614 start XEmacs.  You can override either or both of these default
615 initializations in your init file. *Note Init File::.
616
617    When you use `M-!' and `M-|', XEmacs has to wait until the shell
618 command completes.  You can quit with `C-g'; that terminates the shell
619 command.
620
621 \1f
622 File: xemacs.info,  Node: Interactive Shell,  Next: Shell Mode,  Prev: Single Shell,  Up: Shell
623
624 Interactive Inferior Shell
625 --------------------------
626
627    To run a subshell interactively with its typescript in an XEmacs
628 buffer, use `M-x shell'.  This creates (or reuses) a buffer named
629 `*shell*' and runs a subshell with input coming from and output going
630 to that buffer.  That is to say, any "terminal output" from the subshell
631 will go into the buffer, advancing point, and any "terminal input" for
632 the subshell comes from text in the buffer.  To give input to the
633 subshell, go to the end of the buffer and type the input, terminated by
634 <RET>.
635
636    XEmacs does not wait for the subshell to do anything.  You can switch
637 windows or buffers and edit them while the shell is waiting, or while
638 it is running a command.  Output from the subshell waits until XEmacs
639 has time to process it; this happens whenever XEmacs is waiting for
640 keyboard input or for time to elapse.
641
642    To get multiple subshells, change the name of buffer `*shell*' to
643 something different by using `M-x rename-buffer'.  The next use of `M-x
644 shell' creates a new buffer `*shell*' with its own subshell.  By
645 renaming this buffer as well you can create a third one, and so on.
646 All the subshells run independently and in parallel.
647
648    The file name used to load the subshell is the value of the variable
649 `explicit-shell-file-name', if that is non-`nil'.  Otherwise, the
650 environment variable `ESHELL' is used, or the environment variable
651 `SHELL' if there is no `ESHELL'.  If the file name specified is
652 relative, the directories in the list `exec-path' are searched (*note
653 Single Shell Commands: Single Shell.).
654
655    As soon as the subshell is started, it is sent as input the contents
656 of the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME
657 is the name of the file that the shell was loaded from.  For example,
658 if you use `csh', the file sent to it is `~/.emacs_csh'.
659
660    `cd', `pushd', and `popd' commands given to the inferior shell are
661 watched by XEmacs so it can keep the `*shell*' buffer's default
662 directory the same as the shell's working directory.  These commands
663 are recognized syntactically by examining lines of input that are sent.
664 If you use aliases for these commands, you can tell XEmacs to
665 recognize them also.  For example, if the value of the variable
666 `shell-pushd-regexp' matches the beginning of a shell command line,
667 that line is regarded as a `pushd' command.  Change this variable when
668 you add aliases for `pushd'.  Likewise, `shell-popd-regexp' and
669 `shell-cd-regexp' are used to recognize commands with the meaning of
670 `popd' and `cd'.
671
672    `M-x shell-resync-dirs' queries the shell and resynchronizes XEmacs'
673 idea of what the current directory stack is.  `M-x
674 shell-dirtrack-toggle' turns directory tracking on and off.
675
676    XEmacs keeps a history of the most recent commands you have typed in
677 the `*shell*' buffer.  If you are at the beginning of a shell command
678 line and type <M-p>, the previous shell input is inserted into the
679 buffer before point.  Immediately typing <M-p> again deletes that input
680 and inserts the one before it.  By repeating <M-p> you can move
681 backward through your commands until you find one you want to repeat.
682 You may then edit the command before typing <RET> if you wish. <M-n>
683 moves forward through the command history, in case you moved backward
684 past the one you wanted while using <M-p>.  If you type the first few
685 characters of a previous command and then type <M-p>, the most recent
686 shell input starting with those characters is inserted.  This can be
687 very convenient when you are repeating a sequence of shell commands.
688 The variable `input-ring-size' controls how many commands are saved in
689 your input history.  The default is 30.
690
691 \1f
692 File: xemacs.info,  Node: Shell Mode,  Next: Terminal emulator,  Prev: Interactive Shell,  Up: Shell
693
694 Shell Mode
695 ----------
696
697    The shell buffer uses Shell mode, which defines several special keys
698 attached to the `C-c' prefix.  They are chosen to resemble the usual
699 editing and job control characters present in shells that are not under
700 XEmacs, except that you must type `C-c' first.  Here is a list of the
701 special key bindings of Shell mode:
702
703 `<RET>'
704      At end of buffer send line as input; otherwise, copy current line
705      to end of buffer and send it (`send-shell-input').  When a line is
706      copied, any text at the beginning of the line that matches the
707      variable `shell-prompt-pattern' is left out; this variable's value
708      should be a regexp string that matches the prompts that you use in
709      your subshell.
710
711 `C-c C-d'
712      Send end-of-file as input, probably causing the shell or its
713      current subjob to finish (`shell-send-eof').
714
715 `C-d'
716      If point is not at the end of the buffer, delete the next
717      character just like most other modes.  If point is at the end of
718      the buffer, send end-of-file as input, instead of generating an
719      error as in other modes (`comint-delchar-or-maybe-eof').
720
721 `C-c C-u'
722      Kill all text that has yet to be sent as input
723      (`kill-shell-input').
724
725 `C-c C-w'
726      Kill a word before point (`backward-kill-word').
727
728 `C-c C-c'
729      Interrupt the shell or its current subjob if any
730      (`interrupt-shell-subjob').
731
732 `C-c C-z'
733      Stop the shell or its current subjob if any (`stop-shell-subjob').
734
735 `C-c C-\'
736      Send quit signal to the shell or its current subjob if any
737      (`quit-shell-subjob').
738
739 `C-c C-o'
740      Delete last batch of output from shell (`kill-output-from-shell').
741
742 `C-c C-r'
743      Scroll top of last batch of output to top of window
744      (`show-output-from-shell').
745
746 `C-c C-y'
747      Copy the previous bunch of shell input and insert it into the
748      buffer before point (`copy-last-shell-input').  No final newline
749      is inserted, and the input copied is not resubmitted until you type
750      <RET>.
751
752 `M-p'
753      Move backward through the input history.  Search for a matching
754      command if you have typed the beginning of a command
755      (`comint-previous-input').
756
757 `M-n'
758      Move forward through the input history.  Useful when you are using
759      <M-p> quickly and go past the desired command
760      (`comint-next-input').
761
762 `<TAB>'
763      Complete the file name preceding point (`comint-dynamic-complete').
764
765 \1f
766 File: xemacs.info,  Node: Terminal emulator,  Next: Term Mode,  Prev: Shell Mode,  Up: Shell
767
768 Interactive Inferior Shell with Terminal Emulator
769 -------------------------------------------------
770
771    To run a subshell in a terminal emulator, putting its typescript in
772 an XEmacs buffer, use `M-x term'.  This creates (or reuses) a buffer
773 named `*term*' and runs a subshell with input coming from your keyboard
774 and output going to that buffer.
775
776    All the normal keys that you type are sent without any interpretation
777 by XEmacs directly to the subshell, as "terminal input."  Any "echo" of
778 your input is the responsibility of the subshell.  (The exception is
779 the terminal escape character, which by default is `C-c'. *note Term
780 Mode::.)  Any "terminal output" from the subshell goes into the buffer,
781 advancing point.
782
783    Some programs (such as XEmacs itself) need to control the appearance
784 on the terminal screen in detail.  They do this by sending special
785 control codes.  The exact control codes needed vary from terminal to
786 terminal, but nowadays most terminals and terminal emulators (including
787 xterm) understand the so-called "ANSI escape sequences" (first
788 popularized by the Digital's VT100 family of terminal).  The term mode
789 also understands these escape sequences, and for each control code does
790 the appropriate thing to change the buffer so that the appearance of
791 the window will match what it would be on a real terminal.  Thus you
792 can actually run XEmacs inside an XEmacs Term window!
793
794    XEmacs does not wait for the subshell to do anything.  You can switch
795 windows or buffers and edit them while the shell is waiting, or while
796 it is running a command.  Output from the subshell waits until XEmacs
797 has time to process it; this happens whenever XEmacs is waiting for
798 keyboard input or for time to elapse.
799
800    To make multiple terminal emulators, rename the buffer `*term*' to
801 something different using `M-x rename-uniquely', just as with Shell
802 mode.
803
804    The file name used to load the subshell is determined the same way
805 as for Shell mode.
806
807    Unlike Shell mode, Term mode does not track the current directory by
808 examining your input.  Instead, if you use a programmable shell, you
809 can have it tell Term what the current directory is.  This is done
810 automatically by bash for version 1.15 and later.
811
812 \1f
813 File: xemacs.info,  Node: Term Mode,  Next: Paging in Term,  Prev: Terminal emulator,  Up: Shell
814
815 Term Mode
816 ---------
817
818    Term uses Term mode, which has two input modes: In line mode, Term
819 basically acts like Shell mode.  *Note Shell Mode::.  In Char mode,
820 each character is sent directly to the inferior subshell, except for
821 the Term escape character, normally `C-c'.
822
823    To switch between line and char mode, use these commands:
824      findex term-char-mode
825
826 `C-c C-k'
827      Switch to line mode.  Do nothing if already in line mode.
828
829 `C-c C-j'
830      Switch to char mode.  Do nothing if already in char mode.
831
832    The following commands are only available in Char mode:
833 `C-c C-c'
834      Send a literal <C-c> to the sub-shell.
835
836 `C-c C-x'
837      A prefix command to conveniently access the global <C-x> commands.
838      For example, `C-c C-x o' invokes the global binding of `C-x o',
839      which is normally `other-window'.
840
841 \1f
842 File: xemacs.info,  Node: Paging in Term,  Prev: Term Mode,  Up: Shell
843
844 Paging in the terminal emulator
845 -------------------------------
846
847    Term mode has a pager feature.  When the pager is enabled, term mode
848 will pause at the end of each screenful.
849
850 `C-c C-q'
851      Toggles the pager feature:  Disables the pager if it is enabled,
852      and vice versa.  This works in both line and char modes.  If the
853      pager enabled, the mode-line contains the word `page'.
854
855    If the pager is enabled, and Term receives more than a screenful of
856 output since your last input, Term will enter More break mode.  This is
857 indicated by `**MORE**' in the mode-line.  Type a `Space' to display
858 the next screenful of output.  Type `?' to see your other options.  The
859 interface is similar to the Unix `more' program.
860
861 \1f
862 File: xemacs.info,  Node: Narrowing,  Next: Hardcopy,  Prev: Shell,  Up: Top
863
864 Narrowing
865 =========
866
867    "Narrowing" means focusing in on some portion of the buffer, making
868 the rest temporarily invisible and inaccessible.  Cancelling the
869 narrowing and making the entire buffer once again visible is called
870 "widening".  The amount of narrowing in effect in a buffer at any time
871 is called the buffer's "restriction".
872
873 `C-x n n'
874      Narrow down to between point and mark (`narrow-to-region').
875
876 `C-x n w'
877      Widen to make the entire buffer visible again (`widen').
878
879    Narrowing sometimes makes it easier to concentrate on a single
880 subroutine or paragraph by eliminating clutter.  It can also be used to
881 restrict the range of operation of a replace command or repeating
882 keyboard macro.  The word `Narrow' appears in the mode line whenever
883 narrowing is in effect.  When you have narrowed to a part of the
884 buffer, that part appears to be all there is.  You can't see the rest,
885 can't move into it (motion commands won't go outside the visible part),
886 and can't change it in any way.  However, the invisible text is not
887 gone; if you save the file, it will be saved.
888
889    The primary narrowing command is `C-x n n' (`narrow-to-region').  It
890 sets the current buffer's restrictions so that the text in the current
891 region remains visible but all text before the region or after the
892 region is invisible.  Point and mark do not change.
893
894    Because narrowing can easily confuse users who do not understand it,
895 `narrow-to-region' is normally a disabled command.  Attempting to use
896 this command asks for confirmation and gives you the option of enabling
897 it; once you enable the command, confirmation will no longer be
898 required.  *Note Disabling::.
899
900    To undo narrowing, use `C-x n w' (`widen').  This makes all text in
901 the buffer accessible again.
902
903    Use the `C-x =' command to get information on what part of the
904 buffer you narrowed down.  *Note Position Info::.
905
906 \1f
907 File: xemacs.info,  Node: Hardcopy,  Next: Recursive Edit,  Prev: Narrowing,  Up: Top
908
909 Hardcopy Output
910 ===============
911
912    The XEmacs commands for making hardcopy derive their names from the
913 Unix commands `print' and `lpr'.
914
915 `M-x print-buffer'
916      Print hardcopy of current buffer using Unix command `print'
917      (`lpr -p').  This command adds page headings containing the file
918      name and page number.
919
920 `M-x lpr-buffer'
921      Print hardcopy of current buffer using Unix command `lpr'.  This
922      command does not add page headings.
923
924 `M-x print-region'
925      Like `print-buffer', but prints only the current region.
926
927 `M-x lpr-region'
928      Like `lpr-buffer', but prints only the current region.
929
930    All the hardcopy commands pass extra switches to the `lpr' program
931 based on the value of the variable `lpr-switches'.  Its value should be
932 a list of strings, each string a switch starting with `-'.  For
933 example, the value could be `("-Pfoo")' to print on printer `foo'.
934
935 \1f
936 File: xemacs.info,  Node: Recursive Edit,  Next: Dissociated Press,  Prev: Hardcopy,  Up: Top
937
938 Recursive Editing Levels
939 ========================
940
941    A "recursive edit" is a situation in which you are using XEmacs
942 commands to perform arbitrary editing while in the middle of another
943 XEmacs command.  For example, when you type `C-r' inside a
944 `query-replace', you enter a recursive edit in which you can change the
945 current buffer.  When you exit from the recursive edit, you go back to
946 the `query-replace'.
947
948    "Exiting" a recursive edit means returning to the unfinished
949 command, which continues execution.  For example, exiting the recursive
950 edit requested by `C-r' in `query-replace' causes query replacing to
951 resume.  Exiting is done with `C-M-c' (`exit-recursive-edit').
952
953    You can also "abort" a recursive edit.  This is like exiting, but
954 also quits the unfinished command immediately.  Use the command `C-]'
955 (`abort-recursive-edit') for this.  *Note Quitting::.
956
957    The mode line shows you when you are in a recursive edit by
958 displaying square brackets around the parentheses that always surround
959 the major and minor mode names.  Every window's mode line shows the
960 square brackets, since XEmacs as a whole, rather than any particular
961 buffer, is in a recursive edit.
962
963    It is possible to be in recursive edits within recursive edits.  For
964 example, after typing `C-r' in a `query-replace', you might type a
965 command that entered the debugger.  In such a case, two or more sets of
966 square brackets appear in the mode line(s).  Exiting the inner
967 recursive edit (here with the debugger `c' command) resumes the
968 query-replace command where it called the debugger.  After the end of
969 the query-replace command, you would be able to exit the first
970 recursive edit.  Aborting exits only one level of recursive edit; it
971 returns to the command level of the previous recursive edit.  You can
972 then abort that one as well.
973
974    The command `M-x top-level' aborts all levels of recursive edits,
975 returning immediately to the top level command reader.
976
977    The text you edit inside the recursive edit need not be the same text
978 that you were editing at top level.  If the command that invokes the
979 recursive edit selects a different buffer first, that is the buffer you
980 will edit recursively.  You can switch buffers within the recursive edit
981 in the normal manner (as long as the buffer-switching keys have not been
982 rebound).  While you could theoretically do the rest of your editing
983 inside the recursive edit, including visiting files, this could have
984 surprising effects (such as stack overflow) from time to time.  It is
985 best if you always exit or abort a recursive edit when you no longer
986 need it.
987
988    In general, XEmacs tries to avoid using recursive edits.  It is
989 usually preferable to allow users to switch among the possible editing
990 modes in any order they like.  With recursive edits, the only way to get
991 to another state is to go "back" to the state that the recursive edit
992 was invoked from.
993
994 \1f
995 File: xemacs.info,  Node: Dissociated Press,  Next: CONX,  Prev: Recursive Edit,  Up: Top
996
997 Dissociated Press
998 =================
999
1000    `M-x dissociated-press' is a command for scrambling a file of text
1001 either word by word or character by character.  Starting from a buffer
1002 of straight English, it produces extremely amusing output.  The input
1003 comes from the current XEmacs buffer.  Dissociated Press writes its
1004 output in a buffer named `*Dissociation*', and redisplays that buffer
1005 after every couple of lines (approximately) to facilitate reading it.
1006
1007    `dissociated-press' asks every so often whether to continue
1008 operating.  Answer `n' to stop it.  You can also stop at any time by
1009 typing `C-g'.  The dissociation output remains in the `*Dissociation*'
1010 buffer for you to copy elsewhere if you wish.
1011
1012    Dissociated Press operates by jumping at random from one point in the
1013 buffer to another.  In order to produce plausible output rather than
1014 gibberish, it insists on a certain amount of overlap between the end of
1015 one run of consecutive words or characters and the start of the next.
1016 That is, if it has just printed out `president' and then decides to
1017 jump to a different point in the file, it might spot the `ent' in
1018 `pentagon' and continue from there, producing `presidentagon'.  Long
1019 sample texts produce the best results.
1020
1021    A positive argument to `M-x dissociated-press' tells it to operate
1022 character by character, and specifies the number of overlap characters.
1023 A negative argument tells it to operate word by word and specifies the
1024 number of overlap words.  In this mode, whole words are treated as the
1025 elements to be permuted, rather than characters.  No argument is
1026 equivalent to an argument of two.  For your againformation, the output
1027 goes only into the buffer `*Dissociation*'.  The buffer you start with
1028 is not changed.
1029
1030    Dissociated Press produces nearly the same results as a Markov chain
1031 based on a frequency table constructed from the sample text.  It is,
1032 however, an independent, ignoriginal invention.  Dissociated Press
1033 techniquitously copies several consecutive characters from the sample
1034 between random choices, whereas a Markov chain would choose randomly for
1035 each word or character.  This makes for more plausible sounding results
1036 and runs faster.
1037
1038    It is a mustatement that too much use of Dissociated Press can be a
1039 developediment to your real work.  Sometimes to the point of outragedy.
1040 And keep dissociwords out of your documentation, if you want it to be
1041 well userenced and properbose.  Have fun.  Your buggestions are welcome.
1042
1043 \1f
1044 File: xemacs.info,  Node: CONX,  Next: Amusements,  Prev: Dissociated Press,  Up: Top
1045
1046 CONX
1047 ====
1048
1049    Besides producing a file of scrambled text with Dissociated Press,
1050 you can generate random sentences by using CONX.
1051
1052 `M-x conx'
1053      Generate random sentences in the `*conx*' buffer.
1054
1055 `M-x conx-buffer'
1056      Absorb the text in the current buffer into the `conx' database.
1057
1058 `M-x conx-init'
1059      Forget the current word-frequency tree.
1060
1061 `M-x conx-load'
1062      Load a `conx' database that has been previously saved with `M-x
1063      conx-save'.
1064
1065 `M-x conx-region'
1066      Absorb the text in the current buffer into the `conx' database.
1067
1068 `M-x conx-save'
1069      Save the current `conx' database to a file for future retrieval.
1070
1071    Copy text from a buffer using `M-x conx-buffer' or `M-x conx-region'
1072 and then type `M-x conx'.  Output is continuously generated until you
1073 type <^G>. You can save the `conx' database to a file with `M-x
1074 conx-save', which you can retrieve with `M-x conx-load'.  To clear the
1075 database, use `M-x conx-init'.
1076
1077 \1f
1078 File: xemacs.info,  Node: Amusements,  Next: Emulation,  Prev: CONX,  Up: Top
1079
1080 Other Amusements
1081 ================
1082
1083    If you are a little bit bored, you can try `M-x hanoi'.  If you are
1084 considerably bored, give it a numeric argument.  If you are very, very
1085 bored, try an argument of 9.  Sit back and watch.
1086
1087    When you are frustrated, try the famous Eliza program.  Just do `M-x
1088 doctor'.  End each input by typing `RET' twice.
1089
1090    When you are feeling strange, type `M-x yow'.
1091
1092 \1f
1093 File: xemacs.info,  Node: Emulation,  Next: Customization,  Prev: Amusements,  Up: Top
1094
1095 Emulation
1096 =========
1097
1098    XEmacs can be programmed to emulate (more or less) most other
1099 editors.  Standard facilities can emulate these:
1100
1101 Viper (a vi emulator)
1102      In XEmacs, Viper is the preferred emulation of vi within XEmacs.
1103      Viper is designed to allow you to take advantage of the best
1104      features of XEmacs while still doing your basic editing in a
1105      familiar, vi-like fashion.  Viper provides various different
1106      levels of vi emulation, from a quite complete emulation that
1107      allows almost no access to native XEmacs commands, to an "expert"
1108      mode that combines the most useful vi commands with the most
1109      useful XEmacs commands.
1110
1111      To start Viper, put the command
1112
1113           (viper-mode)
1114
1115      in your init file.  *Note Init File::.
1116
1117      Viper comes with a separate manual that is provided standard with
1118      the XEmacs distribution.
1119
1120 EDT (DEC VMS editor)
1121      Turn on EDT emulation with `M-x edt-emulation-on'.  `M-x
1122      edt-emulation-off' restores normal Emacs command bindings.
1123
1124      Most of the EDT emulation commands are keypad keys, and most
1125      standard Emacs key bindings are still available.  The EDT
1126      emulation rebindings are done in the global keymap, so there is no
1127      problem switching buffers or major modes while in EDT emulation.
1128
1129 Gosling Emacs
1130      Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
1131      set-gosmacs-bindings'.  This redefines many keys, mostly on the
1132      `C-x' and `ESC' prefixes, to work as they do in Gosmacs.  `M-x
1133      set-gnu-bindings' returns to normal XEmacs by rebinding the same
1134      keys to the definitions they had at the time `M-x
1135      set-gosmacs-bindings' was done.
1136
1137      It is also possible to run Mocklisp code written for Gosling Emacs.
1138      *Note Mocklisp::.
1139
1140 \1f
1141 File: xemacs.info,  Node: Customization,  Next: Quitting,  Prev: Emulation,  Up: Top
1142
1143 Customization
1144 *************
1145
1146    This chapter talks about various topics relevant to adapting the
1147 behavior of Emacs in minor ways.
1148
1149    All kinds of customization affect only the particular Emacs job that
1150 you do them in.  They are completely lost when you kill the Emacs job,
1151 and have no effect on other Emacs jobs you may run at the same time or
1152 later.  The only way an Emacs job can affect anything outside of it is
1153 by writing a file; in particular, the only way to make a customization
1154 `permanent' is to put something in your init file or other appropriate
1155 file to do the customization in each session.  *Note Init File::.
1156
1157 * Menu:
1158
1159 * Minor Modes::     Each minor mode is one feature you can turn on
1160                      independently of any others.
1161 * Variables::       Many Emacs commands examine Emacs variables
1162                      to decide what to do; by setting variables,
1163                      you can control their functioning.
1164 * Keyboard Macros:: A keyboard macro records a sequence of keystrokes
1165                      to be replayed with a single command.
1166 * Key Bindings::    The keymaps say what command each key runs.
1167                      By changing them, you can "redefine keys".
1168 * Syntax::          The syntax table controls how words and expressions
1169                      are parsed.
1170 * Init File::       How to write common customizations in the init file.
1171 * Audible Bell::    Changing how Emacs sounds the bell.
1172 * Faces::           Changing the fonts and colors of a region of text.
1173 * Frame Components::  Controlling the presence and positions of the
1174                      menubar, toolbars, and gutters.
1175 * X Resources::     X resources controlling various aspects of the
1176                      behavior of XEmacs.
1177