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