]> code.delx.au - gnu-emacs/blob - doc/emacs/text.texi
Quote less in manuals
[gnu-emacs] / doc / emacs / text.texi
1 @c This is part of the Emacs manual.
2 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2015 Free Software
3 @c Foundation, Inc.
4 @c See file emacs.texi for copying conditions.
5 @node Text
6 @chapter Commands for Human Languages
7 @cindex text
8 @cindex manipulating text
9
10 This chapter describes Emacs commands that act on @dfn{text}, by
11 which we mean sequences of characters in a human language (as opposed
12 to, say, a computer programming language). These commands act in ways
13 that take into account the syntactic and stylistic conventions of
14 human languages: conventions involving words, sentences, paragraphs,
15 and capital letters. There are also commands for @dfn{filling}, which
16 means rearranging the lines of a paragraph to be approximately equal
17 in length. These commands, while intended primarily for editing text,
18 are also often useful for editing programs.
19
20 Emacs has several major modes for editing human-language text. If
21 the file contains ordinary text, use Text mode, which customizes Emacs
22 in small ways for the syntactic conventions of text. Outline mode
23 provides special commands for operating on text with an outline
24 structure. Org mode extends Outline mode and turn Emacs into a
25 full-fledged organizer: you can manage TODO lists, store notes and
26 publish them in many formats.
27
28 @iftex
29 @xref{Outline Mode}.
30 @end iftex
31
32 @cindex nXML mode
33 @cindex mode, XML
34 @cindex mode, nXML
35 @findex nxml-mode
36 Emacs has other major modes for text which contains embedded
37 commands, such as @TeX{} and @LaTeX{} (@pxref{TeX Mode}); HTML and
38 SGML (@pxref{HTML Mode}); XML
39 @ifinfo
40 (@pxref{Top,The nXML Mode Manual,,nxml-mode, nXML Mode});
41 @end ifinfo
42 @ifnotinfo
43 (see the nXML mode Info manual, which is distributed with Emacs);
44 @end ifnotinfo
45 and Groff and Nroff (@pxref{Nroff Mode}).
46
47 @cindex ASCII art
48 If you need to edit ASCII art pictures made out of text characters,
49 use Picture mode, a special major mode for editing such pictures.
50 @iftex
51 @xref{Picture Mode,,, emacs-xtra, Specialized Emacs Features}.
52 @end iftex
53 @ifnottex
54 @xref{Picture Mode}.
55 @end ifnottex
56
57 @ifinfo
58 @cindex skeletons
59 @cindex templates
60 @cindex autotyping
61 @cindex automatic typing
62 The automatic typing features may be useful when writing text.
63 @inforef{Top,The Autotype Manual,autotype}.
64 @end ifinfo
65
66 @menu
67 * Words:: Moving over and killing words.
68 * Sentences:: Moving over and killing sentences.
69 * Paragraphs:: Moving over paragraphs.
70 * Pages:: Moving over pages.
71 * Quotation Marks:: Inserting quotation marks.
72 * Filling:: Filling or justifying text.
73 * Case:: Changing the case of text.
74 * Text Mode:: The major modes for editing text files.
75 * Outline Mode:: Editing outlines.
76 * Org Mode:: The Emacs organizer.
77 * TeX Mode:: Editing TeX and LaTeX files.
78 * HTML Mode:: Editing HTML and SGML files.
79 * Nroff Mode:: Editing input to the nroff formatter.
80 * Enriched Text:: Editing text enriched with fonts, colors, etc.
81 * Text Based Tables:: Commands for editing text-based tables.
82 * Two-Column:: Splitting text columns into separate windows.
83 @end menu
84
85 @node Words
86 @section Words
87 @cindex words
88 @cindex Meta commands and words
89
90 Emacs defines several commands for moving over or operating on
91 words:
92
93 @table @kbd
94 @item M-f
95 Move forward over a word (@code{forward-word}).
96 @item M-b
97 Move backward over a word (@code{backward-word}).
98 @item M-d
99 Kill up to the end of a word (@code{kill-word}).
100 @item M-@key{DEL}
101 Kill back to the beginning of a word (@code{backward-kill-word}).
102 @item M-@@
103 Mark the end of the next word (@code{mark-word}).
104 @item M-t
105 Transpose two words or drag a word across others
106 (@code{transpose-words}).
107 @end table
108
109 Notice how these keys form a series that parallels the character-based
110 @kbd{C-f}, @kbd{C-b}, @kbd{C-d}, @key{DEL} and @kbd{C-t}. @kbd{M-@@} is
111 cognate to @kbd{C-@@}, which is an alias for @kbd{C-@key{SPC}}.
112
113 @kindex M-f
114 @kindex M-b
115 @findex forward-word
116 @findex backward-word
117 The commands @kbd{M-f} (@code{forward-word}) and @kbd{M-b}
118 (@code{backward-word}) move forward and backward over words. These
119 @key{META}-based key sequences are analogous to the key sequences
120 @kbd{C-f} and @kbd{C-b}, which move over single characters. The
121 analogy extends to numeric arguments, which serve as repeat counts.
122 @kbd{M-f} with a negative argument moves backward, and @kbd{M-b} with
123 a negative argument moves forward. Forward motion stops right after
124 the last letter of the word, while backward motion stops right before
125 the first letter.
126
127 @kindex M-d
128 @findex kill-word
129 @kbd{M-d} (@code{kill-word}) kills the word after point. To be
130 precise, it kills everything from point to the place @kbd{M-f} would
131 move to. Thus, if point is in the middle of a word, @kbd{M-d} kills
132 just the part after point. If some punctuation comes between point
133 and the next word, it is killed along with the word. (If you wish to
134 kill only the next word but not the punctuation before it, simply do
135 @kbd{M-f} to get the end, and kill the word backwards with
136 @kbd{M-@key{DEL}}.) @kbd{M-d} takes arguments just like @kbd{M-f}.
137
138 @findex backward-kill-word
139 @kindex M-DEL
140 @kbd{M-@key{DEL}} (@code{backward-kill-word}) kills the word before
141 point. It kills everything from point back to where @kbd{M-b} would
142 move to. For instance, if point is after the space in @w{@samp{FOO,
143 BAR}}, it kills @w{@samp{FOO, }}. If you wish to kill just
144 @samp{FOO}, and not the comma and the space, use @kbd{M-b M-d} instead
145 of @kbd{M-@key{DEL}}.
146
147 @c Don't index M-t and transpose-words here, they are indexed in
148 @c fixit.texi, in the node "Transpose".
149 @c @kindex M-t
150 @c @findex transpose-words
151 @kbd{M-t} (@code{transpose-words}) exchanges the word before or
152 containing point with the following word. The delimiter characters between
153 the words do not move. For example, @w{@samp{FOO, BAR}} transposes into
154 @w{@samp{BAR, FOO}} rather than @samp{@w{BAR FOO,}}. @xref{Transpose}, for
155 more on transposition.
156
157 @kindex M-@@
158 @findex mark-word
159 To operate on words with an operation which acts on the region, use
160 the command @kbd{M-@@} (@code{mark-word}). This command sets the mark
161 where @kbd{M-f} would move to. @xref{Marking Objects}, for more
162 information about this command.
163
164 The word commands' understanding of word boundaries is controlled by
165 the syntax table. Any character can, for example, be declared to be a
166 word delimiter. @xref{Syntax Tables,, Syntax Tables, elisp, The Emacs
167 Lisp Reference Manual}.
168
169 In addition, see @ref{Position Info} for the @kbd{M-=}
170 (@code{count-words-region}) and @kbd{M-x count-words} commands, which
171 count and report the number of words in the region or buffer.
172
173 @node Sentences
174 @section Sentences
175 @cindex sentences
176 @cindex manipulating sentences
177
178 The Emacs commands for manipulating sentences and paragraphs are
179 mostly on Meta keys, like the word-handling commands.
180
181 @table @kbd
182 @item M-a
183 Move back to the beginning of the sentence (@code{backward-sentence}).
184 @item M-e
185 Move forward to the end of the sentence (@code{forward-sentence}).
186 @item M-k
187 Kill forward to the end of the sentence (@code{kill-sentence}).
188 @item C-x @key{DEL}
189 Kill back to the beginning of the sentence (@code{backward-kill-sentence}).
190 @end table
191
192 @kindex M-a
193 @kindex M-e
194 @findex backward-sentence
195 @findex forward-sentence
196 The commands @kbd{M-a} (@code{backward-sentence}) and @kbd{M-e}
197 (@code{forward-sentence}) move to the beginning and end of the current
198 sentence, respectively. Their bindings were chosen to resemble
199 @kbd{C-a} and @kbd{C-e}, which move to the beginning and end of a
200 line. Unlike them, @kbd{M-a} and @kbd{M-e} move over successive
201 sentences if repeated.
202
203 Moving backward over a sentence places point just before the first
204 character of the sentence; moving forward places point right after the
205 punctuation that ends the sentence. Neither one moves over the
206 whitespace at the sentence boundary.
207
208 @kindex M-k
209 @findex kill-sentence
210 Just as @kbd{C-a} and @kbd{C-e} have a kill command, @kbd{C-k}, to
211 go with them, @kbd{M-a} and @kbd{M-e} have a corresponding kill
212 command: @kbd{M-k} (@code{kill-sentence}) kills from point to the end
213 of the sentence. With a positive numeric argument @var{n}, it kills
214 the next @var{n} sentences; with a negative argument @minus{}@var{n},
215 it kills back to the beginning of the @var{n}th preceding sentence.
216
217 @kindex C-x DEL
218 @findex backward-kill-sentence
219 The @kbd{C-x @key{DEL}} (@code{backward-kill-sentence}) kills back
220 to the beginning of a sentence.
221
222 The sentence commands assume that you follow the American typist's
223 convention of putting two spaces at the end of a sentence. That is, a
224 sentence ends wherever there is a @samp{.}, @samp{?} or @samp{!}
225 followed by the end of a line or two spaces, with any number of
226 @samp{)}, @samp{]}, @samp{'}, or @samp{"} characters allowed in
227 between. A sentence also begins or ends wherever a paragraph begins
228 or ends. It is useful to follow this convention, because it allows
229 the Emacs sentence commands to distinguish between periods that end a
230 sentence and periods that indicate abbreviations.
231
232 @vindex sentence-end-double-space
233 If you want to use just one space between sentences, you can set the
234 variable @code{sentence-end-double-space} to @code{nil} to make the
235 sentence commands stop for single spaces. However, this has a
236 drawback: there is no way to distinguish between periods that end
237 sentences and those that indicate abbreviations. For convenient and
238 reliable editing, we therefore recommend you follow the two-space
239 convention. The variable @code{sentence-end-double-space} also
240 affects filling (@pxref{Fill Commands}).
241
242 @vindex sentence-end
243 The variable @code{sentence-end} controls how to recognize the end
244 of a sentence. If non-@code{nil}, its value should be a regular
245 expression, which is used to match the last few characters of a
246 sentence, together with the whitespace following the sentence
247 (@pxref{Regexps}). If the value is @code{nil}, the default, then
248 Emacs computes sentence ends according to various criteria such as the
249 value of @code{sentence-end-double-space}.
250
251 @vindex sentence-end-without-period
252 Some languages, such as Thai, do not use periods to indicate the end
253 of a sentence. Set the variable @code{sentence-end-without-period} to
254 @code{t} in such cases.
255
256 @node Paragraphs
257 @section Paragraphs
258 @cindex paragraphs
259 @cindex manipulating paragraphs
260
261 The Emacs commands for manipulating paragraphs are also on Meta keys.
262
263 @table @kbd
264 @item M-@{
265 Move back to previous paragraph beginning (@code{backward-paragraph}).
266 @item M-@}
267 Move forward to next paragraph end (@code{forward-paragraph}).
268 @item M-h
269 Put point and mark around this or next paragraph (@code{mark-paragraph}).
270 @end table
271
272 @kindex M-@{
273 @kindex M-@}
274 @findex backward-paragraph
275 @findex forward-paragraph
276 @kbd{M-@{} (@code{backward-paragraph}) moves to the beginning of the
277 current or previous paragraph (see below for the definition of a
278 paragraph). @kbd{M-@}} (@code{forward-paragraph}) moves to the end of
279 the current or next paragraph. If there is a blank line before the
280 paragraph, @kbd{M-@{} moves to the blank line.
281
282 @kindex M-h
283 @findex mark-paragraph
284 When you wish to operate on a paragraph, type @kbd{M-h}
285 (@code{mark-paragraph}) to set the region around it. For example,
286 @kbd{M-h C-w} kills the paragraph around or after point. @kbd{M-h}
287 puts point at the beginning and mark at the end of the paragraph point
288 was in. If point is between paragraphs (in a run of blank lines, or
289 at a boundary), @kbd{M-h} sets the region around the paragraph
290 following point. If there are blank lines preceding the first line of
291 the paragraph, one of these blank lines is included in the region. If
292 the region is already active, the command sets the mark without
293 changing point, and each subsequent @kbd{M-h} further advances the
294 mark by one paragraph.
295
296 The definition of a paragraph depends on the major mode. In
297 Fundamental mode, as well as Text mode and related modes, a paragraph
298 is separated each neighboring paragraph another by one or more
299 @dfn{blank lines}---lines that are either empty, or consist solely of
300 space, tab and/or formfeed characters. In programming language modes,
301 paragraphs are usually defined in a similar way, so that you can use
302 the paragraph commands even though there are no paragraphs as such in
303 a program.
304
305 Note that an indented line is @emph{not} itself a paragraph break in
306 Text mode. If you want indented lines to separate paragraphs, use
307 Paragraph-Indent Text mode instead. @xref{Text Mode}.
308
309 If you set a fill prefix, then paragraphs are delimited by all lines
310 which don't start with the fill prefix. @xref{Filling}.
311
312 @vindex paragraph-start
313 @vindex paragraph-separate
314 The precise definition of a paragraph boundary is controlled by the
315 variables @code{paragraph-separate} and @code{paragraph-start}. The
316 value of @code{paragraph-start} is a regular expression that should
317 match lines that either start or separate paragraphs
318 (@pxref{Regexps}). The value of @code{paragraph-separate} is another
319 regular expression that should match lines that separate paragraphs
320 without being part of any paragraph (for example, blank lines). Lines
321 that start a new paragraph and are contained in it must match only
322 @code{paragraph-start}, not @code{paragraph-separate}. For example,
323 in Fundamental mode, @code{paragraph-start} is @w{@code{"\f\\|[
324 \t]*$"}}, and @code{paragraph-separate} is @w{@code{"[ \t\f]*$"}}.
325
326 @node Pages
327 @section Pages
328
329 @cindex pages
330 @cindex formfeed character
331 Within some text files, text is divided into @dfn{pages} delimited
332 by the @dfn{formfeed character} (@acronym{ASCII} code 12, also denoted
333 as @samp{control-L}), which is displayed in Emacs as the escape
334 sequence @samp{^L} (@pxref{Text Display}). Traditionally, when such
335 text files are printed to hardcopy, each formfeed character forces a
336 page break. Most Emacs commands treat it just like any other
337 character, so you can insert it with @kbd{C-q C-l}, delete it with
338 @key{DEL}, etc. In addition, Emacs provides commands to move over
339 pages and operate on them.
340
341 @table @kbd
342 @item M-x what-page
343 Display the page number of point, and the line number within that page.
344 @item C-x [
345 Move point to previous page boundary (@code{backward-page}).
346 @item C-x ]
347 Move point to next page boundary (@code{forward-page}).
348 @item C-x C-p
349 Put point and mark around this page (or another page) (@code{mark-page}).
350 @item C-x l
351 Count the lines in this page (@code{count-lines-page}).
352 @end table
353
354 @findex what-page
355 @kbd{M-x what-page} counts pages from the beginning of the file, and
356 counts lines within the page, showing both numbers in the echo area.
357
358 @kindex C-x [
359 @kindex C-x ]
360 @findex forward-page
361 @findex backward-page
362 The @kbd{C-x [} (@code{backward-page}) command moves point to immediately
363 after the previous page delimiter. If point is already right after a page
364 delimiter, it skips that one and stops at the previous one. A numeric
365 argument serves as a repeat count. The @kbd{C-x ]} (@code{forward-page})
366 command moves forward past the next page delimiter.
367
368 @kindex C-x C-p
369 @findex mark-page
370 The @kbd{C-x C-p} command (@code{mark-page}) puts point at the
371 beginning of the current page (after that page delimiter at the
372 front), and the mark at the end of the page (after the page delimiter
373 at the end).
374
375 @kbd{C-x C-p C-w} is a handy way to kill a page to move it
376 elsewhere. If you move to another page delimiter with @kbd{C-x [} and
377 @kbd{C-x ]}, then yank the killed page, all the pages will be properly
378 delimited once again. The reason @kbd{C-x C-p} includes only the
379 following page delimiter in the region is to ensure that.
380
381 A numeric argument to @kbd{C-x C-p} specifies which page to go to,
382 relative to the current one. Zero means the current page, one
383 the next page, and @minus{}1 the previous one.
384
385 @kindex C-x l
386 @findex count-lines-page
387 The @kbd{C-x l} command (@code{count-lines-page}) is good for deciding
388 where to break a page in two. It displays in the echo area the total number
389 of lines in the current page, and then divides it up into those preceding
390 the current line and those following, as in
391
392 @example
393 Page has 96 (72+25) lines
394 @end example
395
396 @noindent
397 Notice that the sum is off by one; this is correct if point is not at the
398 beginning of a line.
399
400 @vindex page-delimiter
401 The variable @code{page-delimiter} controls where pages begin. Its
402 value is a regular expression that matches the beginning of a line
403 that separates pages (@pxref{Regexps}). The normal value of this
404 variable is @code{"^\f"}, which matches a formfeed character at the
405 beginning of a line.
406
407 @node Quotation Marks
408 @section Quotation Marks
409 @cindex Quotation marks
410 @cindex Electric Quote mode
411 @cindex mode, Electric Quote
412 @cindex curly quotes
413 @cindex curved quotes
414 @findex electric-quote-mode
415 One common way to quote is the typewriter convention, which quotes
416 using straight apostrophes @t{'like this'} or double-quotes @t{"like
417 this"}. Another common way is the curved quote convention, which uses
418 left and right single or double quotation marks @t{‘like this’} or
419 @t{“like this”}. Typewriter quotes are simple and portable; curved
420 quotes are less ambiguous and typically look nicer.
421
422 Electric Quote mode makes it easier to type curved quotes. As you
423 type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
424 @t{``} to @t{“}, and @t{''} to @t{”}. These conversions are
425 suppressed in buffers whose coding systems cannot represent curved
426 quote characters.
427
428 @vindex electric-quote-paragraph
429 @vindex electric-quote-comment
430 @vindex electric-quote-string
431 You can customize the behavior of Electric Quote mode by customizing
432 variables that control where it is active. It is active in text
433 paragraphs if @code{electric-quote-paragraph} is non-@code{nil}, in
434 programming-language comments if @code{electric-quote-comment} is
435 non-@code{nil}, and in programming-language strings if
436 @code{electric-quote-string} is non-@code{nil}. The default is
437 @code{nil} for @code{electric-quote-string} and @code{t} for the other
438 variables.
439
440 Electric Quote mode is disabled by default. To toggle it, type
441 @kbd{M-x electric-quote-mode}. To toggle it in a single buffer, use
442 @kbd{M-x electric-quote-local-mode}. To suppress it for a single use,
443 type @kbd{C-q `} or @kbd{C-q '} instead of @kbd{`} or @kbd{'}. To
444 insert a curved quote even when Electric Quote is disabled or
445 inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
446 @t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
447 @xref{Inserting Text}.
448
449 @node Filling
450 @section Filling Text
451 @cindex filling text
452
453 @dfn{Filling} text means breaking it up into lines that fit a
454 specified width. Emacs does filling in two ways. In Auto Fill mode,
455 inserting text with self-inserting characters also automatically fills
456 it. There are also explicit fill commands that you can use when editing
457 text.
458
459 @menu
460 * Auto Fill:: Auto Fill mode breaks long lines automatically.
461 * Fill Commands:: Commands to refill paragraphs and center lines.
462 * Fill Prefix:: Filling paragraphs that are indented or in a comment, etc.
463 * Adaptive Fill:: How Emacs can determine the fill prefix automatically.
464 @end menu
465
466 @node Auto Fill
467 @subsection Auto Fill Mode
468 @cindex Auto Fill mode
469 @cindex mode, Auto Fill
470
471 @dfn{Auto Fill} mode is a buffer-local minor mode (@pxref{Minor
472 Modes}) in which lines are broken automatically when they become too
473 wide. Breaking happens only when you type a @key{SPC} or @key{RET}.
474
475 @table @kbd
476 @item M-x auto-fill-mode
477 Enable or disable Auto Fill mode.
478 @item @key{SPC}
479 @itemx @key{RET}
480 In Auto Fill mode, break lines when appropriate.
481 @end table
482
483 @findex auto-fill-mode
484 The mode command @kbd{M-x auto-fill-mode} toggles Auto Fill mode in
485 the current buffer. With a positive numeric argument, it enables Auto
486 Fill mode, and with a negative argument it disables it. If
487 @code{auto-fill-mode} is called from Lisp with an omitted or
488 @code{nil} argument, it enables Auto Fill mode. To enable Auto Fill
489 mode automatically in certain major modes, add @code{auto-fill-mode}
490 to the mode hooks (@pxref{Major Modes}). When Auto Fill mode is
491 enabled, the mode indicator @samp{Fill} appears in the mode line
492 (@pxref{Mode Line}).
493
494 Auto Fill mode breaks lines automatically at spaces whenever they
495 get longer than the desired width. This line breaking occurs only
496 when you type @key{SPC} or @key{RET}. If you wish to insert a space
497 or newline without permitting line-breaking, type @kbd{C-q @key{SPC}}
498 or @kbd{C-q C-j} respectively. Also, @kbd{C-o} inserts a newline
499 without line breaking.
500
501 When Auto Fill mode breaks a line, it tries to obey the
502 @dfn{adaptive fill prefix}: if a fill prefix can be deduced from the
503 first and/or second line of the current paragraph, it is inserted into
504 the new line (@pxref{Adaptive Fill}). Otherwise the new line is
505 indented, as though you had typed @key{TAB} on it
506 (@pxref{Indentation}). In a programming language mode, if a line is
507 broken in the middle of a comment, the comment is split by inserting
508 new comment delimiters as appropriate.
509
510 Auto Fill mode does not refill entire paragraphs; it breaks lines
511 but does not merge lines. Therefore, editing in the middle of a
512 paragraph can result in a paragraph that is not correctly filled. To
513 fill it, call the explicit fill commands
514 @iftex
515 described in the next section.
516 @end iftex
517 @ifnottex
518 (@pxref{Fill Commands}).
519 @end ifnottex
520
521 @node Fill Commands
522 @subsection Explicit Fill Commands
523
524 @table @kbd
525 @item M-q
526 Fill current paragraph (@code{fill-paragraph}).
527 @item C-x f
528 Set the fill column (@code{set-fill-column}).
529 @item M-x fill-region
530 Fill each paragraph in the region (@code{fill-region}).
531 @item M-x fill-region-as-paragraph
532 Fill the region, considering it as one paragraph.
533 @item M-o M-s
534 Center a line.
535 @end table
536
537 @kindex M-q
538 @findex fill-paragraph
539 The command @kbd{M-q} (@code{fill-paragraph}) @dfn{fills} the
540 current paragraph. It redistributes the line breaks within the
541 paragraph, and deletes any excess space and tab characters occurring
542 within the paragraph, in such a way that the lines end up fitting
543 within a certain maximum width.
544
545 @findex fill-region
546 Normally, @kbd{M-q} acts on the paragraph where point is, but if
547 point is between paragraphs, it acts on the paragraph after point. If
548 the region is active, it acts instead on the text in the region. You
549 can also call @kbd{M-x fill-region} to specifically fill the text in
550 the region.
551
552 @findex fill-region-as-paragraph
553 @kbd{M-q} and @code{fill-region} use the usual Emacs criteria for
554 finding paragraph boundaries (@pxref{Paragraphs}). For more control,
555 you can use @kbd{M-x fill-region-as-paragraph}, which refills
556 everything between point and mark as a single paragraph. This command
557 deletes any blank lines within the region, so separate blocks of text
558 end up combined into one block.
559
560 @cindex justification
561 A numeric argument to @kbd{M-q} tells it to @dfn{justify} the text
562 as well as filling it. This means that extra spaces are inserted to
563 make the right margin line up exactly at the fill column. To remove
564 the extra spaces, use @kbd{M-q} with no argument. (Likewise for
565 @code{fill-region}.)
566
567 @vindex fill-column
568 @kindex C-x f
569 @findex set-fill-column
570 The maximum line width for filling is specified by the buffer-local
571 variable @code{fill-column}. The default value (@pxref{Locals}) is
572 70. The easiest way to set @code{fill-column} in the current buffer
573 is to use the command @kbd{C-x f} (@code{set-fill-column}). With a
574 numeric argument, it uses that as the new fill column. With just
575 @kbd{C-u} as argument, it sets @code{fill-column} to the current
576 horizontal position of point.
577
578 @kindex M-o M-s @r{(Text mode)}
579 @cindex centering
580 @findex center-line
581 The command @kbd{M-o M-s} (@code{center-line}) centers the current line
582 within the current fill column. With an argument @var{n}, it centers
583 @var{n} lines individually and moves past them. This binding is
584 made by Text mode and is available only in that and related modes
585 (@pxref{Text Mode}).
586
587 By default, Emacs considers a period followed by two spaces or by a
588 newline as the end of a sentence; a period followed by just one space
589 indicates an abbreviation, not the end of a sentence. Accordingly,
590 the fill commands will not break a line after a period followed by
591 just one space. If you set the variable
592 @code{sentence-end-double-space} to @code{nil}, the fill commands will
593 break a line after a period followed by one space, and put just one
594 space after each period. @xref{Sentences}, for other effects and
595 possible drawbacks of this.
596
597 @vindex colon-double-space
598 If the variable @code{colon-double-space} is non-@code{nil}, the
599 fill commands put two spaces after a colon.
600
601 @vindex fill-nobreak-predicate
602 To specify additional conditions where line-breaking is not allowed,
603 customize the abnormal hook variable @code{fill-nobreak-predicate}
604 (@pxref{Hooks}). Each function in this hook is called with no
605 arguments, with point positioned where Emacs is considering breaking a
606 line. If a function returns a non-@code{nil} value, Emacs will not
607 break the line there. Functions you can use there include:
608 @code{fill-single-word-nobreak-p} (don't break after the first word of
609 a sentence or before the last); @code{fill-single-char-nobreak-p}
610 (don't break after a one-letter word); and @code{fill-french-nobreak-p}
611 (don't break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}).
612
613 @node Fill Prefix
614 @subsection The Fill Prefix
615
616 @cindex fill prefix
617 The @dfn{fill prefix} feature allows paragraphs to be filled so that
618 each line starts with a special string of characters (such as a
619 sequence of spaces, giving an indented paragraph). You can specify a
620 fill prefix explicitly; otherwise, Emacs tries to deduce one
621 automatically (@pxref{Adaptive Fill}).
622
623 @table @kbd
624 @item C-x .
625 Set the fill prefix (@code{set-fill-prefix}).
626 @item M-q
627 Fill a paragraph using current fill prefix (@code{fill-paragraph}).
628 @item M-x fill-individual-paragraphs
629 Fill the region, considering each change of indentation as starting a
630 new paragraph.
631 @item M-x fill-nonuniform-paragraphs
632 Fill the region, considering only paragraph-separator lines as starting
633 a new paragraph.
634 @end table
635
636 @kindex C-x .
637 @findex set-fill-prefix
638 To specify a fill prefix for the current buffer, move to a line that
639 starts with the desired prefix, put point at the end of the prefix,
640 and type @w{@kbd{C-x .}}@: (@code{set-fill-prefix}). (That's a period
641 after the @kbd{C-x}.) To turn off the fill prefix, specify an empty
642 prefix: type @w{@kbd{C-x .}}@: with point at the beginning of a line.
643
644 When a fill prefix is in effect, the fill commands remove the fill
645 prefix from each line of the paragraph before filling, and insert it
646 on each line after filling. (The beginning of the first line of the
647 paragraph is left unchanged, since often that is intentionally
648 different.) Auto Fill mode also inserts the fill prefix automatically
649 when it makes a new line (@pxref{Auto Fill}). The @kbd{C-o} command
650 inserts the fill prefix on new lines it creates, when you use it at
651 the beginning of a line (@pxref{Blank Lines}). Conversely, the
652 command @kbd{M-^} deletes the prefix (if it occurs) after the newline
653 that it deletes (@pxref{Indentation}).
654
655 For example, if @code{fill-column} is 40 and you set the fill prefix
656 to @samp{;; }, then @kbd{M-q} in the following text
657
658 @example
659 ;; This is an
660 ;; example of a paragraph
661 ;; inside a Lisp-style comment.
662 @end example
663
664 @noindent
665 produces this:
666
667 @example
668 ;; This is an example of a paragraph
669 ;; inside a Lisp-style comment.
670 @end example
671
672 Lines that do not start with the fill prefix are considered to start
673 paragraphs, both in @kbd{M-q} and the paragraph commands; this gives
674 good results for paragraphs with hanging indentation (every line
675 indented except the first one). Lines which are blank or indented once
676 the prefix is removed also separate or start paragraphs; this is what
677 you want if you are writing multi-paragraph comments with a comment
678 delimiter on each line.
679
680 @findex fill-individual-paragraphs
681 You can use @kbd{M-x fill-individual-paragraphs} to set the fill
682 prefix for each paragraph automatically. This command divides the
683 region into paragraphs, treating every change in the amount of
684 indentation as the start of a new paragraph, and fills each of these
685 paragraphs. Thus, all the lines in one paragraph have the same
686 amount of indentation. That indentation serves as the fill prefix for
687 that paragraph.
688
689 @findex fill-nonuniform-paragraphs
690 @kbd{M-x fill-nonuniform-paragraphs} is a similar command that divides
691 the region into paragraphs in a different way. It considers only
692 paragraph-separating lines (as defined by @code{paragraph-separate}) as
693 starting a new paragraph. Since this means that the lines of one
694 paragraph may have different amounts of indentation, the fill prefix
695 used is the smallest amount of indentation of any of the lines of the
696 paragraph. This gives good results with styles that indent a paragraph's
697 first line more or less that the rest of the paragraph.
698
699 @vindex fill-prefix
700 The fill prefix is stored in the variable @code{fill-prefix}. Its value
701 is a string, or @code{nil} when there is no fill prefix. This is a
702 per-buffer variable; altering the variable affects only the current buffer,
703 but there is a default value which you can change as well. @xref{Locals}.
704
705 The @code{indentation} text property provides another way to control
706 the amount of indentation paragraphs receive. @xref{Enriched
707 Indentation}.
708
709 @node Adaptive Fill
710 @subsection Adaptive Filling
711
712 @cindex adaptive filling
713 The fill commands can deduce the proper fill prefix for a paragraph
714 automatically in certain cases: either whitespace or certain punctuation
715 characters at the beginning of a line are propagated to all lines of the
716 paragraph.
717
718 If the paragraph has two or more lines, the fill prefix is taken from
719 the paragraph's second line, but only if it appears on the first line as
720 well.
721
722 If a paragraph has just one line, fill commands @emph{may} take a
723 prefix from that line. The decision is complicated because there are
724 three reasonable things to do in such a case:
725
726 @itemize @bullet
727 @item
728 Use the first line's prefix on all the lines of the paragraph.
729
730 @item
731 Indent subsequent lines with whitespace, so that they line up under the
732 text that follows the prefix on the first line, but don't actually copy
733 the prefix from the first line.
734
735 @item
736 Don't do anything special with the second and following lines.
737 @end itemize
738
739 All three of these styles of formatting are commonly used. So the
740 fill commands try to determine what you would like, based on the prefix
741 that appears and on the major mode. Here is how.
742
743 @vindex adaptive-fill-first-line-regexp
744 If the prefix found on the first line matches
745 @code{adaptive-fill-first-line-regexp}, or if it appears to be a
746 comment-starting sequence (this depends on the major mode), then the
747 prefix found is used for filling the paragraph, provided it would not
748 act as a paragraph starter on subsequent lines.
749
750 Otherwise, the prefix found is converted to an equivalent number of
751 spaces, and those spaces are used as the fill prefix for the rest of the
752 lines, provided they would not act as a paragraph starter on subsequent
753 lines.
754
755 In Text mode, and other modes where only blank lines and page
756 delimiters separate paragraphs, the prefix chosen by adaptive filling
757 never acts as a paragraph starter, so it can always be used for filling.
758
759 @vindex adaptive-fill-mode
760 @vindex adaptive-fill-regexp
761 The variable @code{adaptive-fill-regexp} determines what kinds of line
762 beginnings can serve as a fill prefix: any characters at the start of
763 the line that match this regular expression are used. If you set the
764 variable @code{adaptive-fill-mode} to @code{nil}, the fill prefix is
765 never chosen automatically.
766
767 @vindex adaptive-fill-function
768 You can specify more complex ways of choosing a fill prefix
769 automatically by setting the variable @code{adaptive-fill-function} to a
770 function. This function is called with point after the left margin of a
771 line, and it should return the appropriate fill prefix based on that
772 line. If it returns @code{nil}, @code{adaptive-fill-regexp} gets
773 a chance to find a prefix.
774
775 @node Case
776 @section Case Conversion Commands
777 @cindex case conversion
778
779 Emacs has commands for converting either a single word or any arbitrary
780 range of text to upper case or to lower case.
781
782 @table @kbd
783 @item M-l
784 Convert following word to lower case (@code{downcase-word}).
785 @item M-u
786 Convert following word to upper case (@code{upcase-word}).
787 @item M-c
788 Capitalize the following word (@code{capitalize-word}).
789 @item C-x C-l
790 Convert region to lower case (@code{downcase-region}).
791 @item C-x C-u
792 Convert region to upper case (@code{upcase-region}).
793 @end table
794
795 @kindex M-l
796 @kindex M-u
797 @kindex M-c
798 @cindex words, case conversion
799 @cindex converting text to upper or lower case
800 @cindex capitalizing words
801 @findex downcase-word
802 @findex upcase-word
803 @findex capitalize-word
804 @kbd{M-l} (@code{downcase-word}) converts the word after point to
805 lower case, moving past it. Thus, repeating @kbd{M-l} converts
806 successive words. @kbd{M-u} (@code{upcase-word}) converts to all
807 capitals instead, while @kbd{M-c} (@code{capitalize-word}) puts the
808 first letter of the word into upper case and the rest into lower case.
809 All these commands convert several words at once if given an argument.
810 They are especially convenient for converting a large amount of text
811 from all upper case to mixed case, because you can move through the
812 text using @kbd{M-l}, @kbd{M-u} or @kbd{M-c} on each word as
813 appropriate, occasionally using @kbd{M-f} instead to skip a word.
814
815 When given a negative argument, the word case conversion commands apply
816 to the appropriate number of words before point, but do not move point.
817 This is convenient when you have just typed a word in the wrong case: you
818 can give the case conversion command and continue typing.
819
820 If a word case conversion command is given in the middle of a word,
821 it applies only to the part of the word which follows point. (This is
822 comparable to what @kbd{M-d} (@code{kill-word}) does.) With a
823 negative argument, case conversion applies only to the part of the
824 word before point.
825
826 @kindex C-x C-l
827 @kindex C-x C-u
828 @findex downcase-region
829 @findex upcase-region
830 The other case conversion commands are @kbd{C-x C-u}
831 (@code{upcase-region}) and @kbd{C-x C-l} (@code{downcase-region}), which
832 convert everything between point and mark to the specified case. Point and
833 mark do not move.
834
835 The region case conversion commands @code{upcase-region} and
836 @code{downcase-region} are normally disabled. This means that they ask
837 for confirmation if you try to use them. When you confirm, you may
838 enable the command, which means it will not ask for confirmation again.
839 @xref{Disabling}.
840
841 @node Text Mode
842 @section Text Mode
843 @cindex Text mode
844 @cindex mode, Text
845 @findex text-mode
846
847 Text mode is a major mode for editing files of text in a human
848 language. Files which have names ending in the extension @file{.txt}
849 are usually opened in Text mode (@pxref{Choosing Modes}). To
850 explicitly switch to Text mode, type @kbd{M-x text-mode}.
851
852 In Text mode, only blank lines and page delimiters separate
853 paragraphs. As a result, paragraphs can be indented, and adaptive
854 filling determines what indentation to use when filling a paragraph.
855 @xref{Adaptive Fill}.
856
857 @kindex TAB @r{(Text mode)}
858 In Text mode, the @key{TAB} (@code{indent-for-tab-command}) command
859 usually inserts whitespace up to the next tab stop, instead of
860 indenting the current line. @xref{Indentation}, for details.
861
862 Text mode turns off the features concerned with comments except when
863 you explicitly invoke them. It changes the syntax table so that
864 single-quotes are considered part of words (e.g., @samp{don't} is
865 considered one word). However, if a word starts with a single-quote,
866 it is treated as a prefix for the purposes of capitalization
867 (e.g., @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as
868 expected).
869
870 @cindex Paragraph-Indent Text mode
871 @cindex mode, Paragraph-Indent Text
872 @findex paragraph-indent-text-mode
873 @findex paragraph-indent-minor-mode
874 If you indent the first lines of paragraphs, then you should use
875 Paragraph-Indent Text mode (@kbd{M-x paragraph-indent-text-mode})
876 rather than Text mode. In that mode, you do not need to have blank
877 lines between paragraphs, because the first-line indentation is
878 sufficient to start a paragraph; however paragraphs in which every
879 line is indented are not supported. Use @kbd{M-x
880 paragraph-indent-minor-mode} to enable an equivalent minor mode for
881 situations where you shouldn't change the major mode---in mail
882 composition, for instance.
883
884 @kindex M-TAB @r{(Text mode)}
885 Text mode binds @kbd{M-@key{TAB}} to @code{ispell-complete-word}.
886 This command performs completion of the partial word in the buffer
887 before point, using the spelling dictionary as the space of possible
888 words. @xref{Spelling}. If your window manager defines
889 @kbd{M-@key{TAB}} to switch windows, you can type @kbd{@key{ESC}
890 @key{TAB}} or @kbd{C-M-i} instead.
891
892 @vindex text-mode-hook
893 Entering Text mode runs the mode hook @code{text-mode-hook}
894 (@pxref{Major Modes}).
895
896 The following sections describe several major modes that are
897 @dfn{derived} from Text mode. These derivatives share most of the
898 features of Text mode described above. In particular, derivatives of
899 Text mode run @code{text-mode-hook} prior to running their own mode
900 hooks.
901
902 @node Outline Mode
903 @section Outline Mode
904 @cindex Outline mode
905 @cindex mode, Outline
906 @cindex invisible lines
907
908 @findex outline-mode
909 @findex outline-minor-mode
910 @vindex outline-minor-mode-prefix
911 @vindex outline-mode-hook
912 Outline mode is a major mode derived from Text mode, which is
913 specialized for editing outlines. It provides commands to navigate
914 between entries in the outline structure, and commands to make parts
915 of a buffer temporarily invisible, so that the outline structure may
916 be more easily viewed. Type @kbd{M-x outline-mode} to switch to
917 Outline mode. Entering Outline mode runs the hook
918 @code{text-mode-hook} followed by the hook @code{outline-mode-hook}
919 (@pxref{Hooks}).
920
921 When you use an Outline mode command to make a line invisible
922 (@pxref{Outline Visibility}), the line disappears from the screen. An
923 ellipsis (three periods in a row) is displayed at the end of the
924 previous visible line, to indicate the hidden text. Multiple
925 consecutive invisible lines produce just one ellipsis.
926
927 Editing commands that operate on lines, such as @kbd{C-n} and
928 @kbd{C-p}, treat the text of the invisible line as part of the
929 previous visible line. Killing the ellipsis at the end of a visible
930 line really kills all the following invisible text associated with the
931 ellipsis.
932
933 Outline minor mode is a buffer-local minor mode which provides the
934 same commands as the major mode, Outline mode, but can be used in
935 conjunction with other major modes. You can type @kbd{M-x
936 outline-minor-mode} to toggle Outline minor mode in the current
937 buffer, or use a file-local variable setting to enable it in a
938 specific file (@pxref{File Variables}).
939
940 @kindex C-c @@ @r{(Outline minor mode)}
941 The major mode, Outline mode, provides special key bindings on the
942 @kbd{C-c} prefix. Outline minor mode provides similar bindings with
943 @kbd{C-c @@} as the prefix; this is to reduce the conflicts with the
944 major mode's special commands. (The variable
945 @code{outline-minor-mode-prefix} controls the prefix used.)
946
947 @menu
948 * Outline Format:: What the text of an outline looks like.
949 * Outline Motion:: Special commands for moving through outlines.
950 * Outline Visibility:: Commands to control what is visible.
951 * Outline Views:: Outlines and multiple views.
952 * Foldout:: Folding means zooming in on outlines.
953 @end menu
954
955 @node Outline Format
956 @subsection Format of Outlines
957
958 @cindex heading lines (Outline mode)
959 @cindex body lines (Outline mode)
960 Outline mode assumes that the lines in the buffer are of two types:
961 @dfn{heading lines} and @dfn{body lines}. A heading line represents a
962 topic in the outline. Heading lines start with one or more asterisk
963 (@samp{*}) characters; the number of asterisks determines the depth of
964 the heading in the outline structure. Thus, a heading line with one
965 @samp{*} is a major topic; all the heading lines with two @samp{*}s
966 between it and the next one-@samp{*} heading are its subtopics; and so
967 on. Any line that is not a heading line is a body line. Body lines
968 belong with the preceding heading line. Here is an example:
969
970 @example
971 * Food
972 This is the body,
973 which says something about the topic of food.
974
975 ** Delicious Food
976 This is the body of the second-level header.
977
978 ** Distasteful Food
979 This could have
980 a body too, with
981 several lines.
982
983 *** Dormitory Food
984
985 * Shelter
986 Another first-level topic with its header line.
987 @end example
988
989 A heading line together with all following body lines is called
990 collectively an @dfn{entry}. A heading line together with all following
991 deeper heading lines and their body lines is called a @dfn{subtree}.
992
993 @vindex outline-regexp
994 You can customize the criterion for distinguishing heading lines by
995 setting the variable @code{outline-regexp}. (The recommended ways to
996 do this are in a major mode function or with a file local variable.)
997 Any line whose beginning has a match for this regexp is considered a
998 heading line. Matches that start within a line (not at the left
999 margin) do not count.
1000
1001 The length of the matching text determines the level of the heading;
1002 longer matches make a more deeply nested level. Thus, for example, if
1003 a text formatter has commands @samp{@@chapter}, @samp{@@section} and
1004 @samp{@@subsection} to divide the document into chapters and sections,
1005 you could make those lines count as heading lines by setting
1006 @code{outline-regexp} to @samp{"@@chap\\|@@\\(sub\\)*section"}. Note
1007 the trick: the two words @samp{chapter} and @samp{section} are equally
1008 long, but by defining the regexp to match only @samp{chap} we ensure
1009 that the length of the text matched on a chapter heading is shorter,
1010 so that Outline mode will know that sections are contained in
1011 chapters. This works as long as no other command starts with
1012 @samp{@@chap}.
1013
1014 @vindex outline-level
1015 You can explicitly specify a rule for calculating the level of a
1016 heading line by setting the variable @code{outline-level}. The value
1017 of @code{outline-level} should be a function that takes no arguments
1018 and returns the level of the current heading. The recommended ways to
1019 set this variable are in a major mode command or with a file local
1020 variable.
1021
1022 @node Outline Motion
1023 @subsection Outline Motion Commands
1024
1025 Outline mode provides special motion commands that move backward and
1026 forward to heading lines.
1027
1028 @table @kbd
1029 @item C-c C-n
1030 Move point to the next visible heading line
1031 (@code{outline-next-visible-heading}).
1032 @item C-c C-p
1033 Move point to the previous visible heading line
1034 (@code{outline-previous-visible-heading}).
1035 @item C-c C-f
1036 Move point to the next visible heading line at the same level
1037 as the one point is on (@code{outline-forward-same-level}).
1038 @item C-c C-b
1039 Move point to the previous visible heading line at the same level
1040 (@code{outline-backward-same-level}).
1041 @item C-c C-u
1042 Move point up to a lower-level (more inclusive) visible heading line
1043 (@code{outline-up-heading}).
1044 @end table
1045
1046 @findex outline-next-visible-heading
1047 @findex outline-previous-visible-heading
1048 @kindex C-c C-n @r{(Outline mode)}
1049 @kindex C-c C-p @r{(Outline mode)}
1050 @kbd{C-c C-n} (@code{outline-next-visible-heading}) moves down to
1051 the next heading line. @kbd{C-c C-p}
1052 (@code{outline-previous-visible-heading}) moves similarly backward.
1053 Both accept numeric arguments as repeat counts.
1054
1055 @findex outline-up-heading
1056 @findex outline-forward-same-level
1057 @findex outline-backward-same-level
1058 @kindex C-c C-f @r{(Outline mode)}
1059 @kindex C-c C-b @r{(Outline mode)}
1060 @kindex C-c C-u @r{(Outline mode)}
1061 @kbd{C-c C-f} (@code{outline-forward-same-level}) and @kbd{C-c C-b}
1062 (@code{outline-backward-same-level}) move from one heading line to
1063 another visible heading at the same depth in the outline. @kbd{C-c
1064 C-u} (@code{outline-up-heading}) moves backward to another heading
1065 that is less deeply nested.
1066
1067 @node Outline Visibility
1068 @subsection Outline Visibility Commands
1069
1070 Outline mode provides several commands for temporarily hiding or
1071 revealing parts of the buffer, based on the outline structure. These
1072 commands are not undoable; their effects are simply not recorded by
1073 the undo mechanism, so you can undo right past them (@pxref{Undo}).
1074
1075 Many of these commands act on the current heading line. If
1076 point is on a heading line, that is the current heading line; if point
1077 is on a body line, the current heading line is the nearest preceding
1078 header line.
1079
1080 @table @kbd
1081 @item C-c C-c
1082 Make the current heading line's body invisible (@code{hide-entry}).
1083 @item C-c C-e
1084 Make the current heading line's body visible (@code{show-entry}).
1085 @item C-c C-d
1086 Make everything under the current heading invisible, not including the
1087 heading itself (@code{hide-subtree}).
1088 @item C-c C-s
1089 Make everything under the current heading visible, including body,
1090 subheadings, and their bodies (@code{show-subtree}).
1091 @item C-c C-l
1092 Make the body of the current heading line, and of all its subheadings,
1093 invisible (@code{hide-leaves}).
1094 @item C-c C-k
1095 Make all subheadings of the current heading line, at all levels,
1096 visible (@code{show-branches}).
1097 @item C-c C-i
1098 Make immediate subheadings (one level down) of the current heading
1099 line visible (@code{show-children}).
1100 @item C-c C-t
1101 Make all body lines in the buffer invisible (@code{hide-body}).
1102 @item C-c C-a
1103 Make all lines in the buffer visible (@code{show-all}).
1104 @item C-c C-q
1105 Hide everything except the top @var{n} levels of heading lines
1106 (@code{hide-sublevels}).
1107 @item C-c C-o
1108 Hide everything except for the heading or body that point is in, plus
1109 the headings leading up from there to the top level of the outline
1110 (@code{hide-other}).
1111 @end table
1112
1113 @findex hide-entry
1114 @findex show-entry
1115 @kindex C-c C-c @r{(Outline mode)}
1116 @kindex C-c C-e @r{(Outline mode)}
1117 The simplest of these commands are @kbd{C-c C-c}
1118 (@code{hide-entry}), which hides the body lines directly following the
1119 current heading line, and @kbd{C-c C-e} (@code{show-entry}), which
1120 reveals them. Subheadings and their bodies are not affected.
1121
1122 @findex hide-subtree
1123 @findex show-subtree
1124 @kindex C-c C-s @r{(Outline mode)}
1125 @kindex C-c C-d @r{(Outline mode)}
1126 @cindex subtree (Outline mode)
1127 The commands @kbd{C-c C-d} (@code{hide-subtree}) and @kbd{C-c C-s}
1128 (@code{show-subtree}) are more powerful. They apply to the current
1129 heading line's @dfn{subtree}: its body, all of its subheadings, both
1130 direct and indirect, and all of their bodies.
1131
1132 @findex hide-leaves
1133 @findex show-branches
1134 @findex show-children
1135 @kindex C-c C-l @r{(Outline mode)}
1136 @kindex C-c C-k @r{(Outline mode)}
1137 @kindex C-c C-i @r{(Outline mode)}
1138 The command @kbd{C-c C-l} (@code{hide-leaves}) hides the body of the
1139 current heading line as well as all the bodies in its subtree; the
1140 subheadings themselves are left visible. The command @kbd{C-c C-k}
1141 (@code{show-branches}) reveals the subheadings, if they had previously
1142 been hidden (e.g., by @kbd{C-c C-d}). The command @kbd{C-c C-i}
1143 (@code{show-children}) is a weaker version of this; it reveals just
1144 the direct subheadings, i.e., those one level down.
1145
1146 @findex hide-other
1147 @kindex C-c C-o @r{(Outline mode)}
1148 The command @kbd{C-c C-o} (@code{hide-other}) hides everything
1149 except the entry that point is in, plus its parents (the headers
1150 leading up from there to top level in the outline) and the top level
1151 headings.
1152
1153 @findex hide-body
1154 @findex show-all
1155 @kindex C-c C-t @r{(Outline mode)}
1156 @kindex C-c C-a @r{(Outline mode)}
1157 @findex hide-sublevels
1158 @kindex C-c C-q @r{(Outline mode)}
1159 The remaining commands affect the whole buffer. @kbd{C-c C-t}
1160 (@code{hide-body}) makes all body lines invisible, so that you see
1161 just the outline structure (as a special exception, it will not hide
1162 lines at the top of the file, preceding the first header line, even
1163 though these are technically body lines). @kbd{C-c C-a}
1164 (@code{show-all}) makes all lines visible. @kbd{C-c C-q}
1165 (@code{hide-sublevels}) hides all but the top level headings; with a
1166 numeric argument @var{n}, it hides everything except the top @var{n}
1167 levels of heading lines.
1168
1169 @anchor{Outline Search}
1170 @findex reveal-mode
1171 @vindex search-invisible
1172 When incremental search finds text that is hidden by Outline mode,
1173 it makes that part of the buffer visible. If you exit the search at
1174 that position, the text remains visible. To toggle whether or not
1175 an active incremental search can match hidden text, type @kbd{M-s i}.
1176 To change the default for future searches, customize the option
1177 @code{search-invisible}. (This option also affects how @code{query-replace}
1178 and related functions treat hidden text, @pxref{Query Replace}.)
1179 You can also automatically make text visible as you navigate in it by
1180 using Reveal mode (@kbd{M-x reveal-mode}), a buffer-local minor mode.
1181
1182 @node Outline Views
1183 @subsection Viewing One Outline in Multiple Views
1184
1185 @cindex multiple views of outline
1186 @cindex views of an outline
1187 @cindex outline with multiple views
1188 @cindex indirect buffers and outlines
1189 You can display two views of a single outline at the same time, in
1190 different windows. To do this, you must create an indirect buffer using
1191 @kbd{M-x make-indirect-buffer}. The first argument of this command is
1192 the existing outline buffer name, and its second argument is the name to
1193 use for the new indirect buffer. @xref{Indirect Buffers}.
1194
1195 Once the indirect buffer exists, you can display it in a window in the
1196 normal fashion, with @kbd{C-x 4 b} or other Emacs commands. The Outline
1197 mode commands to show and hide parts of the text operate on each buffer
1198 independently; as a result, each buffer can have its own view. If you
1199 want more than two views on the same outline, create additional indirect
1200 buffers.
1201
1202 @node Foldout
1203 @subsection Folding Editing
1204
1205 @cindex folding editing
1206 The Foldout package extends Outline mode and Outline minor mode with
1207 folding commands. The idea of folding is that you zoom in on a
1208 nested portion of the outline, while hiding its relatives at higher
1209 levels.
1210
1211 Consider an Outline mode buffer with all the text and subheadings under
1212 level-1 headings hidden. To look at what is hidden under one of these
1213 headings, you could use @kbd{C-c C-e} (@kbd{M-x show-entry}) to expose
1214 the body, or @kbd{C-c C-i} to expose the child (level-2) headings.
1215
1216 @kindex C-c C-z
1217 @findex foldout-zoom-subtree
1218 With Foldout, you use @kbd{C-c C-z} (@kbd{M-x foldout-zoom-subtree}).
1219 This exposes the body and child subheadings, and narrows the buffer so
1220 that only the @w{level-1} heading, the body and the level-2 headings are
1221 visible. Now to look under one of the level-2 headings, position the
1222 cursor on it and use @kbd{C-c C-z} again. This exposes the level-2 body
1223 and its level-3 child subheadings and narrows the buffer again. Zooming
1224 in on successive subheadings can be done as much as you like. A string
1225 in the mode line shows how deep you've gone.
1226
1227 When zooming in on a heading, to see only the child subheadings specify
1228 a numeric argument: @kbd{C-u C-c C-z}. The number of levels of children
1229 can be specified too (compare @kbd{M-x show-children}), e.g., @kbd{M-2
1230 C-c C-z} exposes two levels of child subheadings. Alternatively, the
1231 body can be specified with a negative argument: @kbd{M-- C-c C-z}. The
1232 whole subtree can be expanded, similarly to @kbd{C-c C-s} (@kbd{M-x
1233 show-subtree}), by specifying a zero argument: @kbd{M-0 C-c C-z}.
1234
1235 While you're zoomed in, you can still use Outline mode's exposure and
1236 hiding functions without disturbing Foldout. Also, since the buffer is
1237 narrowed, global editing actions will only affect text under the
1238 zoomed-in heading. This is useful for restricting changes to a
1239 particular chapter or section of your document.
1240
1241 @kindex C-c C-x
1242 @findex foldout-exit-fold
1243 To unzoom (exit) a fold, use @kbd{C-c C-x} (@kbd{M-x foldout-exit-fold}).
1244 This hides all the text and subheadings under the top-level heading and
1245 returns you to the previous view of the buffer. Specifying a numeric
1246 argument exits that many levels of folds. Specifying a zero argument
1247 exits all folds.
1248
1249 To cancel the narrowing of a fold without hiding the text and
1250 subheadings, specify a negative argument. For example, @kbd{M--2 C-c
1251 C-x} exits two folds and leaves the text and subheadings exposed.
1252
1253 Foldout mode also provides mouse commands for entering and exiting
1254 folds, and for showing and hiding text:
1255
1256 @table @asis
1257 @item @kbd{C-M-Mouse-1} zooms in on the heading clicked on
1258 @itemize @w{}
1259 @item
1260 single click: expose body.
1261 @item
1262 double click: expose subheadings.
1263 @item
1264 triple click: expose body and subheadings.
1265 @item
1266 quad click: expose entire subtree.
1267 @end itemize
1268 @item @kbd{C-M-Mouse-2} exposes text under the heading clicked on
1269 @itemize @w{}
1270 @item
1271 single click: expose body.
1272 @item
1273 double click: expose subheadings.
1274 @item
1275 triple click: expose body and subheadings.
1276 @item
1277 quad click: expose entire subtree.
1278 @end itemize
1279 @item @kbd{C-M-Mouse-3} hides text under the heading clicked on or exits fold
1280 @itemize @w{}
1281 @item
1282 single click: hide subtree.
1283 @item
1284 double click: exit fold and hide text.
1285 @item
1286 triple click: exit fold without hiding text.
1287 @item
1288 quad click: exit all folds and hide text.
1289 @end itemize
1290 @end table
1291
1292 @c FIXME not marked as a user variable
1293 @vindex foldout-mouse-modifiers
1294 You can specify different modifier keys (instead of
1295 @kbd{@key{Ctrl}-@key{META}-}) by setting @code{foldout-mouse-modifiers}; but if
1296 you have already loaded the @file{foldout.el} library, you must reload
1297 it in order for this to take effect.
1298
1299 To use the Foldout package, you can type @kbd{M-x load-library
1300 @key{RET} foldout @key{RET}}; or you can arrange for to do that
1301 automatically by putting the following in your init file:
1302
1303 @example
1304 (eval-after-load "outline" '(require 'foldout))
1305 @end example
1306
1307 @node Org Mode
1308 @section Org Mode
1309 @cindex organizer
1310 @cindex planner
1311 @findex Org mode
1312 @findex mode, Org
1313
1314 @findex org-mode
1315 Org mode is a variant of Outline mode for using Emacs as an
1316 organizer and/or authoring system. Files with names ending in the
1317 extension @file{.org} are opened in Org mode (@pxref{Choosing Modes}).
1318 To explicitly switch to Org mode, type @kbd{M-x org-mode}.
1319
1320 In Org mode, as in Outline mode, each entry has a heading line that
1321 starts with one or more @samp{*} characters. @xref{Outline Format}.
1322 In addition, any line that begins with the @samp{#} character is
1323 treated as a comment.
1324
1325 @kindex TAB @r{(Org Mode)}
1326 @findex org-cycle
1327 Org mode provides commands for easily viewing and manipulating the
1328 outline structure. The simplest of these commands is @key{TAB}
1329 (@code{org-cycle}). If invoked on a heading line, it cycles through
1330 the different visibility states of the subtree: (i) showing only that
1331 heading line, (ii) showing only the heading line and the heading lines
1332 of its direct children, if any, and (iii) showing the entire subtree.
1333 If invoked in a body line, the global binding for @key{TAB} is
1334 executed.
1335
1336 @kindex S-TAB @r{(Org Mode)}
1337 @findex org-shifttab
1338 Typing @kbd{S-@key{TAB}} (@code{org-shifttab}) anywhere in an Org mode
1339 buffer cycles the visibility of the entire outline structure, between
1340 (i) showing only top-level heading lines, (ii) showing all heading
1341 lines but no body lines, and (iii) showing everything.
1342
1343 @kindex M-<up> @r{(Org Mode)}
1344 @kindex M-<down> @r{(Org Mode)}
1345 @kindex M-<left> @r{(Org Mode)}
1346 @kindex M-<right> @r{(Org Mode)}
1347 @findex org-metaup
1348 @findex org-metadown
1349 @findex org-metaleft
1350 @findex org-metaright
1351 You can move an entire entry up or down in the buffer, including its
1352 body lines and subtree (if any), by typing @kbd{M-<up>}
1353 (@code{org-metaup}) or @kbd{M-<down>} (@code{org-metadown}) on the
1354 heading line. Similarly, you can promote or demote a heading line
1355 with @kbd{M-<left>} (@code{org-metaleft}) and @kbd{M-<right>}
1356 (@code{org-metaright}). These commands execute their global bindings
1357 if invoked on a body line.
1358
1359 The following subsections give basic instructions for using Org mode
1360 as an organizer and as an authoring system. For details, @pxref{Top,
1361 The Org Mode Manual, Introduction, org, The Org Manual}.
1362
1363 @menu
1364 * Org Organizer:: Managing TODO lists and agendas.
1365 * Org Authoring:: Exporting Org buffers to various formats.
1366 @end menu
1367
1368 @node Org Organizer
1369 @subsection Org as an organizer
1370 @cindex TODO item
1371 @cindex Org agenda
1372
1373 @kindex C-c C-t @r{(Org Mode)}
1374 @findex org-todo
1375 @vindex org-todo-keywords
1376 You can tag an Org entry as a @dfn{TODO} item by typing @kbd{C-c
1377 C-t} (@code{org-todo}) anywhere in the entry. This adds the keyword
1378 @samp{TODO} to the heading line. Typing @kbd{C-c C-t} again switches
1379 the keyword to @samp{DONE}; another @kbd{C-c C-t} removes the keyword
1380 entirely, and so forth. You can customize the keywords used by
1381 @kbd{C-c C-t} via the variable @code{org-todo-keywords}.
1382
1383 @kindex C-c C-s @r{(Org Mode)}
1384 @kindex C-c C-d @r{(Org Mode)}
1385 @findex org-schedule
1386 @findex org-deadline
1387 Apart from marking an entry as TODO, you can attach a date to it, by
1388 typing @kbd{C-c C-s} (@code{org-schedule}) in the entry. This prompts
1389 for a date by popping up the Emacs Calendar (@pxref{Calendar/Diary}),
1390 and then adds the tag @samp{SCHEDULED}, together with the selected
1391 date, beneath the heading line. The command @kbd{C-c C-d}
1392 (@code{org-deadline}) has the same effect, except that it uses the tag
1393 @code{DEADLINE}.
1394
1395 @kindex C-c [ @r{(Org Mode)}
1396 @findex org-agenda-file-to-front
1397 @vindex org-agenda-files
1398 Once you have some TODO items planned in an Org file, you can add
1399 that file to the list of @dfn{agenda files} by typing @kbd{C-c [}
1400 (@code{org-agenda-file-to-front}). Org mode is designed to let you
1401 easily maintain multiple agenda files, e.g., for organizing different
1402 aspects of your life. The list of agenda files is stored in the
1403 variable @code{org-agenda-files}.
1404
1405 @findex org-agenda
1406 To view items coming from your agenda files, type @kbd{M-x
1407 org-agenda}. This command prompts for what you want to see: a list of
1408 things to do this week, a list of TODO items with specific keywords,
1409 etc.
1410 @ifnottex
1411 @xref{Agenda Views,,,org, The Org Manual}, for details.
1412 @end ifnottex
1413
1414 @node Org Authoring
1415 @subsection Org as an authoring system
1416 @cindex Org exporting
1417
1418 @findex org-export
1419 @kindex C-c C-e @r{(Org mode)}
1420 You may want to format your Org notes nicely and to prepare them for
1421 export and publication. To export the current buffer, type @kbd{C-c
1422 C-e} (@code{org-export}) anywhere in an Org buffer. This command
1423 prompts for an export format; currently supported formats include
1424 HTML, @LaTeX{}, OpenDocument (@file{.odt}), and PDF@. Some formats,
1425 such as PDF, require certain system tools to be installed.
1426
1427 @vindex org-publish-project-alist
1428 To export several files at once to a specific directory, either
1429 locally or over the network, you must define a list of projects
1430 through the variable @code{org-publish-project-alist}. See its
1431 documentation for details.
1432
1433 Org supports a simple markup scheme for applying text formatting to
1434 exported documents:
1435
1436 @example
1437 - This text is /emphasized/
1438 - This text is *in bold*
1439 - This text is _underlined_
1440 - This text uses =a teletype font=
1441
1442 #+begin_quote
1443 ``This is a quote.''
1444 #+end_quote
1445
1446 #+begin_example
1447 This is an example.
1448 #+end_example
1449 @end example
1450
1451 For further details, @ref{Exporting,,,org, The Org Manual}, and
1452 @ref{Publishing,,,org, The Org Manual}.
1453
1454 @node TeX Mode
1455 @section @TeX{} Mode
1456 @cindex @TeX{} mode
1457 @cindex @LaTeX{} mode
1458 @cindex Sli@TeX{} mode
1459 @cindex Doc@TeX{} mode
1460 @cindex mode, @TeX{}
1461 @cindex mode, @LaTeX{}
1462 @cindex mode, Sli@TeX{}
1463 @cindex mode, Doc@TeX{}
1464 @findex tex-mode
1465 @findex plain-tex-mode
1466 @findex latex-mode
1467 @findex slitex-mode
1468 @findex doctex-mode
1469 @findex bibtex-mode
1470
1471 Emacs provides special major modes for editing files written in
1472 @TeX{} and its related formats. @TeX{} is a powerful text formatter
1473 written by Donald Knuth; like GNU Emacs, it is free software.
1474 @LaTeX{} is a simplified input format for @TeX{}, implemented using
1475 @TeX{} macros. Doc@TeX{} is a special file format in which the
1476 @LaTeX{} sources are written, combining sources with documentation.
1477 Sli@TeX{} is an obsolete special form of @LaTeX{}.@footnote{It has
1478 been replaced by the @samp{slides} document class, which comes with
1479 @LaTeX{}.}
1480
1481 @vindex tex-default-mode
1482 @TeX{} mode has four variants: Plain @TeX{} mode, @LaTeX{} mode,
1483 Doc@TeX{} mode, and Sli@TeX{} mode. These distinct major modes differ
1484 only slightly, and are designed for editing the four different
1485 formats. Emacs selects the appropriate mode by looking at the
1486 contents of the buffer. (This is done by the @code{tex-mode} command,
1487 which is normally called automatically when you visit a @TeX{}-like
1488 file. @xref{Choosing Modes}.) If the contents are insufficient to
1489 determine this, Emacs chooses the mode specified by the variable
1490 @code{tex-default-mode}; its default value is @code{latex-mode}. If
1491 Emacs does not guess right, you can select the correct variant of
1492 @TeX{} mode using the command @kbd{M-x plain-tex-mode}, @kbd{M-x
1493 latex-mode}, @kbd{M-x slitex-mode}, or @kbd{doctex-mode}.
1494
1495 The following sections document the features of @TeX{} mode and its
1496 variants. There are several other @TeX{}-related Emacs packages,
1497 which are not documented in this manual:
1498
1499 @itemize @bullet
1500 @item
1501 Bib@TeX{} mode is a major mode for Bib@TeX{} files, which are commonly
1502 used for keeping bibliographic references for @LaTeX{} documents. For
1503 more information, see the documentation string for the command
1504 @code{bibtex-mode}.
1505
1506 @item
1507 The Ref@TeX{} package provides a minor mode which can be used with
1508 @LaTeX{} mode to manage bibliographic references.
1509 @ifinfo
1510 @xref{Top,The Ref@TeX{} Manual,,reftex}.
1511 @end ifinfo
1512 @ifnotinfo
1513 For more information, see the Ref@TeX{} Info manual, which is
1514 distributed with Emacs.
1515 @end ifnotinfo
1516
1517 @item
1518 The AUC@TeX{} package provides more advanced features for editing
1519 @TeX{} and its related formats, including the ability to preview
1520 @TeX{} equations within Emacs buffers. Unlike Bib@TeX{} mode and the
1521 Ref@TeX{} package, AUC@TeX{} is not distributed with Emacs by default.
1522 It can be downloaded via the Package Menu (@pxref{Packages}); once
1523 installed, see
1524 @ifinfo
1525 @ref{Top,The AUC@TeX{} Manual,,auctex}.
1526 @end ifinfo
1527 @ifnotinfo
1528 the AUC@TeX{} manual, which is included with the package.
1529 @end ifnotinfo
1530 @end itemize
1531
1532 @menu
1533 * TeX Editing:: Special commands for editing in TeX mode.
1534 * LaTeX Editing:: Additional commands for LaTeX input files.
1535 * TeX Print:: Commands for printing part of a file with TeX.
1536 * TeX Misc:: Customization of TeX mode, and related features.
1537 @end menu
1538
1539 @node TeX Editing
1540 @subsection @TeX{} Editing Commands
1541
1542 @table @kbd
1543 @item "
1544 Insert, according to context, either @samp{``} or @samp{"} or
1545 @samp{''} (@code{tex-insert-quote}).
1546 @item C-j
1547 Insert a paragraph break (two newlines) and check the previous
1548 paragraph for unbalanced braces or dollar signs
1549 (@code{tex-terminate-paragraph}).
1550 @item M-x tex-validate-region
1551 Check each paragraph in the region for unbalanced braces or dollar signs.
1552 @item C-c @{
1553 Insert @samp{@{@}} and position point between them (@code{tex-insert-braces}).
1554 @item C-c @}
1555 Move forward past the next unmatched close brace (@code{up-list}).
1556 @end table
1557
1558 @findex tex-insert-quote
1559 @kindex " @r{(@TeX{} mode)}
1560 In @TeX{}, the character @samp{"} is not normally used; instead,
1561 quotations begin with @samp{``} and end with @samp{''}. @TeX{} mode
1562 therefore binds the @kbd{"} key to the @code{tex-insert-quote}
1563 command. This inserts @samp{``} after whitespace or an open brace,
1564 @samp{"} after a backslash, and @samp{''} after any other character.
1565
1566 As a special exception, if you type @kbd{"} when the text before
1567 point is either @samp{``} or @samp{''}, Emacs replaces that preceding
1568 text with a single @samp{"} character. You can therefore type
1569 @kbd{""} to insert @samp{"}, should you ever need to do so. (You can
1570 also use @kbd{C-q "} to insert this character.)
1571
1572 In @TeX{} mode, @samp{$} has a special syntax code which attempts to
1573 understand the way @TeX{} math mode delimiters match. When you insert a
1574 @samp{$} that is meant to exit math mode, the position of the matching
1575 @samp{$} that entered math mode is displayed for a second. This is the
1576 same feature that displays the open brace that matches a close brace that
1577 is inserted. However, there is no way to tell whether a @samp{$} enters
1578 math mode or leaves it; so when you insert a @samp{$} that enters math
1579 mode, the previous @samp{$} position is shown as if it were a match, even
1580 though they are actually unrelated.
1581
1582 @findex tex-insert-braces
1583 @kindex C-c @{ @r{(@TeX{} mode)}
1584 @findex up-list
1585 @kindex C-c @} @r{(@TeX{} mode)}
1586 @TeX{} uses braces as delimiters that must match. Some users prefer
1587 to keep braces balanced at all times, rather than inserting them
1588 singly. Use @kbd{C-c @{} (@code{tex-insert-braces}) to insert a pair of
1589 braces. It leaves point between the two braces so you can insert the
1590 text that belongs inside. Afterward, use the command @kbd{C-c @}}
1591 (@code{up-list}) to move forward past the close brace.
1592
1593 @findex tex-validate-region
1594 @findex tex-terminate-paragraph
1595 @kindex C-j @r{(@TeX{} mode)}
1596 There are two commands for checking the matching of braces.
1597 @kbd{C-j} (@code{tex-terminate-paragraph}) checks the paragraph before
1598 point, and inserts two newlines to start a new paragraph. It outputs
1599 a message in the echo area if any mismatch is found. @kbd{M-x
1600 tex-validate-region} checks a region, paragraph by paragraph. The
1601 errors are listed in an @file{*Occur*} buffer; you can use the usual
1602 Occur mode commands in that buffer, such as @kbd{C-c C-c}, to visit a
1603 particular mismatch (@pxref{Other Repeating Search}).
1604
1605 Note that Emacs commands count square brackets and parentheses in
1606 @TeX{} mode, not just braces. This is not strictly correct for the
1607 purpose of checking @TeX{} syntax. However, parentheses and square
1608 brackets are likely to be used in text as matching delimiters, and it
1609 is useful for the various motion commands and automatic match display
1610 to work with them.
1611
1612 @node LaTeX Editing
1613 @subsection @LaTeX{} Editing Commands
1614
1615 @LaTeX{} mode provides a few extra features not applicable to plain
1616 @TeX{}:
1617
1618 @table @kbd
1619 @item C-c C-o
1620 Insert @samp{\begin} and @samp{\end} for @LaTeX{} block and position
1621 point on a line between them (@code{tex-latex-block}).
1622 @item C-c C-e
1623 Close the innermost @LaTeX{} block not yet closed
1624 (@code{tex-close-latex-block}).
1625 @end table
1626
1627 @findex tex-latex-block
1628 @kindex C-c C-o @r{(@LaTeX{} mode)}
1629 In @LaTeX{} input, @samp{\begin} and @samp{\end} tags are used to
1630 group blocks of text. To insert a block, type @kbd{C-c C-o}
1631 (@code{tex-latex-block}). This prompts for a block type, and inserts
1632 the appropriate matching @samp{\begin} and @samp{\end} tags, leaving a
1633 blank line between the two and moving point there.
1634
1635 @vindex latex-block-names
1636 When entering the block type argument to @kbd{C-c C-o}, you can use
1637 the usual completion commands (@pxref{Completion}). The default
1638 completion list contains the standard @LaTeX{} block types. If you
1639 want additional block types for completion, customize the list
1640 variable @code{latex-block-names}.
1641
1642 @findex tex-close-latex-block
1643 @kindex C-c C-e @r{(@LaTeX{} mode)}
1644 @findex latex-electric-env-pair-mode
1645 In @LaTeX{} input, @samp{\begin} and @samp{\end} tags must balance.
1646 You can use @kbd{C-c C-e} (@code{tex-close-latex-block}) to insert an
1647 @samp{\end} tag which matches the last unmatched @samp{\begin}. It
1648 also indents the @samp{\end} to match the corresponding @samp{\begin},
1649 and inserts a newline after the @samp{\end} tag if point is at the
1650 beginning of a line. The minor mode @code{latex-electric-env-pair-mode}
1651 automatically inserts an @samp{\end} or @samp{\begin} tag for you
1652 when you type the corresponding one.
1653
1654 @node TeX Print
1655 @subsection @TeX{} Printing Commands
1656
1657 You can invoke @TeX{} as an subprocess of Emacs, supplying either
1658 the entire contents of the buffer or just part of it (e.g., one
1659 chapter of a larger document).
1660
1661 @table @kbd
1662 @item C-c C-b
1663 Invoke @TeX{} on the entire current buffer (@code{tex-buffer}).
1664 @item C-c C-r
1665 Invoke @TeX{} on the current region, together with the buffer's header
1666 (@code{tex-region}).
1667 @item C-c C-f
1668 Invoke @TeX{} on the current file (@code{tex-file}).
1669
1670 @item C-c C-v
1671 Preview the output from the last @kbd{C-c C-r}, @kbd{C-c C-b}, or @kbd{C-c
1672 C-f} command (@code{tex-view}).
1673
1674 @item C-c C-p
1675 Print the output from the last @kbd{C-c C-b}, @kbd{C-c C-r}, or
1676 @kbd{C-c C-f} command (@code{tex-print}).
1677
1678 @item C-c @key{TAB}
1679 Invoke Bib@TeX{} on the current file (@code{tex-bibtex-file}).
1680 @item C-c C-l
1681 Recenter the window showing output from @TeX{} so that the last line
1682 can be seen (@code{tex-recenter-output-buffer}).
1683 @item C-c C-k
1684 Kill the @TeX{} subprocess (@code{tex-kill-job}).
1685 @item C-c C-c
1686 Invoke some other compilation command on the entire current buffer
1687 (@code{tex-compile}).
1688 @end table
1689
1690 @findex tex-buffer
1691 @kindex C-c C-b @r{(@TeX{} mode)}
1692 @findex tex-view
1693 @kindex C-c C-v @r{(@TeX{} mode)}
1694 @findex tex-print
1695 @kindex C-c C-p @r{(@TeX{} mode)}
1696 To pass the current buffer through @TeX{}, type @kbd{C-c C-b}
1697 (@code{tex-buffer}). The formatted output goes in a temporary file,
1698 normally a @file{.dvi} file. Afterwards, you can type @kbd{C-c C-v}
1699 (@code{tex-view}) to launch an external program, such as
1700 @command{xdvi}, to view this output file. You can also type @kbd{C-c
1701 C-p} (@code{tex-print}) to print a hardcopy of the output file.
1702
1703 @cindex @env{TEXINPUTS} environment variable
1704 @vindex tex-directory
1705 By default, @kbd{C-c C-b} runs @TeX{} in the current directory. The
1706 output of @TeX{} also goes in this directory. To run @TeX{} in a
1707 different directory, change the variable @code{tex-directory} to the
1708 desired directory name. If your environment variable @env{TEXINPUTS}
1709 contains relative directory names, or if your files contains
1710 @samp{\input} commands with relative file names, then
1711 @code{tex-directory} @emph{must} be @code{"."} or you will get the
1712 wrong results. Otherwise, it is safe to specify some other directory,
1713 such as @code{"/tmp"}.
1714
1715 @vindex tex-run-command
1716 @vindex latex-run-command
1717 @vindex tex-dvi-view-command
1718 @vindex tex-dvi-print-command
1719 The buffer's @TeX{} variant determines what shell command @kbd{C-c
1720 C-b} actually runs. In Plain @TeX{} mode, it is specified by the
1721 variable @code{tex-run-command}, which defaults to @code{"tex"}. In
1722 @LaTeX{} mode, it is specified by @code{latex-run-command}, which
1723 defaults to @code{"latex"}. The shell command that @kbd{C-c C-v} runs
1724 to view the @file{.dvi} output is determined by the variable
1725 @code{tex-dvi-view-command}, regardless of the @TeX{} variant. The
1726 shell command that @kbd{C-c C-p} runs to print the output is
1727 determined by the variable @code{tex-dvi-print-command}.
1728
1729 Normally, Emacs automatically appends the output file name to the
1730 shell command strings described in the preceding paragraph. For
1731 example, if @code{tex-dvi-view-command} is @code{"xdvi"}, @kbd{C-c
1732 C-v} runs @command{xdvi @var{output-file-name}}. In some cases,
1733 however, the file name needs to be embedded in the command, e.g., if
1734 you need to provide the file name as an argument to one command whose
1735 output is piped to another. You can specify where to put the file
1736 name with @samp{*} in the command string. For example,
1737
1738 @example
1739 (setq tex-dvi-print-command "dvips -f * | lpr")
1740 @end example
1741
1742 @findex tex-kill-job
1743 @kindex C-c C-k @r{(@TeX{} mode)}
1744 @findex tex-recenter-output-buffer
1745 @kindex C-c C-l @r{(@TeX{} mode)}
1746 The terminal output from @TeX{}, including any error messages,
1747 appears in a buffer called @file{*tex-shell*}. If @TeX{} gets an
1748 error, you can switch to this buffer and feed it input (this works as
1749 in Shell mode; @pxref{Interactive Shell}). Without switching to this
1750 buffer you can scroll it so that its last line is visible by typing
1751 @kbd{C-c C-l}.
1752
1753 Type @kbd{C-c C-k} (@code{tex-kill-job}) to kill the @TeX{} process if
1754 you see that its output is no longer useful. Using @kbd{C-c C-b} or
1755 @kbd{C-c C-r} also kills any @TeX{} process still running.
1756
1757 @findex tex-region
1758 @kindex C-c C-r @r{(@TeX{} mode)}
1759 You can also pass an arbitrary region through @TeX{} by typing
1760 @kbd{C-c C-r} (@code{tex-region}). This is tricky, however, because
1761 most files of @TeX{} input contain commands at the beginning to set
1762 parameters and define macros, without which no later part of the file
1763 will format correctly. To solve this problem, @kbd{C-c C-r} allows
1764 you to designate a part of the file as containing essential commands;
1765 it is included before the specified region as part of the input to
1766 @TeX{}. The designated part of the file is called the @dfn{header}.
1767
1768 @cindex header (@TeX{} mode)
1769 To indicate the bounds of the header in Plain @TeX{} mode, you insert two
1770 special strings in the file. Insert @samp{%**start of header} before the
1771 header, and @samp{%**end of header} after it. Each string must appear
1772 entirely on one line, but there may be other text on the line before or
1773 after. The lines containing the two strings are included in the header.
1774 If @samp{%**start of header} does not appear within the first 100 lines of
1775 the buffer, @kbd{C-c C-r} assumes that there is no header.
1776
1777 In @LaTeX{} mode, the header begins with @samp{\documentclass} or
1778 @samp{\documentstyle} and ends with @samp{\begin@{document@}}. These
1779 are commands that @LaTeX{} requires you to use in any case, so nothing
1780 special needs to be done to identify the header.
1781
1782 @findex tex-file
1783 @kindex C-c C-f @r{(@TeX{} mode)}
1784 The commands (@code{tex-buffer}) and (@code{tex-region}) do all of their
1785 work in a temporary directory, and do not have available any of the auxiliary
1786 files needed by @TeX{} for cross-references; these commands are generally
1787 not suitable for running the final copy in which all of the cross-references
1788 need to be correct.
1789
1790 When you want the auxiliary files for cross references, use @kbd{C-c
1791 C-f} (@code{tex-file}) which runs @TeX{} on the current buffer's file,
1792 in that file's directory. Before running @TeX{}, it offers to save any
1793 modified buffers. Generally, you need to use (@code{tex-file}) twice to
1794 get the cross-references right.
1795
1796 @vindex tex-start-options
1797 The value of the variable @code{tex-start-options} specifies
1798 options for the @TeX{} run.
1799
1800 @vindex tex-start-commands
1801 The value of the variable @code{tex-start-commands} specifies @TeX{}
1802 commands for starting @TeX{}. The default value causes @TeX{} to run
1803 in nonstop mode. To run @TeX{} interactively, set the variable to
1804 @code{""}.
1805
1806 @vindex tex-main-file
1807 Large @TeX{} documents are often split into several files---one main
1808 file, plus subfiles. Running @TeX{} on a subfile typically does not
1809 work; you have to run it on the main file. In order to make
1810 @code{tex-file} useful when you are editing a subfile, you can set the
1811 variable @code{tex-main-file} to the name of the main file. Then
1812 @code{tex-file} runs @TeX{} on that file.
1813
1814 The most convenient way to use @code{tex-main-file} is to specify it
1815 in a local variable list in each of the subfiles. @xref{File
1816 Variables}.
1817
1818 @findex tex-bibtex-file
1819 @kindex C-c TAB @r{(@TeX{} mode)}
1820 @vindex tex-bibtex-command
1821 For @LaTeX{} files, you can use Bib@TeX{} to process the auxiliary
1822 file for the current buffer's file. Bib@TeX{} looks up bibliographic
1823 citations in a data base and prepares the cited references for the
1824 bibliography section. The command @kbd{C-c @key{TAB}}
1825 (@code{tex-bibtex-file}) runs the shell command
1826 (@code{tex-bibtex-command}) to produce a @samp{.bbl} file for the
1827 current buffer's file. Generally, you need to do @kbd{C-c C-f}
1828 (@code{tex-file}) once to generate the @samp{.aux} file, then do
1829 @kbd{C-c @key{TAB}} (@code{tex-bibtex-file}), and then repeat @kbd{C-c C-f}
1830 (@code{tex-file}) twice more to get the cross-references correct.
1831
1832 @findex tex-compile
1833 @kindex C-c C-c @r{(@TeX{} mode)}
1834 To invoke some other compilation program on the current @TeX{}
1835 buffer, type @kbd{C-c C-c} (@code{tex-compile}). This command knows
1836 how to pass arguments to many common programs, including
1837 @file{pdflatex}, @file{yap}, @file{xdvi}, and @file{dvips}. You can
1838 select your desired compilation program using the standard completion
1839 keys (@pxref{Completion}).
1840
1841 @node TeX Misc
1842 @subsection @TeX{} Mode Miscellany
1843
1844 @vindex tex-shell-hook
1845 @vindex tex-mode-hook
1846 @vindex latex-mode-hook
1847 @vindex slitex-mode-hook
1848 @vindex plain-tex-mode-hook
1849 Entering any variant of @TeX{} mode runs the hooks
1850 @code{text-mode-hook} and @code{tex-mode-hook}. Then it runs either
1851 @code{plain-tex-mode-hook}, @code{latex-mode-hook}, or
1852 @code{slitex-mode-hook}, whichever is appropriate. Starting the
1853 @TeX{} shell runs the hook @code{tex-shell-hook}. @xref{Hooks}.
1854
1855 @findex iso-iso2tex
1856 @findex iso-tex2iso
1857 @findex iso-iso2gtex
1858 @findex iso-gtex2iso
1859 @cindex Latin-1 @TeX{} encoding
1860 @cindex @TeX{} encoding
1861 The commands @kbd{M-x iso-iso2tex}, @kbd{M-x iso-tex2iso}, @kbd{M-x
1862 iso-iso2gtex} and @kbd{M-x iso-gtex2iso} can be used to convert
1863 between Latin-1 encoded files and @TeX{}-encoded equivalents.
1864
1865 @node HTML Mode
1866 @section SGML and HTML Modes
1867 @cindex SGML mode
1868 @cindex HTML mode
1869 @cindex mode, SGML
1870 @cindex mode, HTML
1871 @findex sgml-mode
1872 @findex html-mode
1873
1874 The major modes for SGML and HTML provide indentation support and
1875 commands for operating on tags. HTML mode is a slightly customized
1876 variant of SGML mode.
1877
1878 @table @kbd
1879 @item C-c C-n
1880 @kindex C-c C-n @r{(SGML mode)}
1881 @findex sgml-name-char
1882 Interactively specify a special character and insert the SGML
1883 @samp{&}-command for that character (@code{sgml-name-char}).
1884
1885 @item C-c C-t
1886 @kindex C-c C-t @r{(SGML mode)}
1887 @findex sgml-tag
1888 Interactively specify a tag and its attributes (@code{sgml-tag}).
1889 This command asks you for a tag name and for the attribute values,
1890 then inserts both the opening tag and the closing tag, leaving point
1891 between them.
1892
1893 With a prefix argument @var{n}, the command puts the tag around the
1894 @var{n} words already present in the buffer after point. Whenever a
1895 region is active, it puts the tag around the region (when Transient
1896 Mark mode is off, it does this when a numeric argument of @minus{}1 is
1897 supplied.)
1898
1899 @item C-c C-a
1900 @kindex C-c C-a @r{(SGML mode)}
1901 @findex sgml-attributes
1902 Interactively insert attribute values for the current tag
1903 (@code{sgml-attributes}).
1904
1905 @item C-c C-f
1906 @kindex C-c C-f @r{(SGML mode)}
1907 @findex sgml-skip-tag-forward
1908 Skip across a balanced tag group (which extends from an opening tag
1909 through its corresponding closing tag) (@code{sgml-skip-tag-forward}).
1910 A numeric argument acts as a repeat count.
1911
1912 @item C-c C-b
1913 @kindex C-c C-b @r{(SGML mode)}
1914 @findex sgml-skip-tag-backward
1915 Skip backward across a balanced tag group (which extends from an
1916 opening tag through its corresponding closing tag)
1917 (@code{sgml-skip-tag-backward}). A numeric argument acts as a repeat
1918 count.
1919
1920 @item C-c C-d
1921 @kindex C-c C-d @r{(SGML mode)}
1922 @findex sgml-delete-tag
1923 Delete the tag at or after point, and delete the matching tag too
1924 (@code{sgml-delete-tag}). If the tag at or after point is an opening
1925 tag, delete the closing tag too; if it is a closing tag, delete the
1926 opening tag too.
1927
1928 @item C-c ? @var{tag} @key{RET}
1929 @kindex C-c ? @r{(SGML mode)}
1930 @findex sgml-tag-help
1931 Display a description of the meaning of tag @var{tag}
1932 (@code{sgml-tag-help}). If the argument @var{tag} is empty, describe
1933 the tag at point.
1934
1935 @item C-c /
1936 @kindex C-c / @r{(SGML mode)}
1937 @findex sgml-close-tag
1938 Insert a close tag for the innermost unterminated tag
1939 (@code{sgml-close-tag}). If called within a tag or a comment,
1940 close it instead of inserting a close tag.
1941
1942 @item C-c 8
1943 @kindex C-c 8 @r{(SGML mode)}
1944 @findex sgml-name-8bit-mode
1945 Toggle a minor mode in which Latin-1 characters insert the
1946 corresponding SGML commands that stand for them, instead of the
1947 characters themselves (@code{sgml-name-8bit-mode}).
1948
1949 @item C-c C-v
1950 @kindex C-c C-v @r{(SGML mode)}
1951 @findex sgml-validate
1952 Run a shell command (which you must specify) to validate the current
1953 buffer as SGML (@code{sgml-validate}).
1954
1955 @item C-c @key{TAB}
1956 @kindex C-c TAB @r{(SGML mode)}
1957 @findex sgml-tags-invisible
1958 Toggle the visibility of existing tags in the buffer. This can be
1959 used as a cheap preview (@code{sgml-tags-invisible}).
1960 @end table
1961
1962 @cindex nXML mode
1963 @cindex mode, nXML
1964 @findex nxml-mode
1965 @cindex XML schema
1966 The major mode for editing XML documents is called nXML mode. This
1967 is a powerful major mode that can recognize many existing XML schema
1968 and use them to provide completion of XML elements via
1969 @kbd{M-@key{TAB}}, as well as on-the-fly XML
1970 validation with error highlighting. To enable nXML mode in an
1971 existing buffer, type @kbd{M-x nxml-mode}, or, equivalently, @kbd{M-x
1972 xml-mode}. Emacs uses nXML mode for files which have the extension
1973 @file{.xml}. For XHTML files, which have the extension @file{.xhtml},
1974 Emacs uses HTML mode by default; you can make it use nXML mode by
1975 customizing the variable @code{auto-mode-alist} (@pxref{Choosing
1976 Modes}).
1977 @ifinfo
1978 nXML mode is described in its own manual: @xref{Top, nXML
1979 Mode,,nxml-mode, nXML Mode}.
1980 @end ifinfo
1981 @ifnotinfo
1982 nXML mode is described in an Info manual, which is distributed with
1983 Emacs.
1984 @end ifnotinfo
1985
1986 @vindex sgml-xml-mode
1987 You may choose to use the less powerful SGML mode for editing XML,
1988 since XML is a strict subset of SGML@. To enable SGML mode in an
1989 existing buffer, type @kbd{M-x sgml-mode}. On enabling SGML mode,
1990 Emacs examines the buffer to determine whether it is XML; if so, it
1991 sets the variable @code{sgml-xml-mode} to a non-@code{nil} value.
1992 This causes SGML mode's tag insertion commands, described above, to
1993 always insert explicit closing tags as well.
1994
1995 @node Nroff Mode
1996 @section Nroff Mode
1997
1998 @cindex nroff
1999 @findex nroff-mode
2000 @vindex nroff-mode-hook
2001 Nroff mode, a major mode derived from Text mode, is
2002 specialized for editing nroff files (e.g., Unix man pages). Type
2003 @kbd{M-x nroff-mode} to enter this mode. Entering Nroff mode runs the
2004 hook @code{text-mode-hook}, then @code{nroff-mode-hook}
2005 (@pxref{Hooks}).
2006
2007 In Nroff mode, nroff command lines are treated as paragraph
2008 separators, pages are separated by @samp{.bp} commands, and comments
2009 start with backslash-doublequote. It also defines these commands:
2010
2011 @findex forward-text-line
2012 @findex backward-text-line
2013 @findex count-text-lines
2014 @kindex M-n @r{(Nroff mode)}
2015 @kindex M-p @r{(Nroff mode)}
2016 @kindex M-? @r{(Nroff mode)}
2017 @table @kbd
2018 @item M-n
2019 Move to the beginning of the next line that isn't an nroff command
2020 (@code{forward-text-line}). An argument is a repeat count.
2021 @item M-p
2022 Like @kbd{M-n} but move up (@code{backward-text-line}).
2023 @item M-?
2024 Displays in the echo area the number of text lines (lines that are not
2025 nroff commands) in the region (@code{count-text-lines}).
2026 @end table
2027
2028 @findex electric-nroff-mode
2029 Electric Nroff mode is a buffer-local minor mode that can be used
2030 with Nroff mode. To toggle this minor mode, type @kbd{M-x
2031 electric-nroff-mode} (@pxref{Minor Modes}). When the mode is on, each
2032 time you type @key{RET} to end a line containing an nroff command that
2033 opens a kind of grouping, the nroff command to close that grouping is
2034 automatically inserted on the following line.
2035
2036 If you use Outline minor mode with Nroff mode (@pxref{Outline
2037 Mode}), heading lines are lines of the form @samp{.H} followed by a
2038 number (the header level).
2039
2040 @node Enriched Text
2041 @section Enriched Text
2042 @cindex Enriched mode
2043 @cindex mode, Enriched
2044 @cindex enriched text
2045 @cindex WYSIWYG
2046 @cindex word processing
2047 @cindex text/enriched MIME format
2048
2049 Enriched mode is a minor mode for editing formatted text files in a
2050 WYSIWYG (What You See Is What You Get) fashion. When Enriched
2051 mode is enabled, you can apply various formatting properties to the
2052 text in the buffer, such as fonts and colors; upon saving the buffer,
2053 those properties are saved together with the text, using the MIME
2054 @samp{text/enriched} file format.
2055
2056 Enriched mode is typically used with Text mode (@pxref{Text Mode}).
2057 It is @emph{not} compatible with Font Lock mode, which is used by many
2058 major modes, including most programming language modes, for syntax
2059 highlighting (@pxref{Font Lock}). Unlike Enriched mode, Font Lock
2060 mode assigns text properties automatically, based on the current
2061 buffer contents; those properties are not saved to disk.
2062
2063 The file @file{enriched.txt} in Emacs's @code{data-directory}
2064 serves as an example of the features of Enriched mode.
2065
2066 @menu
2067 * Enriched Mode:: Entering and exiting Enriched mode.
2068 * Hard and Soft Newlines:: There are two different kinds of newlines.
2069 * Editing Format Info:: How to edit text properties.
2070 * Enriched Faces:: Bold, italic, underline, etc.
2071 * Enriched Indentation:: Changing the left and right margins.
2072 * Enriched Justification:: Centering, setting text flush with the
2073 left or right margin, etc.
2074 * Enriched Properties:: The special text properties submenu.
2075 @end menu
2076
2077 @node Enriched Mode
2078 @subsection Enriched Mode
2079
2080 Enriched mode is a buffer-local minor mode (@pxref{Minor Modes}).
2081 When you visit a file that has been saved in the @samp{text/enriched}
2082 format, Emacs automatically enables Enriched mode, and applies the
2083 formatting information in the file to the buffer text. When you save
2084 a buffer with Enriched mode enabled, it is saved using the
2085 @samp{text/enriched} format, including the formatting information.
2086
2087 @findex enriched-mode
2088 To create a new file of formatted text, visit the nonexistent file
2089 and type @kbd{M-x enriched-mode}. This command actually toggles
2090 Enriched mode. With a prefix argument, it enables Enriched mode if
2091 the argument is positive, and disables Enriched mode otherwise. If
2092 you disable Enriched mode, Emacs no longer saves the buffer using the
2093 @samp{text/enriched} format; any formatting properties that have been
2094 added to the buffer remain in the buffer, but they are not saved to
2095 disk.
2096
2097 @vindex enriched-translations
2098 Enriched mode does not save all Emacs text properties, only those
2099 specified in the variable @code{enriched-translations}. These include
2100 properties for fonts, colors, indentation, and justification.
2101
2102 @findex format-decode-buffer
2103 If you visit a file and Emacs fails to recognize that it is in the
2104 @samp{text/enriched} format, type @kbd{M-x format-decode-buffer}.
2105 This command prompts for a file format, and re-reads the file in that
2106 format. Specifying the @samp{text/enriched} format automatically
2107 enables Enriched mode.
2108
2109 To view a @samp{text/enriched} file in raw form (as plain text with
2110 markup tags rather than formatted text), use @kbd{M-x
2111 find-file-literally} (@pxref{Visiting}).
2112
2113 @xref{Format Conversion,, Format Conversion, elisp, the Emacs Lisp
2114 Reference Manual}, for details of how Emacs recognizes and converts
2115 file formats like @samp{text/enriched}. @xref{Text Properties,,,
2116 elisp, the Emacs Lisp Reference Manual}, for more information about
2117 text properties.
2118
2119 @node Hard and Soft Newlines
2120 @subsection Hard and Soft Newlines
2121 @cindex hard newline
2122 @cindex soft newline
2123 @cindex newlines, hard and soft
2124
2125 @cindex use-hard-newlines
2126 In Enriched mode, Emacs distinguishes between two different kinds of
2127 newlines, @dfn{hard} newlines and @dfn{soft} newlines. You can also
2128 enable or disable this feature in other buffers, by typing @kbd{M-x
2129 use-hard-newlines}.
2130
2131 Hard newlines are used to separate paragraphs, or anywhere there
2132 needs to be a line break regardless of how the text is filled; soft
2133 newlines are used for filling. The @key{RET} (@code{newline}) and
2134 @kbd{C-o} (@code{open-line}) commands insert hard newlines. The fill
2135 commands, including Auto Fill (@pxref{Auto Fill}), insert only soft
2136 newlines and delete only soft newlines, leaving hard newlines alone.
2137
2138 @c FIXME: I don't see 'unfilled' in that node. --xfq
2139 Thus, when editing with Enriched mode, you should not use @key{RET}
2140 or @kbd{C-o} to break lines in the middle of filled paragraphs. Use
2141 Auto Fill mode or explicit fill commands (@pxref{Fill Commands})
2142 instead. Use @key{RET} or @kbd{C-o} where line breaks should always
2143 remain, such as in tables and lists. For such lines, you may also
2144 want to set the justification style to @code{unfilled}
2145 (@pxref{Enriched Justification}).
2146
2147 @node Editing Format Info
2148 @subsection Editing Format Information
2149
2150 The easiest way to alter properties is with the @samp{Text
2151 Properties} menu. You can get to this menu from the @samp{Edit} menu
2152 in the menu bar (@pxref{Menu Bar}), or with @kbd{C-Mouse-2}
2153 (@pxref{Menu Mouse Clicks}). Some of the commands in the @samp{Text
2154 Properties} menu are listed below (you can also invoke them with
2155 @kbd{M-x}):
2156
2157 @table @code
2158 @findex facemenu-remove-face-props
2159 @item Remove Face Properties
2160 Remove face properties from the region
2161 (@code{facemenu-remove-face-props}).
2162
2163 @findex facemenu-remove-all
2164 @item Remove Text Properties
2165 Remove all text properties from the region, including face properties
2166 (@code{facemenu-remove-all}).
2167
2168 @findex describe-text-properties
2169 @cindex text properties of characters
2170 @cindex overlays at character position
2171 @cindex widgets at buffer position
2172 @cindex buttons at buffer position
2173 @item Describe Properties
2174 List all text properties and other information about the character
2175 following point (@code{describe-text-properties}).
2176
2177 @item Display Faces
2178 Display a list of defined faces (@code{list-faces-display}).
2179 @xref{Faces}.
2180
2181 @item Display Colors
2182 Display a list of defined colors (@code{list-colors-display}).
2183 @xref{Colors}.
2184 @end table
2185
2186 @noindent
2187 The other menu entries are described in the following sections.
2188
2189 @node Enriched Faces
2190 @subsection Faces in Enriched Text
2191
2192 The following commands can be used to add or remove faces
2193 (@pxref{Faces}). Each applies to the text in the region if the mark
2194 is active, and to the next self-inserting character if the mark is
2195 inactive. With a prefix argument, each command applies to the next
2196 self-inserting character even if the region is active.
2197
2198 @table @kbd
2199 @kindex M-o d @r{(Enriched mode)}
2200 @findex facemenu-set-default
2201 @item M-o d
2202 Remove all @code{face} properties (@code{facemenu-set-default}).
2203
2204 @kindex M-o b @r{(Enriched mode)}
2205 @findex facemenu-set-bold
2206 @item M-o b
2207 Apply the @code{bold} face (@code{facemenu-set-bold}).
2208
2209 @kindex M-o i @r{(Enriched mode)}
2210 @findex facemenu-set-italic
2211 @item M-o i
2212 Apply the @code{italic} face (@code{facemenu-set-italic}).
2213
2214 @kindex M-o l @r{(Enriched mode)}
2215 @findex facemenu-set-bold-italic
2216 @item M-o l
2217 Apply the @code{bold-italic} face (@code{facemenu-set-bold-italic}).
2218
2219 @kindex M-o u @r{(Enriched mode)}
2220 @findex facemenu-set-underline
2221 @item M-o u
2222 Apply the @code{underline} face (@code{facemenu-set-underline}).
2223
2224 @kindex M-o o @r{(Enriched mode)}
2225 @findex facemenu-set-face
2226 @item M-o o @var{face} @key{RET}
2227 Apply the face @var{face} (@code{facemenu-set-face}).
2228
2229 @findex facemenu-set-foreground
2230 @item M-x facemenu-set-foreground
2231 Prompt for a color (@pxref{Colors}), and apply it as a foreground
2232 color.
2233
2234 @findex facemenu-set-background
2235 @item M-x facemenu-set-background
2236 Prompt for a color, and apply it as a background color.
2237 @end table
2238
2239 @noindent
2240 These command are also available via the Text Properties menu.
2241
2242 A self-inserting character normally inherits the face properties
2243 (and most other text properties) from the preceding character in the
2244 buffer. If you use one of the above commands to specify the face for
2245 the next self-inserting character, that character will not inherit the
2246 faces properties from the preceding character, but it will still
2247 inherit other text properties.
2248
2249 Enriched mode defines two additional faces: @code{excerpt} and
2250 @code{fixed}. These correspond to codes used in the text/enriched
2251 file format. The @code{excerpt} face is intended for quotations; by
2252 default, it appears the same as @code{italic}. The @code{fixed} face
2253 specifies fixed-width text; by default, it appears the same as
2254 @code{bold}.
2255
2256 @node Enriched Indentation
2257 @subsection Indentation in Enriched Text
2258
2259 In Enriched mode, you can specify different amounts of indentation
2260 for the right or left margin of a paragraph or a part of a paragraph.
2261 These margins also affect fill commands such as @kbd{M-q}
2262 (@pxref{Filling}).
2263
2264 The Indentation submenu of Text Properties offers commands
2265 for specifying indentation:
2266
2267 @table @code
2268 @kindex C-x TAB @r{(Enriched mode)}
2269 @findex increase-left-margin
2270 @item Indent More
2271 Indent the region by 4 columns (@code{increase-left-margin}). In
2272 Enriched mode, this command is also available on @kbd{C-x @key{TAB}}; if
2273 you supply a numeric argument, that says how many columns to add to the
2274 margin (a negative argument reduces the number of columns).
2275
2276 @item Indent Less
2277 Remove 4 columns of indentation from the region.
2278
2279 @item Indent Right More
2280 Make the text narrower by indenting 4 columns at the right margin.
2281
2282 @item Indent Right Less
2283 Remove 4 columns of indentation from the right margin.
2284 @end table
2285
2286 @vindex standard-indent
2287 The variable @code{standard-indent} specifies how many columns these
2288 commands should add to or subtract from the indentation. The default
2289 value is 4. The default right margin for Enriched mode is controlled
2290 by the variable @code{fill-column}, as usual.
2291
2292 @kindex C-c [ @r{(Enriched mode)}
2293 @kindex C-c ] @r{(Enriched mode)}
2294 @findex set-left-margin
2295 @findex set-right-margin
2296 You can also type @kbd{C-c [} (@code{set-left-margin}) and @kbd{C-c
2297 ]} (@code{set-right-margin}) to set the left and right margins. You
2298 can specify the margin width with a numeric argument; otherwise these
2299 commands prompt for a value via the minibuffer.
2300
2301 The fill prefix, if any, works in addition to the specified paragraph
2302 indentation: @kbd{C-x .} does not include the specified indentation's
2303 whitespace in the new value for the fill prefix, and the fill commands
2304 look for the fill prefix after the indentation on each line. @xref{Fill
2305 Prefix}.
2306
2307 @node Enriched Justification
2308 @subsection Justification in Enriched Text
2309 @cindex justification style
2310
2311 In Enriched mode, you can use the following commands to specify
2312 various @dfn{justification styles} for filling. These commands apply
2313 to the paragraph containing point, or, if the region is active, to all
2314 paragraphs overlapping the region.
2315
2316 @table @kbd
2317 @kindex M-j l @r{(Enriched mode)}
2318 @findex set-justification-left
2319 @item M-j l
2320 Align lines to the left margin (@code{set-justification-left}).
2321
2322 @kindex M-j r @r{(Enriched mode)}
2323 @findex set-justification-right
2324 @item M-j r
2325 Align lines to the right margin (@code{set-justification-right}).
2326
2327 @kindex M-j b @r{(Enriched mode)}
2328 @findex set-justification-full
2329 @item M-j b
2330 Align lines to both margins, inserting spaces in the middle of the
2331 line to achieve this (@code{set-justification-full}).
2332
2333 @kindex M-j c @r{(Enriched mode)}
2334 @kindex M-S @r{(Enriched mode)}
2335 @findex set-justification-center
2336 @item M-j c
2337 @itemx M-S
2338 Center lines between the margins (@code{set-justification-center}).
2339
2340 @kindex M-j u @r{(Enriched mode)}
2341 @findex set-justification-none
2342 @item M-j u
2343 Turn off filling entirely (@code{set-justification-none}). The fill
2344 commands do nothing on text with this setting. You can, however,
2345 still indent the left margin.
2346 @end table
2347
2348 @vindex default-justification
2349 You can also specify justification styles using the Justification
2350 submenu in the Text Properties menu. The default justification style
2351 is specified by the per-buffer variable @code{default-justification}.
2352 Its value should be one of the symbols @code{left}, @code{right},
2353 @code{full}, @code{center}, or @code{none}; their meanings correspond
2354 to the commands above.
2355
2356 @node Enriched Properties
2357 @subsection Setting Other Text Properties
2358
2359 The Special Properties submenu of Text Properties has entries for
2360 adding or removing three other text properties: @code{read-only},
2361 (which disallows alteration of the text), @code{invisible} (which
2362 hides text), and @code{intangible} (which disallows moving point
2363 within the text). The @samp{Remove Special} menu item removes all of
2364 these special properties from the text in the region.
2365
2366 The @code{invisible} and @code{intangible} properties are not saved.
2367
2368 @node Text Based Tables
2369 @section Editing Text-based Tables
2370 @cindex table mode
2371 @cindex text-based tables
2372
2373 The @code{table} package provides commands to easily edit text-based
2374 tables. Here is an example of what such a table looks like:
2375
2376 @smallexample
2377 @group
2378 +-----------------+--------------------------------+-----------------+
2379 | Command | Description | Key Binding |
2380 +-----------------+--------------------------------+-----------------+
2381 | forward-char |Move point right N characters | C-f |
2382 | |(left if N is negative). | |
2383 | | | |
2384 +-----------------+--------------------------------+-----------------+
2385 | backward-char |Move point left N characters | C-b |
2386 | |(right if N is negative). | |
2387 | | | |
2388 +-----------------+--------------------------------+-----------------+
2389 @end group
2390 @end smallexample
2391
2392 When Emacs recognizes such a stretch of text as a table
2393 (@pxref{Table Recognition}), editing the contents of each table cell
2394 will automatically resize the table, whenever the contents become too
2395 large to fit in the cell. You can use the commands defined in the
2396 following sections for navigating and editing the table layout.
2397
2398 @findex table-fixed-width-mode
2399 Type @kbd{M-x table-fixed-width-mode} to toggle the automatic table
2400 resizing feature.
2401
2402 @menu
2403 * Table Definition:: What is a text based table.
2404 * Table Creation:: How to create a table.
2405 * Table Recognition:: How to activate and deactivate tables.
2406 * Cell Commands:: Cell-oriented commands in a table.
2407 * Cell Justification:: Justifying cell contents.
2408 * Table Rows and Columns:: Inserting and deleting rows and columns.
2409 * Table Conversion:: Converting between plain text and tables.
2410 * Table Misc:: Table miscellany.
2411 @end menu
2412
2413 @node Table Definition
2414 @subsection What is a Text-based Table?
2415 @cindex cells, for text-based tables
2416
2417 A @dfn{table} consists of a rectangular text area which is divided
2418 into @dfn{cells}. Each cell must be at least one character wide and
2419 one character high, not counting its border lines. A cell can be
2420 subdivided into more cells, but they cannot overlap.
2421
2422 Cell border lines are drawn with three special characters, specified
2423 by the following variables:
2424
2425 @table @code
2426 @vindex table-cell-vertical-char
2427 @item table-cell-vertical-char
2428 The character used for vertical lines. The default is @samp{|}.
2429
2430 @vindex table-cell-horizontal-chars
2431 @item table-cell-horizontal-chars
2432 The characters used for horizontal lines. The default is @samp{"-="}.
2433
2434 @vindex table-cell-intersection-char
2435 @item table-cell-intersection-char
2436 The character used for the intersection of horizontal and vertical
2437 lines. The default is @samp{+}.
2438 @end table
2439
2440 @noindent
2441 The following are examples of @emph{invalid} tables:
2442
2443 @example
2444 +-----+ +--+ +-++--+
2445 | | | | | || |
2446 | | | | | || |
2447 +--+ | +--+--+ +-++--+
2448 | | | | | | +-++--+
2449 | | | | | | | || |
2450 +--+--+ +--+--+ +-++--+
2451 a b c
2452 @end example
2453
2454 @noindent
2455 From left to right:
2456
2457 @enumerate a
2458 @item
2459 Overlapped cells or non-rectangular cells are not allowed.
2460 @item
2461 The border must be rectangular.
2462 @item
2463 Cells must have a minimum width/height of one character.
2464 @end enumerate
2465
2466 @node Table Creation
2467 @subsection Creating a Table
2468 @cindex create a text-based table
2469 @cindex table creation
2470
2471 @findex table-insert
2472 To create a text-based table from scratch, type @kbd{M-x
2473 table-insert}. This command prompts for the number of table columns,
2474 the number of table rows, cell width and cell height. The cell width
2475 and cell height do not include the cell borders; each can be specified
2476 as a single integer (which means each cell is given the same
2477 width/height), or as a sequence of integers separated by spaces or
2478 commas (which specify the width/height of the individual table
2479 columns/rows, counting from left to right for table columns and from
2480 top to bottom for table rows). The specified table is then inserted
2481 at point.
2482
2483 The table inserted by @kbd{M-x table-insert} contains special text
2484 properties, which tell Emacs to treat it specially as a text-based
2485 table. If you save the buffer to a file and visit it again later,
2486 those properties are lost, and the table appears to Emacs as an
2487 ordinary piece of text. See the next section, for how to convert it
2488 back into a table.
2489
2490 @node Table Recognition
2491 @subsection Table Recognition
2492 @cindex table recognition
2493
2494 @findex table-recognize
2495 @findex table-unrecognize
2496 Existing text-based tables in a buffer, which lack the special text
2497 properties applied by @kbd{M-x table-insert}, are not treated
2498 specially as tables. To apply those text properties, type @kbd{M-x
2499 table-recognize}. This command scans the current buffer,
2500 @dfn{recognizes} valid table cells, and applies the relevant text
2501 properties. Conversely, type @kbd{M-x table-unrecognize} to
2502 @dfn{unrecognize} all tables in the current buffer, removing the
2503 special text properties and converting tables back to plain text.
2504
2505 You can also use the following commands to selectively recognize or
2506 unrecognize tables:
2507
2508 @table @kbd
2509 @findex table-recognize-region
2510 @item M-x table-recognize-region
2511 Recognize tables within the current region.
2512
2513 @findex table-unrecognize-region
2514 @item M-x table-unrecognize-region
2515 Unrecognize tables within the current region.
2516
2517 @findex table-recognize-table
2518 @item M-x table-recognize-table
2519 Recognize the table at point and activate it.
2520
2521 @findex table-unrecognize-table
2522 @item M-x table-unrecognize-table
2523 Deactivate the table at point.
2524
2525 @findex table-recognize-cell
2526 @item M-x table-recognize-cell
2527 Recognize the cell at point and activate it.
2528
2529 @findex table-unrecognize-cell
2530 @item M-x table-unrecognize-cell
2531 Deactivate the cell at point.
2532 @end table
2533
2534 @xref{Table Conversion}, for another way to recognize a table.
2535
2536 @node Cell Commands
2537 @subsection Commands for Table Cells
2538
2539 @findex table-forward-cell
2540 @findex table-backward-cell
2541 The commands @kbd{M-x table-forward-cell} and @kbd{M-x
2542 table-backward-cell} move point from the current cell to an adjacent
2543 cell. The order is cyclic: when point is in the last cell of a table,
2544 @kbd{M-x table-forward-cell} moves to the first cell. Likewise, when
2545 point is on the first cell, @kbd{M-x table-backward-cell} moves to the
2546 last cell.
2547
2548 @findex table-span-cell
2549 @kbd{M-x table-span-cell} prompts for a direction---right, left,
2550 above, or below---and merges the current cell with the adjacent cell
2551 in that direction. This command signals an error if the merge would
2552 result in an illegitimate cell layout.
2553
2554 @findex table-split-cell
2555 @findex table-split-cell-vertically
2556 @findex table-split-cell-horizontally
2557 @cindex text-based tables, splitting cells
2558 @cindex splitting table cells
2559 @kbd{M-x table-split-cell} splits the current cell vertically or
2560 horizontally, prompting for the direction with the minibuffer. To
2561 split in a specific direction, use @kbd{M-x
2562 table-split-cell-vertically} and @kbd{M-x
2563 table-split-cell-horizontally}. When splitting vertically, the old
2564 cell contents are automatically split between the two new cells. When
2565 splitting horizontally, you are prompted for how to divide the cell
2566 contents, if the cell is non-empty; the options are @samp{split}
2567 (divide the contents at point), @samp{left} (put all the contents in
2568 the left cell), and @samp{right} (put all the contents in the right
2569 cell).
2570
2571 The following commands enlarge or shrink a cell. By default, they
2572 resize by one row or column; if a numeric argument is supplied, that
2573 specifies the number of rows or columns to resize by.
2574
2575 @table @kbd
2576 @findex table-heighten-cell
2577 @item M-x table-heighten-cell
2578 Enlarge the current cell vertically.
2579
2580 @findex table-shorten-cell
2581 @item M-x table-shorten-cell
2582 Shrink the current cell vertically.
2583
2584 @findex table-widen-cell
2585 @item M-x table-widen-cell
2586 Enlarge the current cell horizontally.
2587
2588 @findex table-narrow-cell
2589 @item M-x table-narrow-cell
2590 Shrink the current cell horizontally.
2591 @end table
2592
2593 @node Cell Justification
2594 @subsection Cell Justification
2595 @cindex justification in text-based tables
2596
2597 The command @kbd{M-x table-justify} imposes @dfn{justification} on
2598 one or more cells in a text-based table. Justification determines how
2599 the text in the cell is aligned, relative to the edges of the cell.
2600 Each cell in a table can be separately justified.
2601
2602 @findex table-justify
2603 @kbd{M-x table-justify} first prompts for what to justify; the
2604 options are @samp{cell} (just the current cell), @samp{column} (all
2605 cells in the current table column) and @samp{row} (all cells in the
2606 current table row). The command then prompts for the justification
2607 style; the options are @code{left}, @code{center}, @code{right},
2608 @code{top}, @code{middle}, @code{bottom}, or @code{none} (meaning no
2609 vertical justification).
2610
2611 Horizontal and vertical justification styles are specified
2612 independently, and both types can be in effect simultaneously; for
2613 instance, you can call @kbd{M-x table-justify} twice, once to specify
2614 @code{right} justification and once to specify @code{bottom}
2615 justification, to align the contents of a cell to the bottom right.
2616
2617 @vindex table-detect-cell-alignment
2618 The justification style is stored in the buffer as a text property,
2619 and is lost when you kill the buffer or exit Emacs. However, the
2620 table recognition commands, such as @kbd{M-x table-recognize}
2621 (@pxref{Table Recognition}), attempt to determine and re-apply each
2622 cell's justification style, by examining its contents. To disable
2623 this feature, change the variable @code{table-detect-cell-alignment}
2624 to @code{nil}.
2625
2626 @node Table Rows and Columns
2627 @subsection Table Rows and Columns
2628 @cindex inserting rows and columns in text-based tables
2629
2630 @findex table-insert-row
2631 @kbd{M-x table-insert-row} inserts a row of cells before the current
2632 table row. The current row, together with point, is pushed down past
2633 the new row. To insert a row after the last row at the bottom of a
2634 table, invoke this command with point below the table, just below the
2635 bottom edge. You can insert more than one row at a time by using a
2636 numeric prefix argument.
2637
2638 @c A numeric prefix argument specifies the number of rows to insert.
2639
2640 @findex table-insert-column
2641 Similarly, @kbd{M-x table-insert-column} inserts a column of cells
2642 to the left of the current table column. To insert a column to the
2643 right side of the rightmost column, invoke this command with point to
2644 the right of the rightmost column, outside the table. A numeric
2645 prefix argument specifies the number of columns to insert.
2646
2647 @cindex deleting rows and column in text-based tables
2648 @kbd{M-x table-delete-column} deletes the column of cells at point.
2649 Similarly, @kbd{M-x table-delete-row} deletes the row of cells at
2650 point. A numeric prefix argument to either command specifies the
2651 number of columns or rows to delete.
2652
2653 @node Table Conversion
2654 @subsection Converting Between Plain Text and Tables
2655 @cindex text to table
2656 @cindex table to text
2657
2658 @findex table-capture
2659 The command @kbd{M-x table-capture} captures plain text in a region
2660 and turns it into a table. Unlike @kbd{M-x table-recognize}
2661 (@pxref{Table Recognition}), the original text does not need to have a
2662 table appearance; it only needs to have a logical table-like
2663 structure.
2664
2665 For example, suppose we have the following numbers, which are
2666 divided into three lines and separated horizontally by commas:
2667
2668 @example
2669 1, 2, 3, 4
2670 5, 6, 7, 8
2671 , 9, 10
2672 @end example
2673
2674 @noindent
2675 Invoking @kbd{M-x table-capture} on that text produces this table:
2676
2677 @example
2678 +-----+-----+-----+-----+
2679 |1 |2 |3 |4 |
2680 +-----+-----+-----+-----+
2681 |5 |6 |7 |8 |
2682 +-----+-----+-----+-----+
2683 | |9 |10 | |
2684 +-----+-----+-----+-----+
2685 @end example
2686
2687 @findex table-release
2688 @kbd{M-x table-release} does the opposite: it converts a table back
2689 to plain text, removing its cell borders.
2690
2691 One application of this pair of commands is to edit a text in
2692 layout. Look at the following three paragraphs (the latter two are
2693 indented with header lines):
2694
2695 @example
2696 table-capture is a powerful command.
2697 Here are some things it can do:
2698
2699 Parse Cell Items Using row and column delimiter regexps,
2700 it parses the specified text area and
2701 extracts cell items into a table.
2702 @end example
2703
2704 @noindent
2705 Applying @code{table-capture} to a region containing the above text,
2706 with empty strings for the column and row delimiter regexps, creates a
2707 table with a single cell like the following one.
2708
2709 @smallexample
2710 @group
2711 +----------------------------------------------------------+
2712 |table-capture is a powerful command. |
2713 |Here are some things it can do: |
2714 | |
2715 |Parse Cell Items Using row and column delimiter regexps,|
2716 | it parses the specified text area and |
2717 | extracts cell items into a table. |
2718 +----------------------------------------------------------+
2719 @end group
2720 @end smallexample
2721
2722 @noindent
2723 We can then use the cell splitting commands (@pxref{Cell Commands}) to
2724 subdivide the table so that each paragraph occupies a cell:
2725
2726 @smallexample
2727 +----------------------------------------------------------+
2728 |table-capture is a powerful command. |
2729 |Here are some things it can do: |
2730 +-----------------+----------------------------------------+
2731 |Parse Cell Items | Using row and column delimiter regexps,|
2732 | | it parses the specified text area and |
2733 | | extracts cell items into a table. |
2734 +-----------------+----------------------------------------+
2735 @end smallexample
2736
2737 @noindent
2738 Each cell can now be edited independently without affecting the layout
2739 of other cells. When finished, we can invoke @kbd{M-x table-release}
2740 to convert the table back to plain text.
2741
2742 @node Table Misc
2743 @subsection Table Miscellany
2744
2745 @cindex table dimensions
2746 @findex table-query-dimension
2747 The command @code{table-query-dimension} reports the layout of the
2748 table and table cell at point. Here is an example of its output:
2749
2750 @smallexample
2751 Cell: (21w, 6h), Table: (67w, 16h), Dim: (2c, 3r), Total Cells: 5
2752 @end smallexample
2753
2754 @noindent
2755 This indicates that the current cell is 21 characters wide and 6 lines
2756 high, the table is 67 characters wide and 16 lines high with 2 columns
2757 and 3 rows, and a total of 5 cells.
2758
2759 @findex table-insert-sequence
2760 @kbd{M-x table-insert-sequence} inserts a string into each cell.
2761 Each string is a part of a sequence i.e., a series of increasing
2762 integer numbers.
2763
2764 @cindex table for HTML and LaTeX
2765 @findex table-generate-source
2766 @kbd{M-x table-generate-source} generates a table formatted for a
2767 specific markup language. It asks for a language (which must be one
2768 of @code{html}, @code{latex}, or @code{cals}), a destination buffer in
2769 which to put the result, and a table caption, and then inserts the
2770 generated table into the specified buffer. The default destination
2771 buffer is @code{table.@var{lang}}, where @var{lang} is the language
2772 you specified.
2773
2774 @node Two-Column
2775 @section Two-Column Editing
2776 @cindex two-column editing
2777 @cindex splitting columns
2778 @cindex columns, splitting
2779
2780 Two-column mode lets you conveniently edit two side-by-side columns
2781 of text. It uses two side-by-side windows, each showing its own
2782 buffer. There are three ways to enter two-column mode:
2783
2784 @table @asis
2785 @item @kbd{@key{F2} 2} or @kbd{C-x 6 2}
2786 @kindex F2 2
2787 @kindex C-x 6 2
2788 @findex 2C-two-columns
2789 Enter two-column mode with the current buffer on the left, and on the
2790 right, a buffer whose name is based on the current buffer's name
2791 (@code{2C-two-columns}). If the right-hand buffer doesn't already
2792 exist, it starts out empty; the current buffer's contents are not
2793 changed.
2794
2795 This command is appropriate when the current buffer is empty or contains
2796 just one column and you want to add another column.
2797
2798 @item @kbd{@key{F2} s} or @kbd{C-x 6 s}
2799 @kindex F2 s
2800 @kindex C-x 6 s
2801 @findex 2C-split
2802 Split the current buffer, which contains two-column text, into two
2803 buffers, and display them side by side (@code{2C-split}). The current
2804 buffer becomes the left-hand buffer, but the text in the right-hand
2805 column is moved into the right-hand buffer. The current column
2806 specifies the split point. Splitting starts with the current line and
2807 continues to the end of the buffer.
2808
2809 This command is appropriate when you have a buffer that already contains
2810 two-column text, and you wish to separate the columns temporarily.
2811
2812 @item @kbd{@key{F2} b @var{buffer} @key{RET}}
2813 @itemx @kbd{C-x 6 b @var{buffer} @key{RET}}
2814 @kindex F2 b
2815 @kindex C-x 6 b
2816 @findex 2C-associate-buffer
2817 Enter two-column mode using the current buffer as the left-hand buffer,
2818 and using buffer @var{buffer} as the right-hand buffer
2819 (@code{2C-associate-buffer}).
2820 @end table
2821
2822 @kbd{@key{F2} s} or @kbd{C-x 6 s} looks for a column separator, which
2823 is a string that appears on each line between the two columns. You can
2824 specify the width of the separator with a numeric argument to
2825 @kbd{@key{F2} s}; that many characters, before point, constitute the
2826 separator string. By default, the width is 1, so the column separator
2827 is the character before point.
2828
2829 When a line has the separator at the proper place, @kbd{@key{F2} s}
2830 puts the text after the separator into the right-hand buffer, and
2831 deletes the separator. Lines that don't have the column separator at
2832 the proper place remain unsplit; they stay in the left-hand buffer, and
2833 the right-hand buffer gets an empty line to correspond. (This is the
2834 way to write a line that spans both columns while in two-column
2835 mode: write it in the left-hand buffer, and put an empty line in the
2836 right-hand buffer.)
2837
2838 @kindex F2 RET
2839 @kindex C-x 6 RET
2840 @findex 2C-newline
2841 The command @kbd{C-x 6 @key{RET}} or @kbd{@key{F2} @key{RET}}
2842 (@code{2C-newline}) inserts a newline in each of the two buffers at
2843 corresponding positions. This is the easiest way to add a new line to
2844 the two-column text while editing it in split buffers.
2845
2846 @kindex F2 1
2847 @kindex C-x 6 1
2848 @findex 2C-merge
2849 When you have edited both buffers as you wish, merge them with
2850 @kbd{@key{F2} 1} or @kbd{C-x 6 1} (@code{2C-merge}). This copies the
2851 text from the right-hand buffer as a second column in the other buffer.
2852 To go back to two-column editing, use @kbd{@key{F2} s}.
2853
2854 @kindex F2 d
2855 @kindex C-x 6 d
2856 @findex 2C-dissociate
2857 Use @kbd{@key{F2} d} or @kbd{C-x 6 d} to dissociate the two buffers,
2858 leaving each as it stands (@code{2C-dissociate}). If the other buffer,
2859 the one not current when you type @kbd{@key{F2} d}, is empty,
2860 @kbd{@key{F2} d} kills it.