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