aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-12-03 00:50:10 +0800
committerChong Yidong2011-12-03 00:50:10 +0800
commit95ca9bc7340332c09c0a083aeae21cd25bb3928b (patch)
tree0cf4e9fba2910e9ee15fdc0d87e1ccbd42ca5b1c
parent99c79fee5189adb5c4fe52fab4cc1e9f55d2a6bf (diff)
downloademacs-95ca9bc7340332c09c0a083aeae21cd25bb3928b.tar.gz
emacs-95ca9bc7340332c09c0a083aeae21cd25bb3928b.zip
More updates to Text chapter of Emacs manual.
* text.texi (Pages): Mention how formfeed chars are displayed. (Auto Fill): Note convention for calling auto-fill-mode from Lisp. Describe adaptive filling more precisely. (Fill Commands): Note that filling removes excess whitespace. (Text Mode): Note auto-mode-alist entries for Text mode. TAB is now bound to indent-for-tab-command in Text mode. (Outline Mode): Copyedits. (Outline Visibility): Note that Reveal mode is a buffer-local minor mode. * modes.texi (Major Modes): Move note about checking major-mode in a hook function here, from Text mode.
-rw-r--r--doc/emacs/ChangeLog15
-rw-r--r--doc/emacs/modes.texi2
-rw-r--r--doc/emacs/text.texi480
3 files changed, 249 insertions, 248 deletions
diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 06e3c039238..d7bcb28b500 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,18 @@
12011-12-02 Chong Yidong <cyd@gnu.org>
2
3 * text.texi (Pages): Mention how formfeed chars are displayed.
4 (Auto Fill): Note convention for calling auto-fill-mode from Lisp.
5 Describe adaptive filling more precisely.
6 (Fill Commands): Note that filling removes excess whitespace.
7 (Text Mode): Note auto-mode-alist entries for Text mode. TAB is
8 now bound to indent-for-tab-command in Text mode.
9 (Outline Mode): Copyedits.
10 (Outline Visibility): Note that Reveal mode is a buffer-local
11 minor mode.
12
13 * modes.texi (Major Modes): Move note about checking major-mode in
14 a hook function here, from Text mode.
15
12011-11-28 Chong Yidong <cyd@gnu.org> 162011-11-28 Chong Yidong <cyd@gnu.org>
2 17
3 * text.texi (Words): Add xref to Position Info. 18 * text.texi (Words): Add xref to Position Info.
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index 60636ce040f..e5be13d6ce5 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -115,6 +115,8 @@ hooks. Each mode hook is named after its major mode, e.g. Fortran
115mode has @code{fortran-mode-hook}. Furthermore, all text-based major 115mode has @code{fortran-mode-hook}. Furthermore, all text-based major
116modes run @code{text-mode-hook}, and all programming language modes 116modes run @code{text-mode-hook}, and all programming language modes
117run @code{prog-mode-hook}, prior to running their own mode hooks. 117run @code{prog-mode-hook}, prior to running their own mode hooks.
118Hook functions can look at the value of the variable @code{major-mode}
119to see which mode is actually being entered.
118 120
119 Mode hooks are commonly used to enable minor modes (@pxref{Minor 121 Mode hooks are commonly used to enable minor modes (@pxref{Minor
120Modes}). For example, you can put the following lines in your init 122Modes}). For example, you can put the following lines in your init
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 5fdf4c5dabe..241acbaf333 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -319,15 +319,15 @@ in Fundamental mode, @code{paragraph-start} is @w{@code{"\f\\|[
319 319
320@cindex pages 320@cindex pages
321@cindex formfeed character 321@cindex formfeed character
322 Within some text files, text is divided into @dfn{pages}, which are 322 Within some text files, text is divided into @dfn{pages} delimited
323delimited by the @dfn{formfeed character} (@acronym{ASCII} code 12, 323by the @dfn{formfeed character} (@acronym{ASCII} code 12, also denoted
324sometimes denoted as @key{control-L}). When you print hardcopy for a 324as @key{control-L}), which is displayed in Emacs as the escape
325file, the formfeed character forces a page break: each page of the 325sequence @samp{^L} (@pxref{Text Display}). Traditionally, when such
326file goes on a separate page on paper. Most Emacs commands treat the 326text files are printed to hardcopy, each formfeed character forces a
327formfeed character just like any other character: you can insert it 327page break. Most Emacs commands treat it just like any other
328with @kbd{C-q C-l}, and delete it with @key{DEL}. However, since 328character, so you can insert it with @kbd{C-q C-l}, delete it with
329pages are often meaningful divisions of the file, Emacs provides 329@key{DEL}, etc. In addition, Emacs provides commands to move over
330commands to move over them and operate on them. 330pages and operate on them.
331 331
332@table @kbd 332@table @kbd
333@item M-x what-page 333@item M-x what-page
@@ -359,9 +359,9 @@ command moves forward past the next page delimiter.
359@kindex C-x C-p 359@kindex C-x C-p
360@findex mark-page 360@findex mark-page
361 The @kbd{C-x C-p} command (@code{mark-page}) puts point at the 361 The @kbd{C-x C-p} command (@code{mark-page}) puts point at the
362beginning of the current page and the mark at the end. The page 362beginning of the current page (after that page delimiter at the
363delimiter at the end is included (the mark follows it). The page 363front), and the mark at the end of the page (after the page delimiter
364delimiter at the front is excluded (point follows it). 364at the end).
365 365
366 @kbd{C-x C-p C-w} is a handy way to kill a page to move it 366 @kbd{C-x C-p C-w} is a handy way to kill a page to move it
367elsewhere. If you move to another page delimiter with @kbd{C-x [} and 367elsewhere. If you move to another page delimiter with @kbd{C-x [} and
@@ -403,9 +403,7 @@ beginning of a line.
403specified width. Emacs does filling in two ways. In Auto Fill mode, 403specified width. Emacs does filling in two ways. In Auto Fill mode,
404inserting text with self-inserting characters also automatically fills 404inserting text with self-inserting characters also automatically fills
405it. There are also explicit fill commands that you can use when editing 405it. There are also explicit fill commands that you can use when editing
406text leaves it unfilled. When you edit formatted text, you can specify 406text leaves it unfilled.
407a style of filling for each portion of the text (@pxref{Formatted
408Text}).
409 407
410@menu 408@menu
411* Auto Fill:: Auto Fill mode breaks long lines automatically. 409* Auto Fill:: Auto Fill mode breaks long lines automatically.
@@ -419,9 +417,9 @@ Text}).
419@cindex Auto Fill mode 417@cindex Auto Fill mode
420@cindex mode, Auto Fill 418@cindex mode, Auto Fill
421 419
422 @dfn{Auto Fill} mode is a minor mode in which lines are broken 420 @dfn{Auto Fill} mode is a buffer-local minor mode (@pxref{Minor
423automatically when they become too wide. Breaking happens only when 421Modes}) in which lines are broken automatically when they become too
424you type a @key{SPC} or @key{RET}. 422wide. Breaking happens only when you type a @key{SPC} or @key{RET}.
425 423
426@table @kbd 424@table @kbd
427@item M-x auto-fill-mode 425@item M-x auto-fill-mode
@@ -432,45 +430,43 @@ In Auto Fill mode, break lines when appropriate.
432@end table 430@end table
433 431
434@findex auto-fill-mode 432@findex auto-fill-mode
435 @kbd{M-x auto-fill-mode} turns Auto Fill mode on if it was off, or off 433 The mode command @kbd{M-x auto-fill-mode} toggles Auto Fill mode in
436if it was on. With a positive numeric argument it always turns Auto 434the current buffer. With a positive numeric argument, it enables Auto
437Fill mode on, and with a negative argument always turns it off. You can 435Fill mode, and with a negative argument it disables it. If
438see when Auto Fill mode is in effect by the presence of the word 436@code{auto-fill-mode} is called from Lisp with an omitted or
439@samp{Fill} in the mode line, inside the parentheses. Auto Fill mode is 437@code{nil} argument, it enables Auto Fill mode. To enable Auto Fill
440a minor mode which is enabled or disabled for each buffer individually. 438mode automatically in certain major modes, add @code{auto-fill-mode}
441@xref{Minor Modes}. 439to the mode hooks (@pxref{Major Modes}). When Auto Fill mode is
442 440enabled, the mode indicator @samp{Fill} appears in the mode line
443 In Auto Fill mode, lines are broken automatically at spaces when they 441(@pxref{Mode Line}).
444get longer than the desired width. Line breaking and rearrangement 442
445takes place only when you type @key{SPC} or @key{RET}. If you wish to 443 Auto Fill mode breaks lines automatically at spaces whenever they
446insert a space or newline without permitting line-breaking, type 444get longer than the desired width. This line breaking occurs only
447@kbd{C-q @key{SPC}} or @kbd{C-q C-j} (recall that a newline is really a 445when you type @key{SPC} or @key{RET}. If you wish to insert a space
448control-J). Also, @kbd{C-o} inserts a newline without line breaking. 446or newline without permitting line-breaking, type @kbd{C-q @key{SPC}}
449 447or @kbd{C-q C-j} respectively. Also, @kbd{C-o} inserts a newline
450 Auto Fill mode works well with programming-language modes, because it 448without line breaking.
451indents new lines with @key{TAB}. If a line ending in a comment gets 449
452too long, the text of the comment is split into two comment lines. 450 When Auto Fill mode breaks a line, it tries to obey the
453Optionally, new comment delimiters are inserted at the end of the first 451@dfn{adaptive fill prefix}: if a fill prefix can be deduced from the
454line and the beginning of the second so that each line is a separate 452first and/or second line of the current paragraph, it is inserted into
455comment; the variable @code{comment-multi-line} controls the choice 453the new line (@pxref{Adaptive Fill}). Otherwise the new line is
456(@pxref{Comments}). 454indented, as though you had typed @key{TAB} on it
457 455(@pxref{Indentation}). In a programming language mode, if a line is
458 Adaptive filling (@pxref{Adaptive Fill}) works for Auto Filling as 456broken in the middle of a comment, the comment is split by inserting
459well as for explicit fill commands. It takes a fill prefix 457new comment delimiters as appropriate.
460automatically from the second or first line of a paragraph. 458
461 459 Auto Fill mode does not refill entire paragraphs; it breaks lines
462 Auto Fill mode does not refill entire paragraphs; it can break lines but 460but does not merge lines. Therefore, editing in the middle of a
463cannot merge lines. So editing in the middle of a paragraph can result in 461paragraph can result in a paragraph that is not correctly filled. To
464a paragraph that is not correctly filled. The easiest way to make the 462fill it, call the explicit fill commands
465paragraph properly filled again is usually with the explicit fill commands. 463@iftex
464described in the next section.
465@end iftex
466@ifnottex 466@ifnottex
467@xref{Fill Commands}. 467(@pxref{Fill Commands}).
468@end ifnottex 468@end ifnottex
469 469
470 Many users like Auto Fill mode and want to use it in all text files.
471The section on init files says how to arrange this permanently for yourself.
472@xref{Init File}.
473
474@node Fill Commands 470@node Fill Commands
475@subsection Explicit Fill Commands 471@subsection Explicit Fill Commands
476 472
@@ -489,21 +485,23 @@ Center a line.
489 485
490@kindex M-q 486@kindex M-q
491@findex fill-paragraph 487@findex fill-paragraph
492 To refill a paragraph, use the command @kbd{M-q} 488 The command @kbd{M-q} (@code{fill-paragraph}) @dfn{fills} the
493(@code{fill-paragraph}). This operates on the paragraph that point is 489current paragraph. It redistributes the line breaks within the
494inside, or the one after point if point is between paragraphs. 490paragraph, and deletes any excess space and tab characters occurring
495Refilling works by removing all the line-breaks, then inserting new 491within the paragraph, in such a way that the lines end up fitting
496ones where necessary. When there is an active region, this command 492within a certain maximum width.
497operates on the text within the region like @code{fill-region}.
498 493
499@findex fill-region 494@findex fill-region
500 To refill many paragraphs, use @kbd{M-x fill-region}, which 495 Normally, @kbd{M-q} acts on the paragraph where point is, but if
501finds the paragraphs in the region and fills each of them. 496point is between paragraphs, it acts on the paragraph after point. If
497the region is active, it acts instead on the text in the region. You
498can also call @kbd{M-x fill-region} to specifically fill the text in
499the region.
502 500
503@findex fill-region-as-paragraph 501@findex fill-region-as-paragraph
504 @kbd{M-q} and @code{fill-region} use the same criteria as @kbd{M-h} 502 @kbd{M-q} and @code{fill-region} use the usual Emacs criteria for
505for finding paragraph boundaries (@pxref{Paragraphs}). For more 503finding paragraph boundaries (@pxref{Paragraphs}). For more control,
506control, you can use @kbd{M-x fill-region-as-paragraph}, which refills 504you can use @kbd{M-x fill-region-as-paragraph}, which refills
507everything between point and mark as a single paragraph. This command 505everything between point and mark as a single paragraph. This command
508deletes any blank lines within the region, so separate blocks of text 506deletes any blank lines within the region, so separate blocks of text
509end up combined into one block. 507end up combined into one block.
@@ -513,9 +511,18 @@ end up combined into one block.
513as well as filling it. This means that extra spaces are inserted to 511as well as filling it. This means that extra spaces are inserted to
514make the right margin line up exactly at the fill column. To remove 512make the right margin line up exactly at the fill column. To remove
515the extra spaces, use @kbd{M-q} with no argument. (Likewise for 513the extra spaces, use @kbd{M-q} with no argument. (Likewise for
516@code{fill-region}.) Another way to control justification, and choose 514@code{fill-region}.)
517other styles of filling, is with the @code{justification} text 515
518property; see @ref{Format Justification}. 516@vindex fill-column
517@kindex C-x f
518@findex set-fill-column
519 The maximum line width for filling is specified by the buffer-local
520variable @code{fill-column}. The default value (@pxref{Locals}) is
52170. The easiest way to set @code{fill-column} in the current buffer
522is to use the command @kbd{C-x f} (@code{set-fill-column}). With a
523numeric argument, it uses that as the new fill column. With just
524@kbd{C-u} as argument, it sets @code{fill-column} to the current
525horizontal position of point.
519 526
520@kindex M-o M-s @r{(Text mode)} 527@kindex M-o M-s @r{(Text mode)}
521@cindex centering 528@cindex centering
@@ -526,40 +533,27 @@ within the current fill column. With an argument @var{n}, it centers
526made by Text mode and is available only in that and related modes 533made by Text mode and is available only in that and related modes
527(@pxref{Text Mode}). 534(@pxref{Text Mode}).
528 535
529@vindex fill-column 536 By default, Emacs considers a period followed by two spaces or by a
530@kindex C-x f 537newline as the end of a sentence; a period followed by just one space
531@findex set-fill-column 538indicates an abbreviation, not the end of a sentence. Accordingly,
532 The maximum line width for filling is in the variable 539the fill commands will not break a line after a period followed by
533@code{fill-column}. Altering the value of @code{fill-column} makes it 540just one space. If you change the variable
534local to the current buffer; until that time, the default value is in 541@code{sentence-end-double-space} to a non-@code{nil} value, the fill
535effect. The default is initially 70. @xref{Locals}. The easiest way 542commands will break a line after a period followed by one space, and
536to set @code{fill-column} is to use the command @kbd{C-x f} 543put just one space after each period. @xref{Sentences}, for other
537(@code{set-fill-column}). With a numeric argument, it uses that as the 544effects and possible drawbacks of this.
538new fill column. With just @kbd{C-u} as argument, it sets
539@code{fill-column} to the current horizontal position of point.
540
541 Emacs commands normally consider a period followed by two spaces or by
542a newline as the end of a sentence; a period followed by just one space
543indicates an abbreviation and not the end of a sentence. To preserve
544the distinction between these two ways of using a period, the fill
545commands do not break a line after a period followed by just one space.
546
547 If the variable @code{sentence-end-double-space} is @code{nil}, the
548fill commands expect and leave just one space at the end of a sentence.
549Ordinarily this variable is @code{t}, so the fill commands insist on
550two spaces for the end of a sentence, as explained above. @xref{Sentences}.
551 545
552@vindex colon-double-space 546@vindex colon-double-space
553 If the variable @code{colon-double-space} is non-@code{nil}, the 547 If the variable @code{colon-double-space} is non-@code{nil}, the
554fill commands put two spaces after a colon. 548fill commands put two spaces after a colon.
555 549
556@vindex fill-nobreak-predicate 550@vindex fill-nobreak-predicate
557 The variable @code{fill-nobreak-predicate} is a hook (an abnormal 551 To specify additional conditions where line-breaking is not allowed,
558hook, @pxref{Hooks}) specifying additional conditions where 552customize the abnormal hook variable @code{fill-nobreak-predicate}
559line-breaking is not allowed. Each function is called with no 553(@pxref{Hooks}). Each function in this hook is called with no
560arguments, with point at a place where Emacs is considering breaking 554arguments, with point positioned where Emacs is considering breaking a
561the line. If a function returns a non-@code{nil} value, then that's 555line. If a function returns a non-@code{nil} value, Emacs will not
562a bad place to break the line. Two standard functions you can use are 556break the line there. Two functions you can use are
563@code{fill-single-word-nobreak-p} (don't break after the first word of 557@code{fill-single-word-nobreak-p} (don't break after the first word of
564a sentence or before the last) and @code{fill-french-nobreak-p} (don't 558a sentence or before the last) and @code{fill-french-nobreak-p} (don't
565break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}). 559break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}).
@@ -568,12 +562,11 @@ break after @samp{(} or before @samp{)}, @samp{:} or @samp{?}).
568@subsection The Fill Prefix 562@subsection The Fill Prefix
569 563
570@cindex fill prefix 564@cindex fill prefix
571 To fill a paragraph in which each line starts with a special marker 565 The @dfn{fill prefix} feature allows paragraphs to be filled so that
572(which might be a few spaces, giving an indented paragraph), you can use 566each line starts with a special string of characters (such as a
573the @dfn{fill prefix} feature. The fill prefix is a string that Emacs 567sequence of spaces, giving an indented paragraph). You can specify a
574expects every line to start with, and which is not included in filling. 568fill prefix explicitly; otherwise, Emacs tries to deduce one
575You can specify a fill prefix explicitly; Emacs can also deduce the 569automatically (@pxref{Adaptive Fill}).
576fill prefix automatically (@pxref{Adaptive Fill}).
577 570
578@table @kbd 571@table @kbd
579@item C-x . 572@item C-x .
@@ -597,15 +590,15 @@ after the @kbd{C-x}.) To turn off the fill prefix, specify an empty
597prefix: type @w{@kbd{C-x .}}@: with point at the beginning of a line. 590prefix: type @w{@kbd{C-x .}}@: with point at the beginning of a line.
598 591
599 When a fill prefix is in effect, the fill commands remove the fill 592 When a fill prefix is in effect, the fill commands remove the fill
600prefix from each line of the paragraph before filling and insert it on 593prefix from each line of the paragraph before filling, and insert it
601each line after filling. (The beginning of the first line of the 594on each line after filling. (The beginning of the first line of the
602paragraph is left unchanged, since often that is intentionally 595paragraph is left unchanged, since often that is intentionally
603different.) Auto Fill mode also inserts the fill prefix automatically 596different.) Auto Fill mode also inserts the fill prefix automatically
604when it makes a new line. The @kbd{C-o} command inserts the fill 597when it makes a new line (@pxref{Auto Fill}). The @kbd{C-o} command
605prefix on new lines it creates, when you use it at the beginning of a 598inserts the fill prefix on new lines it creates, when you use it at
606line (@pxref{Blank Lines}). Conversely, the command @kbd{M-^} deletes 599the beginning of a line (@pxref{Blank Lines}). Conversely, the
607the prefix (if it occurs) after the newline that it deletes 600command @kbd{M-^} deletes the prefix (if it occurs) after the newline
608(@pxref{Indentation}). 601that it deletes (@pxref{Indentation}).
609 602
610 For example, if @code{fill-column} is 40 and you set the fill prefix 603 For example, if @code{fill-column} is 40 and you set the fill prefix
611to @samp{;; }, then @kbd{M-q} in the following text 604to @samp{;; }, then @kbd{M-q} in the following text
@@ -755,17 +748,16 @@ Convert region to upper case (@code{upcase-region}).
755@findex downcase-word 748@findex downcase-word
756@findex upcase-word 749@findex upcase-word
757@findex capitalize-word 750@findex capitalize-word
758 The word conversion commands are the most useful. @kbd{M-l} 751 @kbd{M-l} (@code{downcase-word}) converts the word after point to
759(@code{downcase-word}) converts the word after point to lower case, moving 752lower case, moving past it. Thus, repeating @kbd{M-l} converts
760past it. Thus, repeating @kbd{M-l} converts successive words. 753successive words. @kbd{M-u} (@code{upcase-word}) converts to all
761@kbd{M-u} (@code{upcase-word}) converts to all capitals instead, while 754capitals instead, while @kbd{M-c} (@code{capitalize-word}) puts the
762@kbd{M-c} (@code{capitalize-word}) puts the first letter of the word 755first letter of the word into upper case and the rest into lower case.
763into upper case and the rest into lower case. All these commands convert 756All these commands convert several words at once if given an argument.
764several words at once if given an argument. They are especially convenient 757They are especially convenient for converting a large amount of text
765for converting a large amount of text from all upper case to mixed case, 758from all upper case to mixed case, because you can move through the
766because you can move through the text using @kbd{M-l}, @kbd{M-u} or 759text using @kbd{M-l}, @kbd{M-u} or @kbd{M-c} on each word as
767@kbd{M-c} on each word as appropriate, occasionally using @kbd{M-f} instead 760appropriate, occasionally using @kbd{M-f} instead to skip a word.
768to skip a word.
769 761
770 When given a negative argument, the word case conversion commands apply 762 When given a negative argument, the word case conversion commands apply
771to the appropriate number of words before point, but do not move point. 763to the appropriate number of words before point, but do not move point.
@@ -799,9 +791,10 @@ enable the command, which means it will not ask for confirmation again.
799@cindex mode, Text 791@cindex mode, Text
800@findex text-mode 792@findex text-mode
801 793
802 When you edit files of text in a human language, it's more convenient 794 Text mode is a major mode for editing files of text in a human
803to use Text mode rather than Fundamental mode. To enter Text mode, type 795language. Files which have names ending in the extension @file{.txt}
804@kbd{M-x text-mode}. 796are usually opened in Text mode (@pxref{Choosing Modes}). To
797explicitly switch to Text mode, type @kbd{M-x text-mode}.
805 798
806 In Text mode, only blank lines and page delimiters separate 799 In Text mode, only blank lines and page delimiters separate
807paragraphs. As a result, paragraphs can be indented, and adaptive 800paragraphs. As a result, paragraphs can be indented, and adaptive
@@ -809,46 +802,49 @@ filling determines what indentation to use when filling a paragraph.
809@xref{Adaptive Fill}. 802@xref{Adaptive Fill}.
810 803
811@kindex TAB @r{(Text mode)} 804@kindex TAB @r{(Text mode)}
812 Text mode defines @key{TAB} to run @code{indent-relative} 805 In Text mode, the @key{TAB} (@code{indent-for-tab-command}) command
813(@pxref{Indentation}), so that you can conveniently indent a line like 806usually inserts whitespace up to the next tab stop, instead of
814the previous line. 807indenting the current line. @xref{Indentation}, for details.
815 808
816 Text mode turns off the features concerned with comments except when 809 Text mode turns off the features concerned with comments except when
817you explicitly invoke them. It changes the syntax table so that 810you explicitly invoke them. It changes the syntax table so that
818single-quotes are considered part of words. However, if a word starts 811single-quotes are considered part of words (e.g. @samp{don't} is
819with single-quotes, these are treated as a prefix for purposes such as 812considered one word). However, if a word starts with a single-quote,
820capitalization. That is, @kbd{M-c} will convert @samp{'hello'} into 813it is treated as a prefix for the purposes of capitalization
821@samp{'Hello'}, as expected. 814(e.g. @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as
815expected).
822 816
823@cindex Paragraph-Indent Text mode 817@cindex Paragraph-Indent Text mode
824@cindex mode, Paragraph-Indent Text 818@cindex mode, Paragraph-Indent Text
825@findex paragraph-indent-text-mode 819@findex paragraph-indent-text-mode
826@findex paragraph-indent-minor-mode 820@findex paragraph-indent-minor-mode
827 If you indent the first lines of paragraphs, then you should use 821 If you indent the first lines of paragraphs, then you should use
828Paragraph-Indent Text mode rather than Text mode. In this mode, you 822Paragraph-Indent Text mode (@kbd{M-x paragraph-indent-text-mode})
829do not need to have blank lines between paragraphs, because the 823rather than Text mode. In that mode, you do not need to have blank
830first-line indentation is sufficient to start a paragraph; however 824lines between paragraphs, because the first-line indentation is
831paragraphs in which every line is indented are not supported. Use 825sufficient to start a paragraph; however paragraphs in which every
832@kbd{M-x paragraph-indent-text-mode} to enter this mode. Use @kbd{M-x 826line is indented are not supported. Use @kbd{M-x
833paragraph-indent-minor-mode} to enable an equivalent minor mode in 827paragraph-indent-minor-mode} to enable an equivalent minor mode for
834situations where you can't change the major mode---in mail 828situations where you shouldn't change the major mode---in mail
835composition, for instance. 829composition, for instance.
836 830
837@kindex M-TAB @r{(Text mode)} 831@kindex M-TAB @r{(Text mode)}
838 Text mode, and all the modes based on it, define @kbd{M-@key{TAB}} 832 Text mode binds @kbd{M-@key{TAB}} to @code{ispell-complete-word}.
839as the command @code{ispell-complete-word}, which performs completion 833This command performs completion of the partial word in the buffer
840of the partial word in the buffer before point, using the spelling 834before point, using the spelling dictionary as the space of possible
841dictionary as the space of possible words. @xref{Spelling}. If your 835words. @xref{Spelling}. If your window manager defines
842window manager defines @kbd{M-@key{TAB}} to switch windows, you can 836@kbd{M-@key{TAB}} to switch windows, you can type @kbd{@key{ESC}
843type @kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}. 837@key{TAB}} or @kbd{C-M-i} instead.
844 838
845@vindex text-mode-hook 839@vindex text-mode-hook
846 Entering Text mode runs the hook @code{text-mode-hook}. Other major 840 Entering Text mode runs the mode hook @code{text-mode-hook}
847modes related to Text mode also run this hook, followed by hooks of 841(@pxref{Major Modes}).
848their own; this includes Paragraph-Indent Text mode, Nroff mode, 842
849@TeX{} mode, Outline mode, and Message mode. Hook functions on 843 The following sections describe several major modes that are
850@code{text-mode-hook} can look at the value of @code{major-mode} to 844@dfn{derived} from Text mode. These derivatives share most of the
851see which of these modes is actually being entered. @xref{Hooks}. 845features of Text mode described above. In particular, derivatives of
846Text mode run @code{text-mode-hook} prior to running their own mode
847hooks.
852 848
853@node Outline Mode 849@node Outline Mode
854@section Outline Mode 850@section Outline Mode
@@ -859,29 +855,34 @@ see which of these modes is actually being entered. @xref{Hooks}.
859@findex outline-mode 855@findex outline-mode
860@findex outline-minor-mode 856@findex outline-minor-mode
861@vindex outline-minor-mode-prefix 857@vindex outline-minor-mode-prefix
862 Outline mode is a major mode much like Text mode but intended for 858@vindex outline-mode-hook
863editing outlines. It allows you to make parts of the text temporarily 859 Outline mode is a major mode derived from Text mode, which is
864invisible so that you can see the outline structure. Type @kbd{M-x 860specialized for editing outlines. It provides commands to navigate
865outline-mode} to switch to Outline mode as the major mode of the current 861between entries in the outline structure, and commands to make parts
866buffer. 862of a buffer temporarily invisible, so that the outline structure may
867 863be more easily viewed. Type @kbd{M-x outline-mode} to switch to
868 When Outline mode makes a line invisible, the line does not appear 864Outline mode. Entering Outline mode runs the hook
869on the screen. The screen appears exactly as if the invisible line 865@code{text-mode-hook} followed by the hook @code{outline-mode-hook}
870were deleted, except that an ellipsis (three periods in a row) appears 866(@pxref{Hooks}).
871at the end of the previous visible line. (Multiple consecutive 867
872invisible lines produce just one ellipsis.) 868 When you use an Outline mode command to make a line invisible
869(@pxref{Outline Visibility}), the line disappears from the screen. An
870ellipsis (three periods in a row) is displayed at the end of the
871previous visible line, to indicate the hidden text. Multiple
872consecutive invisible lines produce just one ellipsis.
873 873
874 Editing commands that operate on lines, such as @kbd{C-n} and 874 Editing commands that operate on lines, such as @kbd{C-n} and
875@kbd{C-p}, treat the text of the invisible line as part of the previous 875@kbd{C-p}, treat the text of the invisible line as part of the
876visible line. Killing the ellipsis at the end of a visible line 876previous visible line. Killing the ellipsis at the end of a visible
877really kills all the following invisible lines. 877line really kills all the following invisible text associated with the
878 878ellipsis.
879 Outline minor mode provides the same commands as the major mode, 879
880Outline mode, but you can use it in conjunction with other major modes. 880 Outline minor mode is a buffer-local minor mode which provides the
881Type @kbd{M-x outline-minor-mode} to enable the Outline minor mode in 881same commands as the major mode, Outline mode, but can be used in
882the current buffer. You can also specify this in the text of a file, 882conjunction with other major modes. You can type @kbd{M-x
883with a file local variable of the form @samp{mode: outline-minor} 883outline-minor-mode} to toggle Outline minor mode in the current
884(@pxref{File Variables}). 884buffer, or use a file-local variable setting to enable it in a
885specific file (@pxref{File Variables}).
885 886
886@kindex C-c @@ @r{(Outline minor mode)} 887@kindex C-c @@ @r{(Outline minor mode)}
887 The major mode, Outline mode, provides special key bindings on the 888 The major mode, Outline mode, provides special key bindings on the
@@ -890,17 +891,12 @@ with a file local variable of the form @samp{mode: outline-minor}
890major mode's special commands. (The variable 891major mode's special commands. (The variable
891@code{outline-minor-mode-prefix} controls the prefix used.) 892@code{outline-minor-mode-prefix} controls the prefix used.)
892 893
893@vindex outline-mode-hook
894 Entering Outline mode runs the hook @code{text-mode-hook} followed by
895the hook @code{outline-mode-hook} (@pxref{Hooks}).
896
897@menu 894@menu
898* Format: Outline Format. What the text of an outline looks like. 895* Outline Format:: What the text of an outline looks like.
899* Motion: Outline Motion. Special commands for moving through 896* Outline Motion:: Special commands for moving through outlines.
900 outlines. 897* Outline Visibility:: Commands to control what is visible.
901* Visibility: Outline Visibility. Commands to control what is visible. 898* Outline Views:: Outlines and multiple views.
902* Views: Outline Views. Outlines and multiple views. 899* Foldout:: Folding means zooming in on outlines.
903* Foldout:: Folding means zooming in on outlines.
904@end menu 900@end menu
905 901
906@node Outline Format 902@node Outline Format
@@ -910,13 +906,13 @@ the hook @code{outline-mode-hook} (@pxref{Hooks}).
910@cindex body lines (Outline mode) 906@cindex body lines (Outline mode)
911 Outline mode assumes that the lines in the buffer are of two types: 907 Outline mode assumes that the lines in the buffer are of two types:
912@dfn{heading lines} and @dfn{body lines}. A heading line represents a 908@dfn{heading lines} and @dfn{body lines}. A heading line represents a
913topic in the outline. Heading lines start with one or more stars; the 909topic in the outline. Heading lines start with one or more asterisk
914number of stars determines the depth of the heading in the outline 910(@samp{*}) characters; the number of asterisks determines the depth of
915structure. Thus, a heading line with one star is a major topic; all the 911the heading in the outline structure. Thus, a heading line with one
916heading lines with two stars between it and the next one-star heading 912@samp{*} is a major topic; all the heading lines with two @samp{*}s
917are its subtopics; and so on. Any line that is not a heading line is a 913between it and the next one-@samp{*} heading are its subtopics; and so
918body line. Body lines belong with the preceding heading line. Here is 914on. Any line that is not a heading line is a body line. Body lines
919an example: 915belong with the preceding heading line. Here is an example:
920 916
921@example 917@example
922* Food 918* Food
@@ -998,12 +994,10 @@ Move point up to a lower-level (more inclusive) visible heading line
998@findex outline-previous-visible-heading 994@findex outline-previous-visible-heading
999@kindex C-c C-n @r{(Outline mode)} 995@kindex C-c C-n @r{(Outline mode)}
1000@kindex C-c C-p @r{(Outline mode)} 996@kindex C-c C-p @r{(Outline mode)}
1001 @kbd{C-c C-n} (@code{outline-next-visible-heading}) moves down to the next 997 @kbd{C-c C-n} (@code{outline-next-visible-heading}) moves down to
1002heading line. @kbd{C-c C-p} (@code{outline-previous-visible-heading}) moves 998the next heading line. @kbd{C-c C-p}
1003similarly backward. Both accept numeric arguments as repeat counts. The 999(@code{outline-previous-visible-heading}) moves similarly backward.
1004names emphasize that invisible headings are skipped, but this is not really 1000Both accept numeric arguments as repeat counts.
1005a special feature. All editing commands that look for lines ignore the
1006invisible lines automatically.
1007 1001
1008@findex outline-up-heading 1002@findex outline-up-heading
1009@findex outline-forward-same-level 1003@findex outline-forward-same-level
@@ -1011,21 +1005,19 @@ invisible lines automatically.
1011@kindex C-c C-f @r{(Outline mode)} 1005@kindex C-c C-f @r{(Outline mode)}
1012@kindex C-c C-b @r{(Outline mode)} 1006@kindex C-c C-b @r{(Outline mode)}
1013@kindex C-c C-u @r{(Outline mode)} 1007@kindex C-c C-u @r{(Outline mode)}
1014 More powerful motion commands understand the level structure of headings. 1008 The commands @kbd{C-c C-f} (@code{outline-forward-same-level}) and
1015@kbd{C-c C-f} (@code{outline-forward-same-level}) and
1016@kbd{C-c C-b} (@code{outline-backward-same-level}) move from one 1009@kbd{C-c C-b} (@code{outline-backward-same-level}) move from one
1017heading line to another visible heading at the same depth in 1010heading line to another visible heading at the same depth in the
1018the outline. @kbd{C-c C-u} (@code{outline-up-heading}) moves 1011outline. @kbd{C-c C-u} (@code{outline-up-heading}) moves backward to
1019backward to another heading that is less deeply nested. 1012another heading that is less deeply nested.
1020 1013
1021@node Outline Visibility 1014@node Outline Visibility
1022@subsection Outline Visibility Commands 1015@subsection Outline Visibility Commands
1023 1016
1024 The other special commands of outline mode are used to make lines visible 1017 Outline mode provides several commands for temporarily hiding or
1025or invisible. Their names all start with @code{hide} or @code{show}. 1018revealing parts of the buffer, based on the outline structure. These
1026Most of them fall into pairs of opposites. They are not undoable; instead, 1019commands are not undoable; their effects are simply not recorded by
1027you can undo right past them. Making lines visible or invisible is simply 1020the undo mechanism, so you can undo right past them (@pxref{Undo}).
1028not recorded by the undo mechanism.
1029 1021
1030 Many of these commands act on the ``current'' heading line. If 1022 Many of these commands act on the ``current'' heading line. If
1031point is on a heading line, that is the current heading line; if point 1023point is on a heading line, that is the current heading line; if point
@@ -1069,72 +1061,64 @@ the headings leading up from there to the top level of the outline
1069@findex show-entry 1061@findex show-entry
1070@kindex C-c C-c @r{(Outline mode)} 1062@kindex C-c C-c @r{(Outline mode)}
1071@kindex C-c C-e @r{(Outline mode)} 1063@kindex C-c C-e @r{(Outline mode)}
1072 Two commands that are exact opposites are @kbd{C-c C-c} 1064 The simplest of these commands are @kbd{C-c C-c}
1073(@code{hide-entry}) and @kbd{C-c C-e} (@code{show-entry}). They apply 1065(@code{hide-entry}), which hides the body lines directly following the
1074to the body lines directly following the current heading line. 1066current heading line, and @kbd{C-c C-e} (@code{show-entry}), which
1075Subheadings and their bodies are not affected. 1067reveals them. Subheadings and their bodies are not affected.
1076 1068
1077@findex hide-subtree 1069@findex hide-subtree
1078@findex show-subtree 1070@findex show-subtree
1079@kindex C-c C-s @r{(Outline mode)} 1071@kindex C-c C-s @r{(Outline mode)}
1080@kindex C-c C-d @r{(Outline mode)} 1072@kindex C-c C-d @r{(Outline mode)}
1081@cindex subtree (Outline mode) 1073@cindex subtree (Outline mode)
1082 Two more powerful opposites are @kbd{C-c C-d} (@code{hide-subtree}) 1074 The commands @kbd{C-c C-d} (@code{hide-subtree}) and @kbd{C-c C-s}
1083and @kbd{C-c C-s} (@code{show-subtree}). Both apply to the current 1075(@code{show-subtree}) are more powerful. They apply to the current
1084heading line's @dfn{subtree}: its body, all its subheadings, both 1076heading line's @dfn{subtree}: its body, all of its subheadings, both
1085direct and indirect, and all of their bodies. In other words, the 1077direct and indirect, and all of their bodies.
1086subtree contains everything following the current heading line, up to
1087and not including the next heading of the same or higher rank.
1088 1078
1089@findex hide-leaves 1079@findex hide-leaves
1090@findex show-branches 1080@findex show-branches
1081@findex show-children
1091@kindex C-c C-l @r{(Outline mode)} 1082@kindex C-c C-l @r{(Outline mode)}
1092@kindex C-c C-k @r{(Outline mode)} 1083@kindex C-c C-k @r{(Outline mode)}
1093 Intermediate between a visible subtree and an invisible one is having
1094all the subheadings visible but none of the body. There are two
1095commands for doing this, depending on whether you want to hide the
1096bodies or make the subheadings visible. They are @kbd{C-c C-l}
1097(@code{hide-leaves}) and @kbd{C-c C-k} (@code{show-branches}).
1098
1099@kindex C-c C-i @r{(Outline mode)} 1084@kindex C-c C-i @r{(Outline mode)}
1100@findex show-children 1085 The command @kbd{C-c C-l} (@code{hide-leaves}) hides the body of the
1101 A little weaker than @code{show-branches} is @kbd{C-c C-i} 1086current heading line as well as all the bodies in its subtree; the
1102(@code{show-children}). It makes just the direct subheadings 1087subheadings themselves are left visible. The command @kbd{C-c C-k}
1103visible---those one level down. Deeper subheadings remain invisible, if 1088(@code{show-branches}) reveals the subheadings, if they had previously
1104they were invisible. 1089been hidden (e.g. by @kbd{C-c C-d}). The command @kbd{C-c C-i}
1090(@code{show-children}) is a weaker version of this; it reveals just
1091the direct subheadings, i.e. those one level down.
1092
1093@findex hide-other
1094@kindex C-c C-o @r{(Outline mode)}
1095 The command @kbd{C-c C-o} (@code{hide-other}) hides everything
1096except the entry that point is in, plus its parents (the headers
1097leading up from there to top level in the outline) and the top level
1098headings.
1105 1099
1106@findex hide-body 1100@findex hide-body
1107@findex show-all 1101@findex show-all
1108@kindex C-c C-t @r{(Outline mode)} 1102@kindex C-c C-t @r{(Outline mode)}
1109@kindex C-c C-a @r{(Outline mode)} 1103@kindex C-c C-a @r{(Outline mode)}
1110 Two commands have a blanket effect on the whole file. @kbd{C-c C-t}
1111(@code{hide-body}) makes all body lines invisible, so that you see just
1112the outline structure (as a special exception, it will not hide lines
1113at the top of the file, preceding the first header line, even though
1114these are technically body lines). @kbd{C-c C-a} (@code{show-all})
1115makes all lines visible. These commands can be thought of as a pair
1116of opposites even though @kbd{C-c C-a} applies to more than just body
1117lines.
1118
1119@findex hide-sublevels 1104@findex hide-sublevels
1120@kindex C-c C-q @r{(Outline mode)} 1105@kindex C-c C-q @r{(Outline mode)}
1121 The command @kbd{C-c C-q} (@code{hide-sublevels}) hides all but the 1106 The remaining commands affect the whole buffer. @kbd{C-c C-t}
1122top level headings. With a numeric argument @var{n}, it hides everything 1107(@code{hide-body}) makes all body lines invisible, so that you see
1123except the top @var{n} levels of heading lines. 1108just the outline structure (as a special exception, it will not hide
1124 1109lines at the top of the file, preceding the first header line, even
1125@findex hide-other 1110though these are technically body lines). @kbd{C-c C-a}
1126@kindex C-c C-o @r{(Outline mode)} 1111(@code{show-all}) makes all lines visible. @kbd{C-c C-q}
1127 The command @kbd{C-c C-o} (@code{hide-other}) hides everything except 1112(@code{hide-sublevels}) hides all but the top level headings; with a
1128the heading and body text that point is in, plus its parents (the headers 1113numeric argument @var{n}, it hides everything except the top @var{n}
1129leading up from there to top level in the outline) and the top level 1114levels of heading lines.
1130headings.
1131 1115
1132@findex reveal-mode 1116@findex reveal-mode
1133 When incremental search finds text that is hidden by Outline mode, 1117 When incremental search finds text that is hidden by Outline mode,
1134it makes that part of the buffer visible. If you exit the search 1118it makes that part of the buffer visible. If you exit the search at
1135at that position, the text remains visible. You can also 1119that position, the text remains visible. You can also automatically
1136automatically make text visible as you navigate in it by using 1120make text visible as you navigate in it by using Reveal mode (@kbd{M-x
1137@kbd{M-x reveal-mode}. 1121reveal-mode}), a buffer-local minor mode.
1138 1122
1139@node Outline Views 1123@node Outline Views
1140@subsection Viewing One Outline in Multiple Views 1124@subsection Viewing One Outline in Multiple Views
@@ -1254,7 +1238,7 @@ it in order for this to take effect.
1254 1238
1255 To use the Foldout package, you can type @kbd{M-x load-library 1239 To use the Foldout package, you can type @kbd{M-x load-library
1256@key{RET} foldout @key{RET}}; or you can arrange for to do that 1240@key{RET} foldout @key{RET}}; or you can arrange for to do that
1257automatically by putting this in your @file{.emacs} file: 1241automatically by putting this in your init file (@pxref{Init File}):
1258 1242
1259@example 1243@example
1260(eval-after-load "outline" '(require 'foldout)) 1244(eval-after-load "outline" '(require 'foldout))