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