text.texi 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127
  1. @node Text, Programs, Indentation, Top
  2. @chapter Commands for Human Languages
  3. @cindex text
  4. The term @dfn{text} has two widespread meanings in our area of the
  5. computer field. One is data that is a sequence of characters. In this
  6. sense of the word any file that you edit with Emacs is text. The other
  7. meaning is more restrictive: a sequence of characters in a human
  8. language for humans to read (possibly after processing by a text
  9. formatter), as opposed to a program or commands for a program.
  10. Human languages have syntactic and stylistic conventions that editor
  11. commands should support or use to advantage: conventions involving
  12. words, sentences, paragraphs, and capital letters. This chapter describes
  13. Emacs commands for all these things. There are also commands for
  14. @dfn{filling}, or rearranging paragraphs into lines of approximately equal
  15. length. The commands for moving over and killing words, sentences,
  16. and paragraphs, while intended primarily for editing text, are also often
  17. useful for editing programs.
  18. Emacs has several major modes for editing human language text.
  19. If a file contains plain text, use Text mode, which customizes
  20. Emacs in small ways for the syntactic conventions of text. For text which
  21. contains embedded commands for text formatters, Emacs has other major modes,
  22. each for a particular text formatter. Thus, for input to @TeX{}, you can
  23. use @TeX{} mode; for input to nroff, Nroff mode.
  24. @menu
  25. * Text Mode:: The major modes for editing text files.
  26. * Nroff Mode:: The major mode for editing input to the formatter nroff.
  27. * TeX Mode:: The major modes for editing input to the formatter TeX.
  28. * Outline Mode:: The major mode for editing outlines.
  29. * Words:: Moving over and killing words.
  30. * Sentences:: Moving over and killing sentences.
  31. * Paragraphs:: Moving over paragraphs.
  32. * Pages:: Moving over pages.
  33. * Filling:: Filling or justifying text
  34. * Case:: Changing the case of text
  35. @end menu
  36. @node Text Mode, Words, Text, Text
  37. @section Text Mode
  38. @findex tab-to-tab-stop
  39. @findex edit-tab-stops
  40. @cindex Text mode
  41. @kindex TAB
  42. @findex text-mode
  43. You should use Text mode---rather than Fundamental or Lisp mode---to
  44. edit files of text in a human language. Invoke @kbd{M-x text-mode} to
  45. enter Text mode. In Text mode, @key{TAB} runs the function
  46. @code{tab-to-tab-stop}, which allows you to use arbitrary tab stops set
  47. with @kbd{M-x edit-tab-stops} (@pxref{Tab Stops}). Features concerned
  48. with comments in programs are turned off unless they are explicitly invoked.
  49. The syntax table is changed so that periods are not considered part of a
  50. word, while apostrophes, backspaces and underlines are.
  51. @findex indented-text-mode
  52. A similar variant mode is Indented Text mode, intended for editing
  53. text in which most lines are indented. This mode defines @key{TAB} to
  54. run @code{indent-relative} (@pxref{Indentation}), and makes Auto Fill
  55. indent the lines it creates. As a result, a line made by Auto Filling,
  56. or by @key{LFD}, is normally indented just like the previous line. Use
  57. @kbd{M-x indented-text-mode} to select this mode.
  58. @vindex text-mode-hook
  59. Entering Text mode or Indented Text mode calls the value of the
  60. variable @code{text-mode-hook} with no arguments, if that value exists
  61. and is not @code{nil}. This value is also called when modes related to
  62. Text mode are entered; this includes Nroff mode, @TeX{} mode, Outline
  63. mode, and Mail mode. Your hook can look at the value of
  64. @code{major-mode} to see which of these modes is actually being entered.
  65. Two modes similar to Text mode are of use for editing text that is to
  66. be passed through a text formatter before achieving its final readable form.
  67. @menu
  68. * Nroff Mode:: The major mode for editing input to the formatter nroff.
  69. * TeX Mode:: The major modes for editing input to the formatter TeX.
  70. Another similar mode is used for editing outlines. It allows you
  71. to view the text at various levels of detail. You can view either
  72. the outline headings alone or both headings and text; you can also
  73. hide some of the headings at lower levels from view to make the high
  74. level structure more visible.
  75. * Outline Mode:: The major mode for editing outlines.
  76. @end menu
  77. @node Nroff Mode, TeX Mode, Text Mode, Text Mode
  78. @subsection Nroff Mode
  79. @cindex nroff
  80. @findex nroff-mode
  81. Nroff mode is a mode like Text mode but modified to handle nroff
  82. commands present in the text. Invoke @kbd{M-x nroff-mode} to enter this
  83. mode. Nroff mode differs from Text mode in only a few ways. All nroff
  84. command lines are considered paragraph separators, so that filling never
  85. garbles the nroff commands. Pages are separated by @samp{.bp} commands.
  86. Comments start with backslash-doublequote. There are also three special
  87. commands that are not available in Text mode:
  88. @findex forward-text-line
  89. @findex backward-text-line
  90. @findex count-text-lines
  91. @kindex M-n
  92. @kindex M-p
  93. @kindex M-?
  94. @table @kbd
  95. @item M-n
  96. Move to the beginning of the next line that isn't an nroff command
  97. (@code{forward-text-line}). An argument is a repeat count.
  98. @item M-p
  99. Like @kbd{M-n} but move up (@code{backward-text-line}).
  100. @item M-?
  101. Prints in the echo area the number of text lines (lines that are not
  102. nroff commands) in the region (@code{count-text-lines}).
  103. @end table
  104. @findex electric-nroff-mode
  105. The other feature of Nroff mode is Electric Nroff newline mode.
  106. This is a minor mode that you can turn on or off with
  107. @kbd{M-x electric-nroff-mode} (@pxref{Minor Modes}). When the mode is
  108. on and you use @key{RET} to end a line containing an nroff command
  109. that opens a kind of grouping, Emacs automatically inserts the matching
  110. nroff command to close that grouping on the following line. For
  111. example, if you are at the beginning of a line and type @kbd{.@:(b
  112. @key{RET}}, the matching command @samp{.)b} will be inserted on a new
  113. line following point.
  114. @vindex nroff-mode-hook
  115. Entering Nroff mode calls the value of the variable
  116. @code{text-mode-hook} with no arguments, if that value exists and is not
  117. @code{nil}; then it does the same with the variable
  118. @code{nroff-mode-hook}.
  119. @node TeX Mode, Outline Mode, Nroff Mode, Text Mode
  120. @subsection @TeX{} Mode
  121. @cindex TeX
  122. @cindex LaTeX
  123. @findex TeX-mode
  124. @findex tex-mode
  125. @findex plain-tex-mode
  126. @findex LaTeX-mode
  127. @findex plain-TeX-mode
  128. @findex latex-mode
  129. @TeX{} is a powerful text formatter written by Donald Knuth; like GNU
  130. Emacs, it is free. La@TeX{} is a simplified input format for @TeX{},
  131. implemented by @TeX{} macros. It is part of @TeX{}.@refill
  132. Emacs has a special @TeX{} mode for editing @TeX{} input files.
  133. It provides facilities for checking the balance of delimiters and for
  134. invoking @TeX{} on all or part of the file.
  135. @TeX{} mode has two variants, Plain @TeX{} mode and La@TeX{} mode,
  136. which are two distinct major modes that differ only slightly. These
  137. modes are designed for editing the two different input formats. The
  138. command @kbd{M-x tex-mode} looks at the contents of a buffer to
  139. determine whether it appears to be La@TeX{} input or not; it then
  140. selects the appropriate mode. If it can't tell which is right (e.g.,
  141. the buffer is empty), the variable @code{tex-default-mode} controls
  142. which mode is used.
  143. The commands @kbd{M-x plain-tex-mode} and @kbd{M-x latex-mode}
  144. explicitly select one of the variants of @TeX{} mode. Use these
  145. commands when @kbd{M-x tex-mode} does not guess right.@refill
  146. @menu
  147. * Editing: TeX Editing. Special commands for editing in TeX mode.
  148. * Printing: TeX Print. Commands for printing part of a file with TeX.
  149. @end menu
  150. @TeX{} for Unix systems can be obtained from the University of Washington
  151. for a distribution fee.
  152. To order a full distribution, send $140.00 for a 1/2 inch
  153. 9-track tape, $165.00 for two 4-track 1/4 inch cartridge tapes
  154. (foreign sites $150.00, for 1/2 inch, $175.00 for 1/4 inch, to cover
  155. the extra postage) payable to the University of Washington to:
  156. @display
  157. The Director
  158. Northwest Computer Support Group, DW-10
  159. University of Washington
  160. Seattle, Washington 98195
  161. @end display
  162. @noindent
  163. Purchase orders are acceptable, but there is an extra charge of
  164. $10.00 to pay for processing charges. (The total cost comes to $150
  165. for domestic sites, $175 for foreign sites).
  166. The normal distribution is a tar tape, blocked 20, 1600 bpi, on an
  167. industry standard 2400 foot half-inch reel. The physical format for
  168. the 1/4 inch streamer cartridges uses QIC-11, 8000 bpi, 4-track
  169. serpentine recording for the SUN. Also, SystemV tapes can be written
  170. in cpio format, blocked 5120 bytes, ASCII headers.
  171. @node TeX Editing,TeX Print,TeX Mode,TeX Mode
  172. @subsubsection @TeX{} Editing Commands
  173. Here are the special commands provided in @TeX{} mode for editing the
  174. text of the file.
  175. @table @kbd
  176. @item "
  177. Insert, according to context, either @samp{``} or @samp{"} or
  178. @samp{''} (@code{TeX-insert-quote}).
  179. @item @key{LFD}
  180. Insert a paragraph break (two newlines) and check the previous
  181. paragraph for unbalanced braces or dollar signs
  182. (@code{tex-terminate-@*paragraph}).
  183. @item M-x validate-tex-buffer
  184. Check each paragraph in the buffer for unbalanced braces or dollar signs.
  185. @item C-c @{
  186. Insert @samp{@{@}} and position point between them (@code{tex-insert-braces}).
  187. @item C-c @}
  188. Move forward past the next unmatched close brace (@code{up-list}).
  189. @item C-c C-e
  190. Close a block for La@TeX{} (@code{tex-close-latex-block}).
  191. @end table
  192. @findex tex-insert-quote
  193. @kindex " (TeX mode)
  194. In @TeX{}, the character @samp{"} is not normally used; you use @samp{``}
  195. to start a quotation and @samp{''} to end one. @TeX{} mode defines the key
  196. @kbd{"} to insert @samp{``} after whitespace or an open brace, @samp{"}
  197. after a backslash, or @samp{''} otherwise. This is done by the command
  198. @code{tex-insert-quote}. If you need the character @samp{"} itself in
  199. unusual contexts, use @kbd{C-q} to insert it. Also, @kbd{"} with a
  200. numeric argument always inserts that number of @samp{"} characters.
  201. In @TeX{} mode, @samp{$} has a special syntax code which attempts to
  202. understand the way @TeX{} math mode delimiters match. When you insert a
  203. @samp{$} that is meant to exit math mode, the position of the matching
  204. @samp{$} that entered math mode is displayed for a second. This is the
  205. same feature that displays the open brace that matches a close brace that
  206. is inserted. However, there is no way to tell whether a @samp{$} enters
  207. math mode or leaves it; so when you insert a @samp{$} that enters math
  208. mode, the previous @samp{$} position is shown as if it were a match, even
  209. though they are actually unrelated.
  210. @findex tex-insert-braces
  211. @kindex C-c @{ (TeX mode)
  212. @findex up-list
  213. @kindex C-c @} (TeX mode)
  214. If you prefer to keep braces balanced at all times, you can use @kbd{C-c @{}
  215. (@code{tex-insert-braces}) to insert a pair of braces. It leaves point
  216. between the two braces so you can insert the text that belongs inside.
  217. Afterward, use the command @kbd{C-c @}} (@code{up-list}) to move forward
  218. past the close brace.
  219. @findex validate-tex-buffer
  220. @findex tex-terminate-paragraph
  221. @kindex LFD (TeX mode)
  222. There are two commands for checking the matching of braces. @key{LFD}
  223. (@code{tex-terminate-paragraph}) checks the paragraph before point, and
  224. inserts two newlines to start a new paragraph. It prints a message in the
  225. echo area if any mismatch is found. @kbd{M-x validate-tex-buffer} checks
  226. the entire buffer, paragraph by paragraph. When it finds a paragraph that
  227. contains a mismatch, it displays point at the beginning of the paragraph
  228. for a few seconds and pushes a mark at that spot. Scanning continues
  229. until the whole buffer has been checked or until you type another key.
  230. The positions of the last several paragraphs with mismatches can be
  231. found in the mark ring (@pxref{Mark Ring}).
  232. Note that square brackets and parentheses, not just braces, are
  233. matched in @TeX{} mode. This is wrong if you want to check @TeX{} syntax.
  234. However, parentheses and square brackets are likely to be used in text as
  235. matching delimiters and it is useful for the various motion commands and
  236. automatic match display to work with them.
  237. @findex tex-close-latex-block
  238. @kindex C-c C-f (LaTeX mode)
  239. In La@TeX{} input, @samp{\begin} and @samp{\end} commands must balance.
  240. After you insert a @samp{\begin}, use @kbd{C-c C-f}
  241. (@code{tex-close-latex-block}) to insert automatically a matching
  242. @samp{\end} (on a new line following the @samp{\begin}). A blank line is
  243. inserted between the two, and point is left there.@refill
  244. @node TeX Print,,TeX Editing,TeX Mode
  245. @subsubsection @TeX{} Printing Commands
  246. You can invoke @TeX{} as an inferior of Emacs on either the entire
  247. contents of the buffer or just a region at a time. Running @TeX{} in
  248. this way on just one chapter is a good way to see what your changes
  249. look like without taking the time to format the entire file.
  250. @table @kbd
  251. @item C-c C-r
  252. Invoke @TeX{} on the current region, plus the buffer's header
  253. (@code{tex-region}).
  254. @item C-c C-b
  255. Invoke @TeX{} on the entire current buffer (@code{tex-buffer}).
  256. @item C-c C-l
  257. Recenter the window showing output from the inferior @TeX{} so that
  258. the last line can be seen (@code{tex-recenter-output-buffer}).
  259. @item C-c C-k
  260. Kill the inferior @TeX{} (@code{tex-kill-job}).
  261. @item C-c C-p
  262. Print the output from the last @kbd{C-c C-r} or @kbd{C-c C-b} command
  263. (@code{tex-print}).
  264. @item C-c C-q
  265. Show the printer queue (@code{tex-show-print-queue}).
  266. @end table
  267. @findex tex-buffer
  268. @kindex C-c C-b (TeX mode)
  269. @findex tex-print
  270. @kindex C-c C-p (TeX mode)
  271. @findex tex-show-print-queue
  272. @kindex C-c C-q (TeX mode)
  273. You can pass the current buffer through an inferior @TeX{} using
  274. @kbd{C-c C-b} (@code{tex-buffer}). The formatted output appears in a file
  275. in @file{/tmp}; to print it, type @kbd{C-c C-p} (@code{tex-print}).
  276. Afterward use @kbd{C-c C-q} (@code{tex-show-print-queue}) to view the
  277. progress of your output towards being printed.
  278. @findex tex-kill-job
  279. @kindex C-c C-k (TeX mode)
  280. @findex tex-recenter-output-buffer
  281. @kindex C-c C-l (TeX mode)
  282. The console output from @TeX{}, including any error messages, appears in a
  283. buffer called @samp{*TeX-shell*}. If @TeX{} gets an error, you can switch
  284. to this buffer and feed it input (this works as in Shell mode;
  285. @pxref{Interactive Shell}). Without switching to this buffer, you can scroll
  286. it so that its last line is visible by typing @kbd{C-c C-l}.
  287. Type @kbd{C-c C-k} (@code{tex-kill-job}) to kill the @TeX{} process if
  288. you see that its output is no longer useful. Using @kbd{C-c C-b} or
  289. @kbd{C-c C-r} also kills any @TeX{} process still running.@refill
  290. @findex tex-region
  291. @kindex C-c C-r (TeX mode)
  292. You can pass an arbitrary region through an inferior @TeX{} by typing
  293. @kbd{C-c C-r} (@code{tex-region}). This is tricky, however, because
  294. most files of @TeX{} input contain commands at the beginning to set
  295. parameters and define macros. Without them, no later part of the file
  296. will format correctly. To solve this problem, @kbd{C-c C-r} allows you
  297. to designate a part of the file as containing essential commands; it is
  298. included before the specified region as part of the input to @TeX{}.
  299. The designated part of the file is called the @dfn{header}.
  300. @cindex header (TeX mode)
  301. To indicate the bounds of the header in Plain @TeX{} mode, insert two
  302. special strings in the file: @samp{%**start of header} before the
  303. header, and @samp{%**end of header} after it. Each string must appear
  304. entirely on one line, but there may be other text on the line before or
  305. after. The lines containing the two strings are included in the header.
  306. If @samp{%**start of header} does not appear within the first 100 lines of
  307. the buffer, @kbd{C-c C-r} assumes there is no header.
  308. In La@TeX{} mode, the header begins with @samp{\documentstyle} and ends
  309. with @*@samp{\begin@{document@}}. These are commands that La@TeX{} requires
  310. you to use, so you don't need to do anything special to identify the
  311. header.
  312. @vindex TeX-mode-hook
  313. @vindex LaTeX-mode-hook
  314. @vindex plain-TeX-mode-hook
  315. When you enter either kind of @TeX{} mode, Emacs calls with no
  316. arguments the value of the variable @code{text-mode-hook}, if that value
  317. exists and is not @code{nil}. Emacs then calls the variable
  318. @code{TeX-mode-hook} and either @code{plain-TeX-mode-hook} or
  319. @code{LaTeX-mode-hook} under the same conditions.
  320. @node Outline Mode,, TeX Mode, Text Mode
  321. @subsection Outline Mode
  322. @cindex outlines
  323. @cindex selective display
  324. @cindex invisible lines
  325. Outline mode is a major mode similar to Text mode but intended for editing
  326. outlines. It allows you to make parts of the text temporarily invisible
  327. so that you can see just the overall structure of the outline. Type
  328. @kbd{M-x outline-mode} to turn on Outline mode in the current buffer.
  329. @vindex outline-mode-hook
  330. When you enter Outline mode, Emacs calls with no arguments the value
  331. of the variable @code{text-mode-hook}, if that value exists and is not
  332. @code{nil}; then it does the same with the variable
  333. @code{outline-mode-hook}.
  334. When a line is invisible in outline mode, it does not appear on the
  335. screen. The screen appears exactly as if the invisible line
  336. were deleted, except that an ellipsis (three periods in a row) appears
  337. at the end of the previous visible line (only one ellipsis no matter
  338. how many invisible lines follow).
  339. All editing commands treat the text of the invisible line as part of the
  340. previous visible line. For example, @kbd{C-n} moves onto the next visible
  341. line. Killing an entire visible line, including its terminating newline,
  342. really kills all the following invisible lines as well; yanking
  343. everything back yanks the invisible lines and they remain invisible.
  344. @menu
  345. * Format: Outline Format. What the text of an outline looks like.
  346. * Motion: Outline Motion. Special commands for moving through outlines.
  347. * Visibility: Outline Visibility. Commands to control what is visible.
  348. @end menu
  349. @node Outline Format,Outline Motion,Outline Mode, Outline Mode
  350. @subsubsection Format of Outlines
  351. @cindex heading lines (Outline mode)
  352. @cindex body lines (Outline mode)
  353. Outline mode assumes that the lines in the buffer are of two types:
  354. @dfn{heading lines} and @dfn{body lines}. A heading line represents a
  355. topic in the outline. Heading lines start with one or more stars; the
  356. number of stars determines the depth of the heading in the outline
  357. structure. Thus, a heading line with one star is a major topic; all the
  358. heading lines with two stars between it and the next one-star heading
  359. are its subtopics; and so on. Any line that is not a heading line is a
  360. body line. Body lines belong to the preceding heading line. Here is an
  361. example:
  362. @example
  363. * Food
  364. This is the body,
  365. which says something about the topic of food.
  366. ** Delicious Food
  367. This is the body of the second-level header.
  368. ** Distasteful Food
  369. This could have
  370. a body too, with
  371. several lines.
  372. *** Dormitory Food
  373. * Shelter
  374. A second first-level topic with its header line.
  375. @end example
  376. A heading line together with all following body lines is called
  377. collectively an @dfn{entry}. A heading line together with all following
  378. deeper heading lines and their body lines is called a @dfn{subtree}.
  379. @vindex outline-regexp
  380. You can customize the criterion for distinguishing heading lines by
  381. setting the variable @code{outline-regexp}. Any line whose beginning
  382. has a match for this regexp is considered a heading line. Matches that
  383. start within a line (not at the beginning) do not count. The length of
  384. the matching text determines the level of the heading; longer matches
  385. make a more deeply nested level. Thus, for example, if a text formatter
  386. has commands @samp{@@chapter}, @samp{@@section} and @samp{@@subsection}
  387. to divide the document into chapters and sections, you can make those
  388. lines count as heading lines by setting @code{outline-regexp} to
  389. @samp{"@@chap\\|@@\\(sub\\)*section"}. Note the trick: the two words
  390. @samp{chapter} and @samp{section} are the same length, but by defining
  391. the regexp to match only @samp{chap} we ensure that the length of the
  392. text matched on a chapter heading is shorter, so that Outline mode will
  393. know that sections are contained in chapters. This works as long as no
  394. other command starts with @samp{@@chap}.
  395. Outline mode makes a line invisible by changing the newline before it
  396. into an ASCII Control-M (code 015). Most editing commands that work on
  397. lines treat an invisible line as part of the previous line because,
  398. strictly speaking, it @i{is} part of that line, since there is no longer a
  399. newline in between. When you save the file in Outline mode, Control-M
  400. characters are saved as newlines, so the invisible lines become ordinary
  401. lines in the file. Saving does not change the visibility status of a
  402. line inside Emacs.
  403. @node Outline Motion,Outline Visibility,Outline Format,Outline Mode
  404. @subsubsection Outline Motion Commands
  405. Some special commands in Outline mode move backward and forward to
  406. heading lines.
  407. @table @kbd
  408. @item C-c C-n
  409. Move point to the next visible heading line
  410. (@code{outline-next-visible-heading}).
  411. @item C-c C-p
  412. Move point to the previous visible heading line @*
  413. (@code{outline-previous-visible-heading}).
  414. @item C-c C-f
  415. Move point to the next visible heading line at the same level
  416. as the one point is on (@code{outline-forward-same-level}).
  417. @item C-c C-b
  418. Move point to the previous visible heading line at the same level
  419. (@code{outline-backward-same-level}).
  420. @item C-c C-u
  421. Move point up to a lower-level (more inclusive) visible heading line
  422. (@code{outline-up-heading}).
  423. @end table
  424. @findex outline-next-visible-heading
  425. @findex outline-previous-visible-heading
  426. @kindex C-c C-n (Outline mode)
  427. @kindex C-c C-p (Outline mode)
  428. @kbd{C-c C-n} (@code{next-visible-heading}) moves down to the next
  429. heading line. @kbd{C-c C-p} (@code{previous-visible-heading}) moves
  430. similarly backward. Both accept numeric arguments as repeat counts. The
  431. names emphasize that invisible headings are skipped, but this is not really
  432. a special feature. All editing commands that look for lines ignore the
  433. invisible lines automatically.@refill
  434. @findex outline-up-heading
  435. @findex outline-forward-same-level
  436. @findex outline-backward-same-level
  437. @kindex C-c C-f (Outline mode)
  438. @kindex C-c C-b (Outline mode)
  439. @kindex C-c C-u (Outline mode)
  440. More advanced motion commands understand the levels of headings.
  441. The commands @kbd{C-c C-f} (@code{outline-forward-same-level}) and
  442. @kbd{C-c C-b} (@code{outline-backward-same-level}) move from one
  443. heading line to another visible heading at the same depth in
  444. the outline. @kbd{C-c C-u} (@code{outline-up-heading}) moves
  445. backward to another heading that is less deeply nested.
  446. @node Outline Visibility,,Outline Motion,Outline Mode
  447. @subsubsection Outline Visibility Commands
  448. The other special commands of outline mode are used to make lines visible
  449. or invisible. Their names all start with @code{hide} or @code{show}.
  450. Most of them exist as pairs of opposites. They are not undoable; instead,
  451. you can undo right past them. Making lines visible or invisible is simply
  452. not recorded by the undo mechanism.
  453. @table @kbd
  454. @item M-x hide-body
  455. Make all body lines in the buffer invisible.
  456. @item M-x show-all
  457. Make all lines in the buffer visible.
  458. @item C-c C-d
  459. Make everything under this heading invisible, not including this
  460. heading itself (@code{hide-subtree}).
  461. @item C-c C-s
  462. Make everything under this heading visible, including body,
  463. subheadings, and their bodies (@code{show-subtree}).
  464. @item M-x hide-leaves
  465. Make the body of this heading line, and of all its subheadings,
  466. invisible.
  467. @item M-x show-branches
  468. Make all subheadings of this heading line, at all levels, visible.
  469. @item C-c C-i
  470. Make immediate subheadings (one level down) of this heading line
  471. visible (@code{show-children}).
  472. @item M-x hide-entry
  473. Make this heading line's body invisible.
  474. @item M-x show-entry
  475. Make this heading line's body visible.
  476. @end table
  477. @findex hide-entry
  478. @findex show-entry
  479. Two commands that are exact opposites are @kbd{M-x hide-entry} and
  480. @kbd{M-x show-entry}. They are used with point on a heading line, and
  481. apply only to the body lines of that heading. The subtopics and their
  482. bodies are not affected.
  483. @findex hide-subtree
  484. @findex show-subtree
  485. @kindex C-c C-d (Outline mode)
  486. @kindex C-c C-h (Outline mode)
  487. @cindex subtree (Outline mode)
  488. Two more powerful opposites are @kbd{C-c C-d} (@code{hide-subtree}) and
  489. @kbd{C-c C-s} (@code{show-subtree}). Both should be used when point is
  490. on a heading line, and both apply to all the lines of that heading's
  491. @dfn{subtree}: its body, all its subheadings, both direct and indirect, and
  492. all of their bodies. In other words, the subtree contains everything
  493. following this heading line, up to and not including the next heading of
  494. the same or higher rank.@refill
  495. @findex hide-leaves
  496. @findex show-branches
  497. Intermediate between a visible subtree and an invisible one is having
  498. all the subheadings visible but none of the body. There are two commands
  499. for doing this, one that hides the bodies and one that
  500. makes the subheadings visible. They are @kbd{M-x hide-leaves} and
  501. @kbd{M-x show-branches}.
  502. @kindex C-c C-i (Outline mode)
  503. @findex show-children
  504. A little weaker than @code{show-branches} is @kbd{C-c C-i}
  505. (@code{show-children}). It makes just the direct subheadings
  506. visible---those one level down. Deeper subheadings remain
  507. invisible.@refill
  508. @findex hide-body
  509. @findex show-all
  510. Two commands have a blanket effect on the whole file. @kbd{M-x
  511. hide-body} makes all body lines invisible, so that you see just the
  512. outline structure. @kbd{M-x show-all} makes all lines visible. You can
  513. think of these commands as a pair of opposites even though @kbd{M-x
  514. show-all} applies to more than just body lines.
  515. @vindex selective-display-ellipses
  516. You can turn off the use of ellipses at the ends of visible lines by
  517. setting @code{selective-display-ellipses} to @code{nil}. The result is
  518. no visible indication of the presence of invisible lines.
  519. @node Words, Sentences, Text Mode, Text
  520. @section Words
  521. @cindex words
  522. @cindex Meta
  523. Emacs has commands for moving over or operating on words. By convention,
  524. the keys for them are all @kbd{Meta-} characters.
  525. @c widecommands
  526. @table @kbd
  527. @item M-f
  528. Move forward over a word (@code{forward-word}).
  529. @item M-b
  530. Move backward over a word (@code{backward-word}).
  531. @item M-d
  532. Kill up to the end of a word (@code{kill-word}).
  533. @item M-@key{DEL}
  534. Kill back to the beginning of a word (@code{backward-kill-word}).
  535. @item M-@@
  536. Mark the end of the next word (@code{mark-word}).
  537. @item M-t
  538. Transpose two words; drag a word forward
  539. or backward across other words (@code{transpose-words}).
  540. @end table
  541. Notice how these keys form a series that parallels the
  542. character-based @kbd{C-f}, @kbd{C-b}, @kbd{C-d}, @kbd{C-t} and
  543. @key{DEL}. @kbd{M-@@} is related to @kbd{C-@@}, which is an alias for
  544. @kbd{C-@key{SPC}}.@refill
  545. @kindex M-f
  546. @kindex M-b
  547. @findex forward-word
  548. @findex backward-word
  549. The commands @kbd{Meta-f} (@code{forward-word}) and @kbd{Meta-b}
  550. (@code{backward-word}) move forward and backward over words. They are
  551. analogous to @kbd{Control-f} and @kbd{Control-b}, which move over single
  552. characters. Like their @kbd{Control-} analogues, @kbd{Meta-f} and
  553. @kbd{Meta-b} move several words if given an argument. @kbd{Meta-f} with a
  554. negative argument moves backward, and @kbd{Meta-b} with a negative argument
  555. moves forward. Forward motion stops after the last letter of the
  556. word, while backward motion stops before the first letter.@refill
  557. @kindex M-d
  558. @findex kill-word
  559. @kbd{Meta-d} (@code{kill-word}) kills the word after point. To be
  560. precise, it kills everything from point to the place @kbd{Meta-f} would
  561. move to. Thus, if point is in the middle of a word, @kbd{Meta-d} kills
  562. just the part after point. If some punctuation comes between point and the
  563. next word, it is killed along with the word. (To kill only the
  564. next word but not the punctuation before it, simply type @kbd{Meta-f} to get
  565. to the end and kill the word backwards with @kbd{Meta-@key{DEL}}.)
  566. @kbd{Meta-d} takes arguments just like @kbd{Meta-f}.
  567. @findex backward-kill-word
  568. @kindex M-DEL
  569. @kbd{Meta-@key{DEL}} (@code{backward-kill-word}) kills the word before
  570. point. It kills everything from point back to where @kbd{Meta-b} would
  571. move to. If point is after the space in @w{@samp{FOO, BAR}}, then
  572. @w{@samp{FOO, }} is killed. To kill just @samp{FOO}, type
  573. @kbd{Meta-b Meta-d} instead of @kbd{Meta-@key{DEL}}.
  574. @cindex transposition
  575. @kindex M-t
  576. @findex transpose-words
  577. @kbd{Meta-t} (@code{transpose-words}) exchanges the word before or
  578. containing point with the following word. The delimiter characters
  579. between the words do not move. For example, transposing @w{@samp{FOO,
  580. BAR}} results in @w{@samp{BAR, FOO}} rather than @samp{@w{BAR FOO,}}.
  581. @xref{Transpose}, for more on transposition and on arguments to
  582. transposition commands.
  583. @kindex M-@@
  584. @findex mark-word
  585. To operate on the next @var{n} words with an operation which applies
  586. between point and mark, you can either set the mark at point and then move
  587. over the words, or you can use the command @kbd{Meta-@@} (@code{mark-word})
  588. which does not move point but sets the mark where @kbd{Meta-f} would move
  589. to. It can be given arguments just like @kbd{Meta-f}.
  590. @cindex syntax table
  591. The word commands' understanding of syntax is completely controlled by
  592. the syntax table. For example, any character can be declared to be a word
  593. delimiter. @xref{Syntax}.
  594. @node Sentences, Paragraphs, Words, Text
  595. @section Sentences
  596. @cindex sentences
  597. The Emacs commands for manipulating sentences and paragraphs are mostly
  598. on @kbd{Meta-} keys, and therefore are like the word-handling commands.
  599. @table @kbd
  600. @item M-a
  601. Move back to the beginning of the sentence (@code{backward-sentence}).
  602. @item M-e
  603. Move forward to the end of the sentence (@code{forward-sentence}).
  604. @item M-k
  605. Kill forward to the end of the sentence (@code{kill-sentence}).
  606. @item C-x @key{DEL}
  607. Kill back to the beginning of the sentence @*(@code{backward-kill-sentence}).
  608. @end table
  609. @kindex M-a
  610. @kindex M-e
  611. @findex backward-sentence
  612. @findex forward-sentence
  613. The commands @kbd{Meta-a} and @kbd{Meta-e} (@code{backward-sentence}
  614. and @code{forward-sentence}) move to the beginning and end of the
  615. current sentence, respectively. They resemble @kbd{Control-a} and
  616. @kbd{Control-e}, which move to the beginning and end of a line. Unlike
  617. their counterparts, @kbd{Meta-a} and @kbd{Meta-e} move over successive
  618. sentences if repeated or given numeric arguments. Emacs assumes
  619. the typist's convention is followed, and thus considers a sentence to
  620. end wherever there is a @samp{.}, @samp{?}, or @samp{!} followed by the
  621. end of a line or two spaces, with any number of @samp{)}, @samp{]},
  622. @samp{'}, or @samp{"} characters allowed in between. A sentence also
  623. begins or ends wherever a paragraph begins or ends.@refill
  624. Neither @kbd{M-a} nor @kbd{M-e} moves past the newline or spaces beyond
  625. the sentence edge at which it is stopping.
  626. @kindex M-k
  627. @kindex C-x DEL
  628. @findex kill-sentence
  629. @findex backward-kill-sentence
  630. @kbd{M-a} and @kbd{M-e} have a corresponding kill command, just like
  631. @kbd{C-a} and @kbd{C-e} have @kbd{C-k}. The command is @kbd{M-k}
  632. (@code{kill-sentence}) which kills from point to the end of the
  633. sentence. With minus one as an argument it kills back to the beginning
  634. of the sentence. Larger arguments serve as repeat counts.@refill
  635. There is a special command, @kbd{C-x @key{DEL}}
  636. (@code{backward-kill-sentence}), for killing back to the beginning of a
  637. sentence, which is useful when you change your mind in the middle of
  638. composing text.@refill
  639. @vindex sentence-end
  640. The variable @code{sentence-end} controls recognition of the end of a
  641. sentence. It is a regexp that matches the last few characters of a
  642. sentence, together with the whitespace following the sentence. Its
  643. normal value is:
  644. @example
  645. "[.?!][]\"')]*\\($\\|\t\\| \\)[ \t\n]*"
  646. @end example
  647. @noindent
  648. This example is explained in the section on regexps. @xref{Regexps}.
  649. @node Paragraphs, Pages, Sentences, Text
  650. @section Paragraphs
  651. @cindex paragraphs
  652. @kindex M-@{
  653. @kindex M-@}
  654. @findex backward-paragraph
  655. @findex forward-paragraph
  656. The Emacs commands for manipulating paragraphs are also @kbd{Meta-}
  657. keys.
  658. @table @kbd
  659. @item M-@{
  660. Move back to previous paragraph beginning @*(@code{backward-paragraph}).
  661. @item M-@}
  662. Move forward to next paragraph end (@code{forward-paragraph}).
  663. @item M-h
  664. Put point and mark around this or next paragraph (@code{mark-paragraph}).
  665. @end table
  666. @kbd{Meta-@{} moves to the beginning of the current or previous paragraph,
  667. while @kbd{Meta-@}} moves to the end of the current or next paragraph.
  668. Blank lines and text formatter command lines separate paragraphs and are
  669. not part of any paragraph. An indented line starts a new paragraph.
  670. In major modes for programs (as opposed to Text mode), paragraphs begin
  671. and end only at blank lines. As a result, the paragraph commands continue to
  672. be useful even though there are no paragraphs per se.
  673. When there is a fill prefix, paragraphs are delimited by all lines
  674. which don't start with the fill prefix. @xref{Filling}.
  675. @kindex M-h
  676. @findex mark-paragraph
  677. To operate on a paragraph, you can use the command
  678. @kbd{Meta-h} (@code{mark-paragraph}) to set the region around it. This
  679. command puts point at the beginning and mark at the end of the paragraph
  680. point was in. If point is between paragraphs (in a run of blank lines or
  681. at a boundary), the paragraph following point is surrounded by point and
  682. mark. If there are blank lines preceding the first line of the paragraph,
  683. one of the blank lines is included in the region. Thus, for example,
  684. @kbd{M-h C-w} kills the paragraph around or after point.
  685. @vindex paragraph-start
  686. @vindex paragraph-separate
  687. The precise definition of a paragraph boundary is controlled by the
  688. variables @code{paragraph-separate} and @code{paragraph-start}. The value
  689. of @code{paragraph-start} is a regexp that matches any line that
  690. either starts or separates paragraphs. The value of
  691. @code{paragraph-separate} is another regexp that matches only lines
  692. that separate paragraphs without being part of any paragraph. Lines that
  693. start a new paragraph and are contained in it must match both regexps. For
  694. example, normally @code{paragraph-start} is @code{"^[ @t{\}t@t{\}n@t{\}f]"}
  695. and @code{paragraph-separate} is @code{"^[ @t{\}t@t{\}f]*$"}.@refill
  696. Normally it is desirable for page boundaries to separate paragraphs.
  697. The default values of these variables recognize the usual separator for
  698. pages.
  699. @node Pages, Filling, Paragraphs, Text
  700. @section Pages
  701. @cindex pages
  702. @cindex formfeed
  703. Files are often thought of as divided into @dfn{pages} by the
  704. @dfn{formfeed} character (ASCII Control-L, octal code 014). For
  705. example, if a file is printed on a line printer, each ``page'' of the
  706. file starts on a new page of paper. Emacs treats a page-separator
  707. character just like any other character. It can be inserted with
  708. @kbd{C-q C-l} or deleted with @key{DEL}. You are free to
  709. paginate your file or not. However, since pages are often meaningful
  710. divisions of the file, commands are provided to move over them and
  711. operate on them.
  712. @c WideCommands
  713. @table @kbd
  714. @item C-x [
  715. Move point to previous page boundary (@code{backward-page}).
  716. @item C-x ]
  717. Move point to next page boundary (@code{forward-page}).
  718. @item C-x C-p
  719. Put point and mark around this page (or another page) (@code{mark-page}).
  720. @item C-x l
  721. Count the lines in this page (@code{count-lines-page}).
  722. @end table
  723. @kindex C-x [
  724. @kindex C-x ]
  725. @findex forward-page
  726. @findex backward-page
  727. The @kbd{C-x [} (@code{backward-page}) command moves point to
  728. immediately after the previous page delimiter. If point is already
  729. right after a page delimiter, the command skips that one and stops at
  730. the previous one. A numeric argument serves as a repeat count. The
  731. @kbd{C-x ]} (@code{forward-page}) command moves forward past the next
  732. page delimiter.
  733. @kindex C-x C-p
  734. @findex mark-page
  735. The @kbd{C-x C-p} command (@code{mark-page}) puts point at the beginning
  736. of the current page and the mark at the end. The page delimiter at the end
  737. is included (the mark follows it). The page delimiter at the front is
  738. excluded (point follows it). You can follow this command by @kbd{C-w} to
  739. kill a page you want to move elsewhere. If you insert the page after a page
  740. delimiter, at a place where @kbd{C-x ]} or @kbd{C-x [} would take you,
  741. the page will be properly delimited before and after once again.
  742. A numeric argument to @kbd{C-x C-p} is used to specify which page to go
  743. to, relative to the current one. Zero means the current page. One means
  744. the next page, and @minus{}1 means the previous one.
  745. @kindex C-x l
  746. @findex count-lines-page
  747. The @kbd{C-x l} command (@code{count-lines-page}) can help you decide
  748. where to break a page in two. It prints the total number of lines in
  749. the current page in the echo area, then divides the lines into those
  750. preceding the current line and those following it, for example
  751. @example
  752. Page has 96 (72+25) lines
  753. @end example
  754. @noindent
  755. Notice that the sum is off by one; this is correct if point is not at the
  756. beginning of a line.
  757. @vindex page-delimiter
  758. The variable @code{page-delimiter} should have as its value a regexp that
  759. matches the beginning of a line that separates pages. This defines
  760. where pages begin. The normal value of this variable is @code{"^@t{\}f"},
  761. which matches a formfeed character at the beginning of a line.
  762. @node Filling, Case, Pages, Text
  763. @section Filling Text
  764. @cindex filling
  765. If you use Auto Fill mode, Emacs @dfn{fills} text (breaks it up into
  766. lines that fit in a specified width) as you insert it. When you alter
  767. existing text it is often no longer be properly filled afterwards and
  768. you can use explicit commands for filling.
  769. @menu
  770. * Auto Fill:: Auto Fill mode breaks long lines automatically.
  771. * Fill Commands:: Commands to refill paragraphs and center lines.
  772. * Fill Prefix:: Filling when every line is indented or in a comment, etc.
  773. @end menu
  774. @node Auto Fill, Fill Commands, Filling, Filling
  775. @subsection Auto Fill Mode
  776. @cindex Auto Fill mode
  777. @dfn{Auto Fill} mode is a minor mode in which lines are broken
  778. automatically when they become too wide. Breaking happens only when
  779. you type a @key{SPC} or @key{RET}.
  780. @table @kbd
  781. @item M-x auto-fill-mode
  782. Enable or disable Auto Fill mode.
  783. @item @key{SPC}
  784. @itemx @key{RET}
  785. In Auto Fill mode, break lines when appropriate.
  786. @end table
  787. @findex auto-fill-mode
  788. @kbd{M-x auto-fill-mode} turns Auto Fill mode on if it was off, or off
  789. if it was on. With a positive numeric argument the command always turns
  790. Auto Fill mode on, and with a negative argument it always turns it off.
  791. The presence of the word @samp{Fill} in the mode line, inside the
  792. parentheses, indicates that Auto Fill mode is in effect. Auto Fill mode
  793. is a minor mode; you can turn it on or off for each buffer individually.
  794. @xref{Minor Modes}.
  795. In Auto Fill mode, lines are broken automatically at spaces when they get
  796. longer than desired. Line breaking and rearrangement takes place
  797. only when you type @key{SPC} or @key{RET}. To insert a space
  798. or newline without permitting line-breaking, type @kbd{C-q @key{SPC}} or
  799. @kbd{C-q @key{LFD}} (recall that a newline is really a linefeed).
  800. @kbd{C-o} inserts a newline without line breaking.
  801. Auto Fill mode works well with Lisp mode: when it makes a new line in
  802. Lisp mode, it indents that line with @key{TAB}. If a line ending in a
  803. Lisp comment gets too long, the text of the comment is split into two
  804. comment lines. Optionally, new comment delimiters are inserted at the
  805. end of the first line and the beginning of the second, so that each line
  806. is a separate comment. The variable @code{comment-multi-line} controls
  807. the choice (@pxref{Comments}).
  808. Auto Fill mode does not refill entire paragraphs. It can break lines but
  809. cannot merge lines. Editing in the middle of a paragraph can result in
  810. a paragraph that is not correctly filled. The easiest way to make the
  811. paragraph properly filled again is using an explicit fill commands.
  812. Many users like Auto Fill mode and want to use it in all text files.
  813. The section on init files explains how you can arrange this
  814. permanently for yourself. @xref{Init File}.
  815. @node Fill Commands, Fill Prefix, Auto Fill, Filling
  816. @subsection Explicit Fill Commands
  817. @table @kbd
  818. @item M-q
  819. Fill current paragraph (@code{fill-paragraph}).
  820. @item M-g
  821. Fill each paragraph in the region (@code{fill-region}).
  822. @item C-x f
  823. Set the fill column (@code{set-fill-column}).
  824. @item M-x fill-region-as-paragraph
  825. Fill the region, considering it as one paragraph.
  826. @item M-s
  827. Center a line.
  828. @end table
  829. @kindex M-q
  830. @findex fill-paragraph
  831. To refill a paragraph, use the command @kbd{Meta-q}
  832. (@code{fill-paragraph}). It causes the paragraph containing point, or
  833. the one after point if point is between paragraphs, to be refilled. All
  834. line breaks are removed, and new ones are inserted where necessary.
  835. @kbd{M-q} can be undone with @kbd{C-_}. @xref{Undo}.@refill
  836. @kindex M-g
  837. @findex fill-region
  838. To refill many paragraphs, use @kbd{M-g} (@code{fill-region}), which
  839. divides the region into paragraphs and fills each of them.
  840. @findex fill-region-as-paragraph
  841. @kbd{Meta-q} and @kbd{Meta-g} use the same criteria as @kbd{Meta-h} for
  842. finding paragraph boundaries (@pxref{Paragraphs}). For more control, you
  843. can use @kbd{M-x fill-region-as-paragraph}, which refills everything
  844. between point and mark. This command recognizes only blank lines as
  845. paragraph separators.@refill
  846. @cindex justification
  847. A numeric argument to @kbd{M-g} or @kbd{M-q} causes it to
  848. @dfn{justify} the text as well as filling it. Extra spaces are inserted
  849. to make the right margin line up exactly at the fill column. To remove
  850. the extra spaces, use @kbd{M-q} or @kbd{M-g} with no argument.@refill
  851. @vindex auto-fill-inhibit-regexp
  852. The variable @code{auto-fill-inhibit-regexp} takes as a value a regexp to
  853. match lines that should not be auto-filled.
  854. @kindex M-s
  855. @cindex centering
  856. @findex center-line
  857. The command @kbd{Meta-s} (@code{center-line}) centers the current line
  858. within the current fill column. With an argument, it centers several lines
  859. individually and moves past them.
  860. @vindex fill-column
  861. The maximum line width for filling is in the variable
  862. @code{fill-column}. Altering the value of @code{fill-column} makes it
  863. local to the current buffer; until then, the default value---initially
  864. 70---is in effect. @xref{Locals}.
  865. @kindex C-x f
  866. @findex set-fill-column
  867. The easiest way to set @code{fill-column} is to use the command @kbd{C-x
  868. f} (@code{set-fill-column}). With no argument, it sets @code{fill-column}
  869. to the current horizontal position of point. With a numeric argument, it
  870. uses that number as the new fill column.
  871. @node Fill Prefix,, Fill Commands, Filling
  872. @subsection The Fill Prefix
  873. @cindex fill prefix
  874. To fill a paragraph in which each line starts with a special marker
  875. (which might be a few spaces, giving an indented paragraph), use the
  876. @dfn{fill prefix} feature. The fill prefix is a string which is not
  877. included in filling. Emacs expects every line to start with a fill
  878. prefix.
  879. @table @kbd
  880. @item C-x .
  881. Set the fill prefix (@code{set-fill-prefix}).
  882. @item M-q
  883. Fill a paragraph using current fill prefix (@code{fill-paragraph}).
  884. @item M-x fill-individual-paragraphs
  885. Fill the region, considering each change of indentation as starting a
  886. new paragraph.
  887. @end table
  888. @kindex C-x .
  889. @findex set-fill-prefix
  890. To specify a fill prefix, move to a line that starts with the desired
  891. prefix, put point at the end of the prefix, and give the command
  892. @w{@kbd{C-x .}}@: (@code{set-fill-prefix}). That's a period after the
  893. @kbd{C-x}. To turn off the fill prefix, specify an empty prefix: type
  894. @w{@kbd{C-x .}}@: with point at the beginning of a line.@refill
  895. When a fill prefix is in effect, the fill commands remove the fill
  896. prefix from each line before filling and insert it on each line after
  897. filling. Auto Fill mode also inserts the fill prefix inserted on new
  898. lines it creates. Lines that do not start with the fill prefix are
  899. considered to start paragraphs, both in @kbd{M-q} and the paragraph
  900. commands; this is just right if you are using paragraphs with hanging
  901. indentation (every line indented except the first one). Lines which are
  902. blank or indented once the prefix is removed also separate or start
  903. paragraphs; this is what you want if you are writing multi-paragraph
  904. comments with a comment delimiter on each line.
  905. @vindex fill-prefix
  906. The fill prefix is stored in the variable @code{fill-prefix}. Its value
  907. is a string, or @code{nil} when there is no fill prefix. This is a
  908. per-buffer variable; altering the variable affects only the current buffer,
  909. but there is a default value which you can change as well. @xref{Locals}.
  910. @findex fill-individual-paragraphs
  911. Another way to use fill prefixes is through @kbd{M-x
  912. fill-individual-paragraphs}. This function divides the region into groups
  913. of consecutive lines with the same amount and kind of indentation and fills
  914. each group as a paragraph, using its indentation as a fill prefix.
  915. @node Case,, Filling, Text
  916. @section Case Conversion Commands
  917. @cindex case conversion
  918. Emacs has commands for converting either a single word or any arbitrary
  919. range of text to upper case or to lower case.
  920. @c WideCommands
  921. @table @kbd
  922. @item M-l
  923. Convert following word to lower case (@code{downcase-word}).
  924. @item M-u
  925. Convert following word to upper case (@code{upcase-word}).
  926. @item M-c
  927. Capitalize the following word (@code{capitalize-word}).
  928. @item C-x C-l
  929. Convert region to lower case (@code{downcase-region}).
  930. @item C-x C-u
  931. Convert region to upper case (@code{upcase-region}).
  932. @end table
  933. @kindex M-l
  934. @kindex M-u
  935. @kindex M-c
  936. @cindex words
  937. @findex downcase-word
  938. @findex upcase-word
  939. @findex capitalize-word
  940. The word conversion commands are used most frequently. @kbd{Meta-l}
  941. (@code{downcase-word}) converts the word after point to lower case,
  942. moving past it. Thus, repeating @kbd{Meta-l} converts successive words.
  943. @kbd{Meta-u} (@code{upcase-word}) converts to all capitals instead,
  944. while @kbd{Meta-c} (@code{capitalize-word}) puts the first letter of the
  945. word into upper case and the rest into lower case. The word conversion
  946. commands convert several words at once if given an argument. They are
  947. especially convenient for converting a large amount of text from all
  948. upper case to mixed case: you can move through the text using
  949. @kbd{M-l}, @kbd{M-u}, or @kbd{M-c} on each word as appropriate,
  950. occasionally using @kbd{M-f} instead to skip a word.
  951. When given a negative argument, the word case conversion commands apply
  952. to the appropriate number of words before point, but do not move point.
  953. This is convenient when you have just typed a word in the wrong case: you
  954. can give the case conversion command and continue typing.
  955. If a word case conversion command is given in the middle of a word, it
  956. applies only to the part of the word which follows point. This is just
  957. like what @kbd{Meta-d} (@code{kill-word}) does. With a negative argument,
  958. case conversion applies only to the part of the word before point.
  959. @kindex C-x C-l
  960. @kindex C-x C-u
  961. @cindex region
  962. @findex downcase-region
  963. @findex upcase-region
  964. The other case conversion commands are @kbd{C-x C-u}
  965. (@code{upcase-region}) and @kbd{C-x C-l} (@code{downcase-region}), which
  966. convert everything between point and mark to the specified case. Point and
  967. mark do not move.@refill