update.
[chise/xemacs-chise.git-] / info / xemacs.info-9
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: Change Window,  Prev: Pop Up Window,  Up: Windows
34
35 Deleting and Rearranging Windows
36 ================================
37
38 `C-x 0'
39      Get rid of the selected window (`delete-window').  That is a zero.
40      If there is more than one Emacs frame, deleting the sole remaining
41      window on that frame deletes the frame as well. If the current
42      frame is the only frame, it is not deleted.
43
44 `C-x 1'
45      Get rid of all windows except the selected one
46      (`delete-other-windows').
47
48 `C-x ^'
49      Make the selected window taller, at the expense of the other(s)
50      (`enlarge-window').
51
52 `C-x }'
53      Make the selected window wider (`enlarge-window-horizontally').
54
55    To delete a window, type `C-x 0' (`delete-window').  (That is a
56 zero.)  The space occupied by the deleted window is distributed among
57 the other active windows (but not the minibuffer window, even if that
58 is active at the time).  Once a window is deleted, its attributes are
59 forgotten; there is no automatic way to make another window of the same
60 shape or showing the same buffer.  The buffer continues to exist, and
61 you can select it in any window with `C-x b'.
62
63    `C-x 1' (`delete-other-windows') is more powerful than `C-x 0'; it
64 deletes all the windows except the selected one (and the minibuffer).
65 The selected window expands to use the whole frame except for the echo
66 area.
67
68    To readjust the division of space among existing windows, use `C-x
69 ^' (`enlarge-window').  It makes the currently selected window longer
70 by one line or as many lines as a numeric argument specifies.  With a
71 negative argument, it makes the selected window smaller.  `C-x }'
72 (`enlarge-window-horizontally') makes the selected window wider by the
73 specified number of columns.  The extra screen space given to a window
74 comes from one of its neighbors, if that is possible; otherwise, all
75 the competing windows are shrunk in the same proportion.  If this makes
76 some windows too small, those windows are deleted and their space is
77 divided up.   Minimum window size is specified by the variables
78 `window-min-height' and `window-min-width'.
79
80    You can also resize windows within a frame by clicking the left mouse
81 button on a modeline, and dragging.
82
83    Clicking the right button on a mode line pops up a menu of common
84 window manager operations.  This menu contains the following options:
85
86 Delete Window
87      Remove the window above this modeline from the frame.
88
89 Delete Other Windows
90      Delete all windows on the frame except for the one above this
91      modeline.
92
93 Split Window
94      Split the window above the mode line in half, creating another
95      window.
96
97 Split Window Horizontally
98      Split the window above the mode line in half horizontally, so that
99      there will be two windows side-by-side.
100
101 Balance Windows
102      Readjust the sizes of all windows on the frame until all windows
103      have roughly the same number of lines.
104
105 \1f
106 File: xemacs.info,  Node: Mule,  Next: Major Modes,  Prev: Windows,  Up: Top
107
108 World Scripts Support
109 *********************
110
111    If you compile XEmacs with mule option, it supports a wide variety of
112 world scripts, including Latin script, as well as Arabic script,
113 Simplified Chinese script (for mainland of China), Traditional Chinese
114 script (for Taiwan and Hong-Kong), Greek script, Hebrew script, IPA
115 symbols, Japanese scripts (Hiragana, Katakana and Kanji), Korean scripts
116 (Hangul and Hanja) and Cyrillic script (for Beylorussian, Bulgarian,
117 Russian, Serbian and Ukrainian).  These features have been merged from
118 the modified version of Emacs known as MULE (for "MULti-lingual
119 Enhancement to GNU Emacs").
120
121 * Menu:
122
123 * Mule Intro::              Basic concepts of Mule.
124 * Language Environments::   Setting things up for the language you use.
125 * Input Methods::           Entering text characters not on your keyboard.
126 * Select Input Method::     Specifying your choice of input methods.
127 * Coding Systems::          Character set conversion when you read and
128                               write files, and so on.
129 * Recognize Coding::        How XEmacs figures out which conversion to use.
130 * Specify Coding::          Various ways to choose which conversion to use.
131
132 \1f
133 File: xemacs.info,  Node: Mule Intro,  Next: Language Environments,  Prev: Mule,  Up: Mule
134
135 Introduction to world scripts
136 =============================
137
138    The users of these scripts have established many more-or-less
139 standard coding systems for storing files.  XEmacs translates between
140 the internal character encoding and various other coding systems when
141 reading and writing files, when exchanging data with subprocesses, and
142 (in some cases) in the `C-q' command (see below).
143
144    The command `C-h h' (`view-hello-file') displays the file
145 `etc/HELLO', which shows how to say "hello" in many languages.  This
146 illustrates various scripts.
147
148    Keyboards, even in the countries where these character sets are used,
149 generally don't have keys for all the characters in them.  So XEmacs
150 supports various "input methods", typically one for each script or
151 language, to make it convenient to type them.
152
153    The prefix key `C-x <RET>' is used for commands that pertain to
154 world scripts, coding systems, and input methods.
155
156 \1f
157 File: xemacs.info,  Node: Language Environments,  Next: Input Methods,  Prev: Mule Intro,  Up: Mule
158
159 Language Environments
160 =====================
161
162    All supported character sets are supported in XEmacs buffers if it is
163 compile with mule; there is no need to select a particular language in
164 order to display its characters in an XEmacs buffer.  However, it is
165 important to select a "language environment" in order to set various
166 defaults.  The language environment really represents a choice of
167 preferred script (more or less) rather that a choice of language.
168
169    The language environment controls which coding systems to recognize
170 when reading text (*note Recognize Coding::).  This applies to files,
171 incoming mail, netnews, and any other text you read into XEmacs.  It may
172 also specify the default coding system to use when you create a file.
173 Each language environment also specifies a default input method.
174
175    The command to select a language environment is `M-x
176 set-language-environment'.  It makes no difference which buffer is
177 current when you use this command, because the effects apply globally to
178 the XEmacs session.  The supported language environments include:
179
180      Chinese-BIG5, Chinese-CNS, Chinese-GB, Cyrillic-ISO, English,
181      Ethiopic, Greek, Japanese, Korean, Latin-1, Latin-2, Latin-3,
182      Latin-4, Latin-5.
183
184    Some operating systems let you specify the language you are using by
185 setting locale environment variables.  XEmacs handles one common special
186 case of this: if your locale name for character types contains the
187 string `8859-N', XEmacs automatically selects the corresponding
188 language environment.
189
190    To display information about the effects of a certain language
191 environment LANG-ENV, use the command `C-h L LANG-ENV <RET>'
192 (`describe-language-environment').  This tells you which languages this
193 language environment is useful for, and lists the character sets,
194 coding systems, and input methods that go with it.  It also shows some
195 sample text to illustrate scripts used in this language environment.
196 By default, this command describes the chosen language environment.
197
198 \1f
199 File: xemacs.info,  Node: Input Methods,  Next: Select Input Method,  Prev: Language Environments,  Up: Mule
200
201 Input Methods
202 =============
203
204    An "input method" is a kind of character conversion designed
205 specifically for interactive input.  In XEmacs, typically each language
206 has its own input method; sometimes several languages which use the same
207 characters can share one input method.  A few languages support several
208 input methods.
209
210    The simplest kind of input method works by mapping ASCII letters into
211 another alphabet.  This is how the Greek and Russian input methods work.
212
213    A more powerful technique is composition: converting sequences of
214 characters into one letter.  Many European input methods use composition
215 to produce a single non-ASCII letter from a sequence that consists of a
216 letter followed by accent characters.  For example, some methods convert
217 the sequence `'a' into a single accented letter.
218
219    The input methods for syllabic scripts typically use mapping followed
220 by composition.  The input methods for Thai and Korean work this way.
221 First, letters are mapped into symbols for particular sounds or tone
222 marks; then, sequences of these which make up a whole syllable are
223 mapped into one syllable sign.
224
225    Chinese and Japanese require more complex methods.  In Chinese input
226 methods, first you enter the phonetic spelling of a Chinese word (in
227 input method `chinese-py', among others), or a sequence of portions of
228 the character (input methods `chinese-4corner' and `chinese-sw', and
229 others).  Since one phonetic spelling typically corresponds to many
230 different Chinese characters, you must select one of the alternatives
231 using special XEmacs commands.  Keys such as `C-f', `C-b', `C-n',
232 `C-p', and digits have special definitions in this situation, used for
233 selecting among the alternatives.  <TAB> displays a buffer showing all
234 the possibilities.
235
236    In Japanese input methods, first you input a whole word using
237 phonetic spelling; then, after the word is in the buffer, XEmacs
238 converts it into one or more characters using a large dictionary.  One
239 phonetic spelling corresponds to many differently written Japanese
240 words, so you must select one of them; use `C-n' and `C-p' to cycle
241 through the alternatives.
242
243    Sometimes it is useful to cut off input method processing so that the
244 characters you have just entered will not combine with subsequent
245 characters.  For example, in input method `latin-1-postfix', the
246 sequence `e '' combines to form an `e' with an accent.  What if you
247 want to enter them as separate characters?
248
249    One way is to type the accent twice; that is a special feature for
250 entering the separate letter and accent.  For example, `e ' '' gives
251 you the two characters `e''.  Another way is to type another letter
252 after the `e'--something that won't combine with that--and immediately
253 delete it.  For example, you could type `e e <DEL> '' to get separate
254 `e' and `''.
255
256    Another method, more general but not quite as easy to type, is to use
257 `C-\ C-\' between two characters to stop them from combining.  This is
258 the command `C-\' (`toggle-input-method') used twice.  *Note Select
259 Input Method::.
260
261    `C-\ C-\' is especially useful inside an incremental search, because
262 stops waiting for more characters to combine, and starts searching for
263 what you have already entered.
264
265    The variables `input-method-highlight-flag' and
266 `input-method-verbose-flag' control how input methods explain what is
267 happening.  If `input-method-highlight-flag' is non-`nil', the partial
268 sequence is highlighted in the buffer.  If `input-method-verbose-flag'
269 is non-`nil', the list of possible characters to type next is displayed
270 in the echo area (but not when you are in the minibuffer).
271
272 \1f
273 File: xemacs.info,  Node: Select Input Method,  Next: Coding Systems,  Prev: Input Methods,  Up: Mule
274
275 Selecting an Input Method
276 =========================
277
278 `C-\'
279      Enable or disable use of the selected input method.
280
281 `C-x <RET> C-\ METHOD <RET>'
282      Select a new input method for the current buffer.
283
284 `C-h I METHOD <RET>'
285 `C-h C-\ METHOD <RET>'
286      Describe the input method METHOD (`describe-input-method').  By
287      default, it describes the current input method (if any).
288
289 `M-x list-input-methods'
290      Display a list of all the supported input methods.
291
292    To choose an input method for the current buffer, use `C-x <RET>
293 C-\' (`select-input-method').  This command reads the input method name
294 with the minibuffer; the name normally starts with the language
295 environment that it is meant to be used with.  The variable
296 `current-input-method' records which input method is selected.
297
298    Input methods use various sequences of ASCII characters to stand for
299 non-ASCII characters.  Sometimes it is useful to turn off the input
300 method temporarily.  To do this, type `C-\' (`toggle-input-method').
301 To reenable the input method, type `C-\' again.
302
303    If you type `C-\' and you have not yet selected an input method, it
304 prompts for you to specify one.  This has the same effect as using `C-x
305 <RET> C-\' to specify an input method.
306
307    Selecting a language environment specifies a default input method for
308 use in various buffers.  When you have a default input method, you can
309 select it in the current buffer by typing `C-\'.  The variable
310 `default-input-method' specifies the default input method (`nil' means
311 there is none).
312
313    Some input methods for alphabetic scripts work by (in effect)
314 remapping the keyboard to emulate various keyboard layouts commonly used
315 for those scripts.  How to do this remapping properly depends on your
316 actual keyboard layout.  To specify which layout your keyboard has, use
317 the command `M-x quail-set-keyboard-layout'.
318
319    To display a list of all the supported input methods, type `M-x
320 list-input-methods'.  The list gives information about each input
321 method, including the string that stands for it in the mode line.
322
323 \1f
324 File: xemacs.info,  Node: Coding Systems,  Next: Recognize Coding,  Prev: Select Input Method,  Up: Mule
325
326 Coding Systems
327 ==============
328
329    Users of various languages have established many more-or-less
330 standard coding systems for representing them.  XEmacs does not use
331 these coding systems internally; instead, it converts from various
332 coding systems to its own system when reading data, and converts the
333 internal coding system to other coding systems when writing data.
334 Conversion is possible in reading or writing files, in sending or
335 receiving from the terminal, and in exchanging data with subprocesses.
336
337    XEmacs assigns a name to each coding system.  Most coding systems are
338 used for one language, and the name of the coding system starts with the
339 language name.  Some coding systems are used for several languages;
340 their names usually start with `iso'.  There are also special coding
341 systems `binary' and `no-conversion' which do not convert printing
342 characters at all.
343
344    In addition to converting various representations of non-ASCII
345 characters, a coding system can perform end-of-line conversion.  XEmacs
346 handles three different conventions for how to separate lines in a file:
347 newline, carriage-return linefeed, and just carriage-return.
348
349 `C-h C CODING <RET>'
350      Describe coding system CODING.
351
352 `C-h C <RET>'
353      Describe the coding systems currently in use.
354
355 `M-x list-coding-systems'
356      Display a list of all the supported coding systems.
357
358    The command `C-h C' (`describe-coding-system') displays information
359 about particular coding systems.  You can specify a coding system name
360 as argument; alternatively, with an empty argument, it describes the
361 coding systems currently selected for various purposes, both in the
362 current buffer and as the defaults, and the priority list for
363 recognizing coding systems (*note Recognize Coding::).
364
365    To display a list of all the supported coding systems, type `M-x
366 list-coding-systems'.  The list gives information about each coding
367 system, including the letter that stands for it in the mode line (*note
368 Mode Line::).
369
370    Each of the coding systems that appear in this list--except for
371 `binary', which means no conversion of any kind--specifies how and
372 whether to convert printing characters, but leaves the choice of
373 end-of-line conversion to be decided based on the contents of each file.
374 For example, if the file appears to use carriage-return linefeed between
375 lines, that end-of-line conversion will be used.
376
377    Each of the listed coding systems has three variants which specify
378 exactly what to do for end-of-line conversion:
379
380 `...-unix'
381      Don't do any end-of-line conversion; assume the file uses newline
382      to separate lines.  (This is the convention normally used on Unix
383      and GNU systems.)
384
385 `...-dos'
386      Assume the file uses carriage-return linefeed to separate lines,
387      and do the appropriate conversion.  (This is the convention
388      normally used on Microsoft systems.)
389
390 `...-mac'
391      Assume the file uses carriage-return to separate lines, and do the
392      appropriate conversion.  (This is the convention normally used on
393      the Macintosh system.)
394
395    These variant coding systems are omitted from the
396 `list-coding-systems' display for brevity, since they are entirely
397 predictable.  For example, the coding system `iso-8859-1' has variants
398 `iso-8859-1-unix', `iso-8859-1-dos' and `iso-8859-1-mac'.
399
400    In contrast, the coding system `binary' specifies no character code
401 conversion at all--none for non-Latin-1 byte values and none for end of
402 line.  This is useful for reading or writing binary files, tar files,
403 and other files that must be examined verbatim.
404
405    The easiest way to edit a file with no conversion of any kind is with
406 the `M-x find-file-literally' command.  This uses `binary', and also
407 suppresses other XEmacs features that might convert the file contents
408 before you see them.  *Note Visiting::.
409
410    The coding system `no-conversion' means that the file contains
411 non-Latin-1 characters stored with the internal XEmacs encoding.  It
412 handles end-of-line conversion based on the data encountered, and has
413 the usual three variants to specify the kind of end-of-line conversion.
414
415 \1f
416 File: xemacs.info,  Node: Recognize Coding,  Next: Specify Coding,  Prev: Coding Systems,  Up: Mule
417
418 Recognizing Coding Systems
419 ==========================
420
421    Most of the time, XEmacs can recognize which coding system to use for
422 any given file-once you have specified your preferences.
423
424    Some coding systems can be recognized or distinguished by which byte
425 sequences appear in the data.  However, there are coding systems that
426 cannot be distinguished, not even potentially.  For example, there is no
427 way to distinguish between Latin-1 and Latin-2; they use the same byte
428 values with different meanings.
429
430    XEmacs handles this situation by means of a priority list of coding
431 systems.  Whenever XEmacs reads a file, if you do not specify the coding
432 system to use, XEmacs checks the data against each coding system,
433 starting with the first in priority and working down the list, until it
434 finds a coding system that fits the data.  Then it converts the file
435 contents assuming that they are represented in this coding system.
436
437    The priority list of coding systems depends on the selected language
438 environment (*note Language Environments::).  For example, if you use
439 French, you probably want XEmacs to prefer Latin-1 to Latin-2; if you
440 use Czech, you probably want Latin-2 to be preferred.  This is one of
441 the reasons to specify a language environment.
442
443    However, you can alter the priority list in detail with the command
444 `M-x prefer-coding-system'.  This command reads the name of a coding
445 system from the minibuffer, and adds it to the front of the priority
446 list, so that it is preferred to all others.  If you use this command
447 several times, each use adds one element to the front of the priority
448 list.
449
450    Sometimes a file name indicates which coding system to use for the
451 file.  The variable `file-coding-system-alist' specifies this
452 correspondence.  There is a special function
453 `modify-coding-system-alist' for adding elements to this list.  For
454 example, to read and write all `.txt' using the coding system
455 `china-iso-8bit', you can execute this Lisp expression:
456
457      (modify-coding-system-alist 'file "\\.txt\\'" 'china-iso-8bit)
458
459 The first argument should be `file', the second argument should be a
460 regular expression that determines which files this applies to, and the
461 third argument says which coding system to use for these files.
462
463    You can specify the coding system for a particular file using the
464 `-*-...-*-' construct at the beginning of a file, or a local variables
465 list at the end (*note File Variables::).  You do this by defining a
466 value for the "variable" named `coding'.  XEmacs does not really have a
467 variable `coding'; instead of setting a variable, it uses the specified
468 coding system for the file.  For example, `-*-mode: C; coding:
469 iso-8859-1;-*-' specifies use of the iso-8859-1 coding system, as well
470 as C mode.
471
472    Once XEmacs has chosen a coding system for a buffer, it stores that
473 coding system in `buffer-file-coding-system' and uses that coding
474 system, by default, for operations that write from this buffer into a
475 file.  This includes the commands `save-buffer' and `write-region'.  If
476 you want to write files from this buffer using a different coding
477 system, you can specify a different coding system for the buffer using
478 `set-buffer-file-coding-system' (*note Specify Coding::).
479
480 \1f
481 File: xemacs.info,  Node: Specify Coding,  Prev: Recognize Coding,  Up: Mule
482
483 Specifying a Coding System
484 ==========================
485
486    In cases where XEmacs does not automatically choose the right coding
487 system, you can use these commands to specify one:
488
489 `C-x <RET> f CODING <RET>'
490      Use coding system CODING for the visited file in the current
491      buffer.
492
493 `C-x <RET> c CODING <RET>'
494      Specify coding system CODING for the immediately following command.
495
496 `C-x <RET> k CODING <RET>'
497      Use coding system CODING for keyboard input.
498
499 `C-x <RET> t CODING <RET>'
500      Use coding system CODING for terminal output.
501
502 `C-x <RET> p CODING <RET>'
503      Use coding system CODING for subprocess input and output in the
504      current buffer.
505
506    The command `C-x RET f' (`set-buffer-file-coding-system') specifies
507 the file coding system for the current buffer--in other words, which
508 coding system to use when saving or rereading the visited file.  You
509 specify which coding system using the minibuffer.  Since this command
510 applies to a file you have already visited, it affects only the way the
511 file is saved.
512
513    Another way to specify the coding system for a file is when you visit
514 the file.  First use the command `C-x <RET> c'
515 (`universal-coding-system-argument'); this command uses the minibuffer
516 to read a coding system name.  After you exit the minibuffer, the
517 specified coding system is used for _the immediately following command_.
518
519    So if the immediately following command is `C-x C-f', for example,
520 it reads the file using that coding system (and records the coding
521 system for when the file is saved).  Or if the immediately following
522 command is `C-x C-w', it writes the file using that coding system.
523 Other file commands affected by a specified coding system include `C-x
524 C-i' and `C-x C-v', as well as the other-window variants of `C-x C-f'.
525
526    In addition, if you run some file input commands with the precedent
527 `C-u', you can specify coding system to read from minibuffer.  So if
528 the immediately following command is `C-x C-f', for example, it reads
529 the file using that coding system (and records the coding system for
530 when the file is saved).  Other file commands affected by a specified
531 coding system include `C-x C-i' and `C-x C-v', as well as the
532 other-window variants of `C-x C-f'.
533
534    The variable `default-buffer-file-coding-system' specifies the
535 choice of coding system to use when you create a new file.  It applies
536 when you find a new file, and when you create a buffer and then save it
537 in a file.  Selecting a language environment typically sets this
538 variable to a good choice of default coding system for that language
539 environment.
540
541    The command `C-x <RET> t' (`set-terminal-coding-system') specifies
542 the coding system for terminal output.  If you specify a character code
543 for terminal output, all characters output to the terminal are
544 translated into that coding system.
545
546    This feature is useful for certain character-only terminals built to
547 support specific languages or character sets--for example, European
548 terminals that support one of the ISO Latin character sets.
549
550    By default, output to the terminal is not translated at all.
551
552    The command `C-x <RET> k' (`set-keyboard-coding-system') specifies
553 the coding system for keyboard input.  Character-code translation of
554 keyboard input is useful for terminals with keys that send non-ASCII
555 graphic characters--for example, some terminals designed for ISO
556 Latin-1 or subsets of it.
557
558    By default, keyboard input is not translated at all.
559
560    There is a similarity between using a coding system translation for
561 keyboard input, and using an input method: both define sequences of
562 keyboard input that translate into single characters.  However, input
563 methods are designed to be convenient for interactive use by humans, and
564 the sequences that are translated are typically sequences of ASCII
565 printing characters.  Coding systems typically translate sequences of
566 non-graphic characters.
567
568    The command `C-x <RET> p' (`set-buffer-process-coding-system')
569 specifies the coding system for input and output to a subprocess.  This
570 command applies to the current buffer; normally, each subprocess has its
571 own buffer, and thus you can use this command to specify translation to
572 and from a particular subprocess by giving the command in the
573 corresponding buffer.
574
575    By default, process input and output are not translated at all.
576
577    The variable `file-name-coding-system' specifies a coding system to
578 use for encoding file names.  If you set the variable to a coding
579 system name (as a Lisp symbol or a string), XEmacs encodes file names
580 using that coding system for all file operations.  This makes it
581 possible to use non-Latin-1 characters in file names--or, at least,
582 those non-Latin-1 characters which the specified coding system can
583 encode.  By default, this variable is `nil', which implies that you
584 cannot use non-Latin-1 characters in file names.
585
586 \1f
587 File: xemacs.info,  Node: Major Modes,  Next: Indentation,  Prev: Mule,  Up: Top
588
589 Major Modes
590 ***********
591
592    Emacs has many different "major modes", each of which customizes
593 Emacs for editing text of a particular sort.  The major modes are
594 mutually exclusive;  at any time, each buffer has one major mode.  The
595 mode line normally contains the name of the current major mode in
596 parentheses.  *Note Mode Line::.
597
598    The least specialized major mode is called "Fundamental mode".  This
599 mode has no mode-specific redefinitions or variable settings.  Each
600 Emacs command behaves in its most general manner, and each option is in
601 its default state.  For editing any specific type of text, such as Lisp
602 code or English text, you should switch to the appropriate major mode,
603 such as Lisp mode or Text mode.
604
605    Selecting a major mode changes the meanings of a few keys to become
606 more specifically adapted to the language being edited.  <TAB>, <DEL>,
607 and <LFD> are changed frequently.  In addition, commands which handle
608 comments use the mode to determine how to delimit comments.  Many major
609 modes redefine the syntactical properties of characters appearing in
610 the buffer.  *Note Syntax::.
611
612    The major modes fall into three major groups.  Lisp mode (which has
613 several variants), C mode, and Muddle mode are for specific programming
614 languages.  Text mode, Nroff mode, TeX mode, and Outline mode are for
615 editing English text.  The remaining major modes are not intended for
616 use on users' files; they are used in buffers created by Emacs for
617 specific purposes and include Dired mode for buffers made by Dired
618 (*note Dired::), Mail mode for buffers made by `C-x m' (*note Sending
619 Mail::), and Shell mode for buffers used for communicating with an
620 inferior shell process (*note Interactive Shell::).
621
622    Most programming language major modes specify that only blank lines
623 separate paragraphs.  This is so that the paragraph commands remain
624 useful.  *Note Paragraphs::.  They also cause Auto Fill mode to use the
625 definition of <TAB> to indent the new lines it creates.  This is
626 because most lines in a program are usually indented.  *Note
627 Indentation::.
628
629 * Menu:
630
631 * Choosing Modes::     How major modes are specified or chosen.
632
633 \1f
634 File: xemacs.info,  Node: Choosing Modes,  Prev: Major Modes,  Up: Major Modes
635
636 Choosing Major Modes
637 ====================
638
639    You can select a major mode explicitly for the current buffer, but
640 most of the time Emacs determines which mode to use based on the file
641 name or some text in the file.
642
643    Use a `M-x' command to explicitly select a new major mode.  Add
644 `-mode' to the name of a major mode to get the name of a command to
645 select that mode.  For example, to enter Lisp mode, execute `M-x
646 lisp-mode'.
647
648    When you visit a file, Emacs usually chooses the right major mode
649 based on the file's name.  For example, files whose names end in `.c'
650 are edited in C mode.  The variable `auto-mode-alist' controls the
651 correspondence between file names and major mode.  Its value is a list
652 in which each element has the form:
653
654      (REGEXP . MODE-FUNCTION)
655
656 For example, one element normally found in the list has the form
657 `("\\.c$" . c-mode)'. It is responsible for selecting C mode for files
658 whose names end in `.c'.  (Note that `\\' is needed in Lisp syntax to
659 include a `\' in the string, which is needed to suppress the special
660 meaning of `.' in regexps.)  The only practical way to change this
661 variable is with Lisp code.
662
663    You can specify which major mode should be used for editing a certain
664 file by a special sort of text in the first non-blank line of the file.
665 The mode name should appear in this line both preceded and followed by
666 `-*-'.  Other text may appear on the line as well.  For example,
667
668      ;-*-Lisp-*-
669
670 tells Emacs to use Lisp mode.  Note how the semicolon is used to make
671 Lisp treat this line as a comment.  Such an explicit specification
672 overrides any default mode based on the file name.
673
674    Another format of mode specification is:
675
676      -*-Mode: MODENAME;-*-
677
678 which allows other things besides the major mode name to be specified.
679 However, Emacs does not look for anything except the mode name.
680
681    The major mode can also be specified in a local variables list.
682 *Note File Variables::.
683
684    When you visit a file that does not specify a major mode to use, or
685 when you create a new buffer with `C-x b', Emacs uses the major mode
686 specified by the variable `default-major-mode'.  Normally this value is
687 the symbol `fundamental-mode', which specifies Fundamental mode.  If
688 `default-major-mode' is `nil', the major mode is taken from the
689 previously selected buffer.
690
691 \1f
692 File: xemacs.info,  Node: Indentation,  Next: Text,  Prev: Major Modes,  Up: Top
693
694 Indentation
695 ***********
696
697 `<TAB>'
698      Indent current line "appropriately" in a mode-dependent fashion.
699
700 `<LFD>'
701      Perform <RET> followed by <TAB> (`newline-and-indent').
702
703 `M-^'
704      Merge two lines (`delete-indentation').  This would cancel out the
705      effect of <LFD>.
706
707 `C-M-o'
708      Split line at point; text on the line after point becomes a new
709      line indented to the same column that it now starts in
710      (`split-line').
711
712 `M-m'
713      Move (forward or back) to the first non-blank character on the
714      current line (`back-to-indentation').
715
716 `C-M-\'
717      Indent several lines to same column (`indent-region').
718
719 `C-x <TAB>'
720      Shift block of lines rigidly right or left (`indent-rigidly').
721
722 `M-i'
723      Indent from point to the next prespecified tab stop column
724      (`tab-to-tab-stop').
725
726 `M-x indent-relative'
727      Indent from point to under an indentation point in the previous
728      line.
729
730    Most programming languages have some indentation convention.  For
731 Lisp code, lines are indented according to their nesting in
732 parentheses.  The same general idea is used for C code, though details
733 differ.
734
735    Use the <TAB> command to indent a line whatever the language.  Each
736 major mode defines this command to perform indentation appropriate for
737 the particular language.  In Lisp mode, <TAB> aligns a line according
738 to its depth in parentheses.  No matter where in the line you are when
739 you type <TAB>, it aligns the line as a whole.  In C mode, <TAB>
740 implements a subtle and sophisticated indentation style that knows
741 about many aspects of C syntax.
742
743    In Text mode, <TAB> runs the command `tab-to-tab-stop', which
744 indents to the next tab stop column.  You can set the tab stops with
745 `M-x edit-tab-stops'.
746
747 * Menu:
748
749 * Indentation Commands:: Various commands and techniques for indentation.
750 * Tab Stops::            You can set arbitrary "tab stops" and then
751                          indent to the next tab stop when you want to.
752 * Just Spaces::          You can request indentation using just spaces.
753
754 \1f
755 File: xemacs.info,  Node: Indentation Commands,  Next: Tab Stops,  Prev: Indentation,  Up: Indentation
756
757 Indentation Commands and Techniques
758 ===================================
759
760    If you just want to insert a tab character in the buffer, you can
761 type `C-q <TAB>'.
762
763    To move over the indentation on a line, type `Meta-m'
764 (`back-to-indentation').  This command, given anywhere on a line,
765 positions point at the first non-blank character on the line.
766
767    To insert an indented line before the current line, type `C-a C-o
768 <TAB>'.  To make an indented line after the current line, use `C-e
769 <LFD>'.
770
771    `C-M-o' (`split-line') moves the text from point to the end of the
772 line vertically down, so that the current line becomes two lines.
773 `C-M-o' first moves point forward over any spaces and tabs.  Then it
774 inserts after point a newline and enough indentation to reach the same
775 column point is on.  Point remains before the inserted newline; in this
776 regard, `C-M-o' resembles `C-o'.
777
778    To join two lines cleanly, use the `Meta-^' (`delete-indentation')
779 command to delete the indentation at the front of the current line, and
780 the line boundary as well.  Empty spaces are replaced by a single
781 space, or by no space if at the beginning of a line, before a close
782 parenthesis, or after an open parenthesis.  To delete just the
783 indentation of a line, go to the beginning of the line and use `Meta-\'
784 (`delete-horizontal-space'), which deletes all spaces and tabs around
785 the cursor.
786
787    There are also commands for changing the indentation of several
788 lines at once.  `Control-Meta-\' (`indent-region') gives each line which
789 begins in the region the "usual" indentation by invoking <TAB> at the
790 beginning of the line.  A numeric argument specifies the column to
791 indent to.  Each line is shifted left or right so that its first
792 non-blank character appears in that column.  `C-x <TAB>'
793 (`indent-rigidly') moves all the lines in the region right by its
794 argument (left, for negative arguments).  The whole group of lines moves
795 rigidly sideways, which is how the command gets its name.
796
797    `M-x indent-relative' indents at point based on the previous line
798 (actually, the last non-empty line.)  It inserts whitespace at point,
799 moving point, until it is underneath an indentation point in the
800 previous line.  An indentation point is the end of a sequence of
801 whitespace or the end of the line.  If point is farther right than any
802 indentation point in the previous line, the whitespace before point is
803 deleted and the first indentation point then applicable is used.  If no
804 indentation point is applicable even then, `tab-to-tab-stop' is run
805 (see next section).
806
807    `indent-relative' is the definition of <TAB> in Indented Text mode.
808 *Note Text::.
809
810 \1f
811 File: xemacs.info,  Node: Tab Stops,  Next: Just Spaces,  Prev: Indentation Commands,  Up: Indentation
812
813 Tab Stops
814 =========
815
816    For typing in tables, you can use Text mode's definition of <TAB>,
817 `tab-to-tab-stop'.  This command inserts indentation before point,
818 enough to reach the next tab stop column.  Even if you are not in Text
819 mode, this function is associated with `M-i' anyway.
820
821    You can arbitrarily set the tab stops used by `M-i'.  They are
822 stored as a list of column-numbers in increasing order in the variable
823 `tab-stop-list'.
824
825    The convenient way to set the tab stops is using `M-x
826 edit-tab-stops', which creates and selects a buffer containing a
827 description of the tab stop settings.  You can edit this buffer to
828 specify different tab stops, and then type `C-c C-c' to make those new
829 tab stops take effect.  In the tab stop buffer, `C-c C-c' runs the
830 function `edit-tab-stops-note-changes' rather than the default
831 `save-buffer'.  `edit-tab-stops' records which buffer was current when
832 you invoked it, and stores the tab stops in that buffer.  Normally all
833 buffers share the same tab stops and changing them in one buffer
834 affects all.  If you make `tab-stop-list' local in one buffer
835 `edit-tab-stops' in that buffer edits only the local settings.
836
837    Below is the text representing ordinary tab stops every eight
838 columns:
839
840              :       :       :       :       :       :
841      0         1         2         3         4
842      0123456789012345678901234567890123456789012345678
843      To install changes, type C-c C-c
844
845    The first line contains a colon at each tab stop.  The remaining
846 lines help you see where the colons are and tell you what to do.
847
848    Note that the tab stops that control `tab-to-tab-stop' have nothing
849 to do with displaying tab characters in the buffer.  *Note Display
850 Vars::, for more information on that.
851
852 \1f
853 File: xemacs.info,  Node: Just Spaces,  Prev: Tab Stops,  Up: Indentation
854
855 Tabs vs. Spaces
856 ===============
857
858    Emacs normally uses both tabs and spaces to indent lines.  If you
859 prefer, all indentation can be made from spaces only.  To request this,
860 set `indent-tabs-mode' to `nil'.  This is a per-buffer variable;
861 altering the variable affects only the current buffer, but there is a
862 default value which you can change as well.  *Note Locals::.
863
864    There are also commands to convert tabs to spaces or vice versa,
865 always preserving the columns of all non-blank text.  `M-x tabify'
866 scans the region for sequences of spaces, and converts sequences of at
867 least three spaces to tabs if that is possible without changing
868 indentation.  `M-x untabify' changes all tabs in the region to
869 corresponding numbers of spaces.
870
871 \1f
872 File: xemacs.info,  Node: Text,  Next: Programs,  Prev: Indentation,  Up: Top
873
874 Commands for Human Languages
875 ****************************
876
877    The term "text" has two widespread meanings in our area of the
878 computer field.  One is data that is a sequence of characters.  In this
879 sense of the word any file that you edit with Emacs is text.  The other
880 meaning is more restrictive: a sequence of characters in a human
881 language for humans to read (possibly after processing by a text
882 formatter), as opposed to a program or commands for a program.
883
884    Human languages have syntactic and stylistic conventions that editor
885 commands should support or use to advantage: conventions involving
886 words, sentences, paragraphs, and capital letters.  This chapter
887 describes Emacs commands for all these things.  There are also commands
888 for "filling", or rearranging paragraphs into lines of approximately
889 equal length.  The commands for moving over and killing words,
890 sentences, and paragraphs, while intended primarily for editing text,
891 are also often useful for editing programs.
892
893    Emacs has several major modes for editing human language text.  If a
894 file contains plain text, use Text mode, which customizes Emacs in
895 small ways for the syntactic conventions of text.  For text which
896 contains embedded commands for text formatters, Emacs has other major
897 modes, each for a particular text formatter.  Thus, for input to TeX,
898 you can use TeX mode; for input to nroff, Nroff mode.
899
900 * Menu:
901
902 * Text Mode::   The major modes for editing text files.
903 * Nroff Mode::  The major mode for editing input to the formatter nroff.
904 * TeX Mode::    The major modes for editing input to the formatter TeX.
905 * Outline Mode:: The major mode for editing outlines.
906 * Words::       Moving over and killing words.
907 * Sentences::   Moving over and killing sentences.
908 * Paragraphs::  Moving over paragraphs.
909 * Pages::       Moving over pages.
910 * Filling::     Filling or justifying text
911 * Case::        Changing the case of text
912
913 \1f
914 File: xemacs.info,  Node: Text Mode,  Next: Words,  Prev: Text,  Up: Text
915
916 Text Mode
917 =========
918
919    You should use Text mode--rather than Fundamental or Lisp mode--to
920 edit files of text in a human language.  Invoke `M-x text-mode' to
921 enter Text mode.  In Text mode, <TAB> runs the function
922 `tab-to-tab-stop', which allows you to use arbitrary tab stops set with
923 `M-x edit-tab-stops' (*note Tab Stops::).  Features concerned with
924 comments in programs are turned off unless they are explicitly invoked.
925 The syntax table is changed so that periods are not considered part of a
926 word, while apostrophes, backspaces and underlines are.
927
928    A similar variant mode is Indented Text mode, intended for editing
929 text in which most lines are indented.  This mode defines <TAB> to run
930 `indent-relative' (*note Indentation::), and makes Auto Fill indent the
931 lines it creates.  As a result, a line made by Auto Filling, or by
932 <LFD>, is normally indented just like the previous line.  Use `M-x
933 indented-text-mode' to select this mode.
934
935    Entering Text mode or Indented Text mode calls the value of the
936 variable `text-mode-hook' with no arguments, if that value exists and
937 is not `nil'.  This value is also called when modes related to Text
938 mode are entered; this includes Nroff mode, TeX mode, Outline mode, and
939 Mail mode.  Your hook can look at the value of `major-mode' to see
940 which of these modes is actually being entered.
941
942    Two modes similar to Text mode are of use for editing text that is to
943 be passed through a text formatter before achieving its final readable
944 form.
945
946 * Menu:
947
948 * Nroff Mode::  The major mode for editing input to the formatter nroff.
949 * TeX Mode::    The major modes for editing input to the formatter TeX.
950
951
952   Another similar mode is used for editing outlines.  It allows you
953 to view the text at various levels of detail.  You can view either
954 the outline headings alone or both headings and text; you can also
955 hide some of the headings at lower levels from view to make the high
956 level structure more visible.
957
958
959 * Outline Mode:: The major mode for editing outlines.
960
961 \1f
962 File: xemacs.info,  Node: Nroff Mode,  Next: TeX Mode,  Prev: Text Mode,  Up: Text Mode
963
964 Nroff Mode
965 ----------
966
967    Nroff mode is a mode like Text mode but modified to handle nroff
968 commands present in the text.  Invoke `M-x nroff-mode' to enter this
969 mode.  Nroff mode differs from Text mode in only a few ways.  All nroff
970 command lines are considered paragraph separators, so that filling never
971 garbles the nroff commands.  Pages are separated by `.bp' commands.
972 Comments start with backslash-doublequote.  There are also three special
973 commands that are not available in Text mode:
974
975 `M-n'
976      Move to the beginning of the next line that isn't an nroff command
977      (`forward-text-line').  An argument is a repeat count.
978
979 `M-p'
980      Like `M-n' but move up (`backward-text-line').
981
982 `M-?'
983      Prints in the echo area the number of text lines (lines that are
984      not nroff commands) in the region (`count-text-lines').
985
986    The other feature of Nroff mode is Electric Nroff newline mode.
987 This is a minor mode that you can turn on or off with `M-x
988 electric-nroff-mode' (*note Minor Modes::).  When the mode is on and
989 you use <RET> to end a line containing an nroff command that opens a
990 kind of grouping, Emacs automatically inserts the matching nroff
991 command to close that grouping on the following line.  For example, if
992 you are at the beginning of a line and type `.(b <RET>', the matching
993 command `.)b' will be inserted on a new line following point.
994
995    Entering Nroff mode calls the value of the variable `text-mode-hook'
996 with no arguments, if that value exists and is not `nil'; then it does
997 the same with the variable `nroff-mode-hook'.
998
999 \1f
1000 File: xemacs.info,  Node: TeX Mode,  Next: Outline Mode,  Prev: Nroff Mode,  Up: Text Mode
1001
1002 TeX Mode
1003 --------
1004
1005    TeX is a powerful text formatter written by Donald Knuth; like GNU
1006 Emacs, it is free.  LaTeX is a simplified input format for TeX,
1007 implemented by TeX macros.  It is part of TeX.
1008
1009    Emacs has a special TeX mode for editing TeX input files.  It
1010 provides facilities for checking the balance of delimiters and for
1011 invoking TeX on all or part of the file.
1012
1013    TeX mode has two variants, Plain TeX mode and LaTeX mode, which are
1014 two distinct major modes that differ only slightly.  These modes are
1015 designed for editing the two different input formats.  The command `M-x
1016 tex-mode' looks at the contents of a buffer to determine whether it
1017 appears to be LaTeX input or not; it then selects the appropriate mode.
1018 If it can't tell which is right (e.g., the buffer is empty), the
1019 variable `tex-default-mode' controls which mode is used.
1020
1021    The commands `M-x plain-tex-mode' and `M-x latex-mode' explicitly
1022 select one of the variants of TeX mode.  Use these commands when `M-x
1023 tex-mode' does not guess right.
1024
1025 * Menu:
1026
1027 * Editing: TeX Editing.   Special commands for editing in TeX mode.
1028 * Printing: TeX Print.    Commands for printing part of a file with TeX.
1029
1030    TeX for Unix systems can be obtained from the University of
1031 Washington for a distribution fee.
1032
1033    To order a full distribution, send $140.00 for a 1/2 inch 9-track
1034 tape, $165.00 for two 4-track 1/4 inch cartridge tapes (foreign sites
1035 $150.00, for 1/2 inch, $175.00 for 1/4 inch, to cover the extra
1036 postage) payable to the University of Washington to:
1037
1038      The Director
1039      Northwest Computer Support Group,  DW-10
1040      University of Washington
1041      Seattle, Washington 98195
1042
1043 Purchase orders are acceptable, but there is an extra charge of $10.00
1044 to pay for processing charges. (The total cost comes to $150 for
1045 domestic sites, $175 for foreign sites).
1046
1047    The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
1048 industry standard 2400 foot half-inch reel.  The physical format for
1049 the 1/4 inch streamer cartridges uses QIC-11, 8000 bpi, 4-track
1050 serpentine recording for the SUN.  Also, SystemV tapes can be written
1051 in cpio format, blocked 5120 bytes, ASCII headers.
1052
1053 \1f
1054 File: xemacs.info,  Node: TeX Editing,  Next: TeX Print,  Prev: TeX Mode,  Up: TeX Mode
1055
1056 TeX Editing Commands
1057 ....................
1058
1059    Here are the special commands provided in TeX mode for editing the
1060 text of the file.
1061
1062 `"'
1063      Insert, according to context, either ```' or `"' or `'''
1064      (`TeX-insert-quote').
1065
1066 `<LFD>'
1067      Insert a paragraph break (two newlines) and check the previous
1068      paragraph for unbalanced braces or dollar signs (`tex-terminate-
1069      paragraph').
1070
1071 `M-x validate-tex-buffer'
1072      Check each paragraph in the buffer for unbalanced braces or dollar
1073      signs.
1074
1075 `C-c {'
1076      Insert `{}' and position point between them (`tex-insert-braces').
1077
1078 `C-c }'
1079      Move forward past the next unmatched close brace (`up-list').
1080
1081 `C-c C-e'
1082      Close a block for LaTeX (`tex-close-latex-block').
1083
1084    In TeX, the character `"' is not normally used; you use ```' to
1085 start a quotation and `''' to end one.  TeX mode defines the key `"' to
1086 insert ```' after whitespace or an open brace, `"' after a backslash,
1087 or `''' otherwise.  This is done by the command `tex-insert-quote'.  If
1088 you need the character `"' itself in unusual contexts, use `C-q' to
1089 insert it.  Also, `"' with a numeric argument always inserts that
1090 number of `"' characters.
1091
1092    In TeX mode, `$' has a special syntax code which attempts to
1093 understand the way TeX math mode delimiters match.  When you insert a
1094 `$' that is meant to exit math mode, the position of the matching `$'
1095 that entered math mode is displayed for a second.  This is the same
1096 feature that displays the open brace that matches a close brace that is
1097 inserted.  However, there is no way to tell whether a `$' enters math
1098 mode or leaves it; so when you insert a `$' that enters math mode, the
1099 previous `$' position is shown as if it were a match, even though they
1100 are actually unrelated.
1101
1102    If you prefer to keep braces balanced at all times, you can use `C-c
1103 {' (`tex-insert-braces') to insert a pair of braces.  It leaves point
1104 between the two braces so you can insert the text that belongs inside.
1105 Afterward, use the command `C-c }' (`up-list') to move forward past the
1106 close brace.
1107
1108    There are two commands for checking the matching of braces.  <LFD>
1109 (`tex-terminate-paragraph') checks the paragraph before point, and
1110 inserts two newlines to start a new paragraph.  It prints a message in
1111 the echo area if any mismatch is found.  `M-x validate-tex-buffer'
1112 checks the entire buffer, paragraph by paragraph.  When it finds a
1113 paragraph that contains a mismatch, it displays point at the beginning
1114 of the paragraph for a few seconds and pushes a mark at that spot.
1115 Scanning continues until the whole buffer has been checked or until you
1116 type another key.  The positions of the last several paragraphs with
1117 mismatches can be found in the mark ring (*note Mark Ring::).
1118
1119    Note that square brackets and parentheses, not just braces, are
1120 matched in TeX mode.  This is wrong if you want to  check TeX syntax.
1121 However, parentheses and square brackets are likely to be used in text
1122 as matching delimiters and it is useful for the various motion commands
1123 and automatic match display to work with them.
1124
1125    In LaTeX input, `\begin' and `\end' commands must balance.  After
1126 you insert a `\begin', use `C-c C-f' (`tex-close-latex-block') to
1127 insert automatically a matching `\end' (on a new line following the
1128 `\begin').  A blank line is inserted between the two, and point is left
1129 there.
1130