home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / os2 / e17info.zip / EMACS / 19.17 / INFO / EMACS-8 (.txt) < prev    next >
GNU Info File  |  1993-07-18  |  50KB  |  898 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.54 from the
  2. input file emacs.texi.
  3. File: emacs,  Node: Scroll Bars,  Next: Menu Bars,  Prev: Frame Parameters,  Up: Frames
  4. Scroll Bars
  5. ===========
  6.    When using X, Emacs normally makes a "scroll bar" at the right of
  7. each Emacs window.  The scroll bar runs the height of the window, and
  8. shows a moving rectangular inner box which represents the portion of the
  9. buffer currently displayed.  The entire height of the scroll bar
  10. represents the entire length of the buffer.
  11.    You can use Mouse-2 (normally, the middle button) in the scroll bar
  12. to move or drag the inner box up and down.  If you move it to the top
  13. of the scroll bar, you see the top of the buffer.  If you move it to
  14. the bottom of the scroll bar, you see the bottom of the buffer.
  15.    The left and right buttons in the scroll bar scroll by controlled
  16. increments.  Mouse-1 (normally, the left button) moves the line at the
  17. level where you click up to the top of the window.  Mouse-3 (normally,
  18. the right button) moves the line at the top of the window down to the
  19. level where you click.  By clicking repeatedly in the same place, you
  20. can scroll by the same distance over and over.
  21.    You can enable or disable Scroll Bar mode with the command `M-x
  22. scroll-bar-mode'.  With no argument, it toggles the use of scroll bars.
  23. With an argument, it turns use of scroll bars on if and only if the
  24. argument is positive.  This command applies to all frames, including
  25. frames yet to be created.
  26.    To enable or disable scroll bars for just the selected frame, use the
  27. `M-x toggle-scroll-bar' command.
  28. File: emacs,  Node: Menu Bars,  Next: Faces,  Prev: Scroll Bars,  Up: Frames
  29. Menu Bars
  30. =========
  31.    By default, each Emacs frame has a menu bar at the top which you can
  32. use to perform certain common operations.  There's no need to describe
  33. them in detail here, as you can more easily see for yourself; also, we
  34. may change them and add to them in subsequent Emacs versions.
  35.    Each of the operations in the menu bar is bound to an ordinary Emacs
  36. command which you can invoke equally well with `M-x' or with its own
  37. key bindings.  To see the command's name and documentation, type `C-h
  38. k' and then select the menu bar item you are interested in.
  39.    You can turn display of menu bars on or off with `M-x menu-bar-mode'.
  40. With no argument, this command toggles Menu Bar mode, a minor mode.
  41. With an argument, the command turns Menu Bar mode on if the argument is
  42. positive, off if the argument is not positive.
  43. File: emacs,  Node: Faces,  Next: Misc X,  Prev: Menu Bars,  Up: Frames
  44. Using Multiple Typefaces
  45. ========================
  46.    When using Emacs with X, you can set up multiple styles of displaying
  47. characters.  The aspects of style that you can control are the type
  48. font, the foreground color, the background color, and whether to
  49. underline.
  50.    The way you control display style is by defining named "faces".
  51. Each face can specify a type font, a foreground color, a background
  52. color, and an underline flag; but it does not have to specify all of
  53. them.
  54.    The style of display used for a given character in the text is
  55. determined by combining several faces.  Which faces to use is always set
  56. up by Lisp programs, at present, by means of text properties and
  57. overlays.  Any aspect of the display style that isn't specified by
  58. overlays or text properties comes from the frame itself.
  59.    To see what faces are currently defined, and what they look like,
  60. type `M-x list-faces-display'.  It's possible for a given face to look
  61. different in different frames; this command shows the appearance in the
  62. frame in which you type it.
  63.    When Transient Mark mode is enabled, the text of the region is
  64. highlighted when the mark is active.  This uses a face named `region';
  65. you can control the style of highlighting by changing the style of this
  66. face with the commands below.  *Note Setting Mark::, for more
  67. information about Transient Mark mode and activation and deactivation
  68. of the mark.
  69.    Here are the commands for users to change the font of a face.
  70. `M-x set-face-font RET FACE RET FONT RET'
  71.      Use font FONT in face FACE.
  72. `M-x make-face-bold RET FACE RET'
  73.      Convert face FACE to use a bold version of its current font.
  74. `M-x make-face-italic RET FACE RET'
  75.      Convert face FACE to use a italic version of its current font.
  76. `M-x make-face-bold-italic RET FACE RET'
  77.      Convert face FACE to use a bold-italic version of its current font.
  78. `M-x make-face-unbold RET FACE RET'
  79.      Convert face FACE to use a non-bold version of its current font.
  80. `M-x make-face-unitalic RET FACE RET'
  81.      Convert face FACE to use a non-italic version of its current font.
  82.    Here are the commands for users to set the colors and underline flag
  83. of a face:
  84. `M-x set-face-foreground RET FACE RET COLOR RET'
  85.      Use color COLOR for the foreground of characters in face FACE.
  86. `M-x set-face-background RET FACE RET COLOR RET'
  87.      Use color COLOR for the background of characters in face FACE.
  88. `M-x set-face-underline-p RET FACE RET FLAG RET'
  89.      Specify whether to underline characters in face FACE.
  90. `M-x invert-face RET FACE RET'
  91.      Swap the foreground and background colors of face FACE.
  92. File: emacs,  Node: Misc X,  Prev: Faces,  Up: Frames
  93. Miscellaneous X Window Features
  94. ===============================
  95.    To iconify the selected Emacs frame, type `C-z'.  The normal meaning
  96. of `C-z', to suspend Emacs, is not useful under a window system, so it
  97. has a different binding in that case (the command `iconify-frame').
  98.    To delete the selected frame, type `C-x 5 0'.
  99.    Under X Windows, when Transient Mark mode is enabled, Emacs
  100. highlights the region when the mark is active.  This is the main motive
  101. for using Transient Mark mode.  To enable this mode, use the command
  102. `M-x transient-mark-mode'.  *Note Mark::.
  103. File: emacs,  Node: Major Modes,  Next: Indentation,  Prev: Frames,  Up: Top
  104. Major Modes
  105. ***********
  106.    Emacs provides many alternative "major modes", each of which
  107. customizes Emacs for editing text of a particular sort.  The major modes
  108. are mutually exclusive, and each buffer has one major mode at any time.
  109. The mode line normally shows the name of the current major mode, in
  110. parentheses (*note Mode Line::.).
  111.    The least specialized major mode is called "Fundamental mode".  This
  112. mode has no mode-specific redefinitions or variable settings, so that
  113. each Emacs command behaves in its most general manner, and each option
  114. is in its default state.  For editing any specific type of text, such
  115. as Lisp code or English text, you should switch to the appropriate
  116. major mode, such as Lisp mode or Text mode.
  117.    Selecting a major mode changes the meanings of a few keys to become
  118. more specifically adapted to the language being edited.  The ones which
  119. are changed frequently are TAB, DEL, and LFD.  In addition, the
  120. commands which handle comments use the mode to determine how comments
  121. are to be delimited.  Many major modes redefine the syntactical
  122. properties of characters appearing in the buffer.  *Note Syntax::.
  123.    The major modes fall into three major groups.  Lisp mode (which has
  124. several variants), C mode, Fortran mode and others are for specific
  125. programming languages.  Text mode, Nroff mode, TeX mode and Outline
  126. mode are for editing English text.  The remaining major modes are not
  127. intended for use on users' files; they are used in buffers created for
  128. specific purposes by Emacs, such as Dired mode for buffers made by Dired
  129. (*note Dired::.), and Mail mode for buffers made by `C-x m' (*note
  130. Sending Mail::.), and Shell mode for buffers used for communicating
  131. with an inferior shell process (*note Interactive Shell::.).
  132.    Most programming language major modes specify that only blank lines
  133. separate paragraphs.  This is so that the paragraph commands remain
  134. useful.  (*Note Paragraphs::.)  They also cause Auto Fill mode to use
  135. the definition of TAB to indent the new lines it creates.  This is
  136. because most lines in a program are usually indented.  (*Note
  137. Indentation::.)
  138. * Menu:
  139. * Choosing Modes::     How major modes are specified or chosen.
  140. File: emacs,  Node: Choosing Modes,  Prev: Major Modes,  Up: Major Modes
  141. How Major Modes are Chosen
  142. ==========================
  143.    You can select a major mode explicitly for the current buffer, but
  144. most of the time Emacs determines which mode to use based on the file
  145. name or on special text in the file.
  146.    Explicit selection of a new major mode is done with a `M-x' command.
  147. From the name of a major mode, add `-mode' to get the name of a command
  148. to select that mode.  Thus, you can enter Lisp mode by executing `M-x
  149. lisp-mode'.
  150.    When you visit a file, Emacs usually chooses the right major mode
  151. based on the file's name.  For example, files whose names end in `.c'
  152. are edited in C mode.  The correspondence between file names and major
  153. mode is controlled by the variable `auto-mode-alist'.  Its value is a
  154. list in which each element has the form
  155.      (REGEXP . MODE-FUNCTION)
  156. For example, one element normally found in the list has the form
  157. `("\\.c$" . c-mode)', and it is responsible for selecting C mode for
  158. files whose names end in `.c'.  (Note that `\\' is needed in Lisp
  159. syntax to include a `\' in the string, which is needed to suppress the
  160. special meaning of `.' in regexps.)  The only practical way to change
  161. this variable is with Lisp code.
  162.    You can specify which major mode should be used for editing a certain
  163. file by a special sort of text in the first nonblank line of the file.
  164. The mode name should appear in this line both preceded and followed by
  165. `-*-'.  Other text may appear on the line as well.  For example,
  166.      ;-*-Lisp-*-
  167. tells Emacs to use Lisp mode.  Such an explicit specification overrides
  168. any defaulting based on the file name.  Note how the semicolon is used
  169. to make Lisp treat this line as a comment.
  170.    Another format of mode specification is
  171.      -*-Mode: MODENAME;-*-
  172. which allows you to specify local variables as well, like this:
  173.      -*- mode: MODENAME; VAR: VALUE; ... -*-
  174. *Note File Variables::, for more information about this.
  175.    When you visit a file that does not specify a major mode to use, or
  176. when you create a new buffer with `C-x b', the variable
  177. `default-major-mode' specifies which major mode to use.  Normally its
  178. value is the symbol `fundamental-mode', which specifies Fundamental
  179. mode.  If `default-major-mode' is `nil', the major mode is taken from
  180. the previously selected buffer.
  181.    If you change the major mode of a buffer, you can go back to the
  182. major mode Emacs would choose automatically: use the command `M-x
  183. normal-mode' to do this.  This is the same function that `find-file'
  184. calls to choose the major mode.  It also processes the file's local
  185. variables list if any.
  186. File: emacs,  Node: Indentation,  Next: Text,  Prev: Major Modes,  Up: Top
  187. Indentation
  188. ***********
  189.    This chapter describes the Emacs commands that add, remove, or
  190. adjust indentation.
  191. `TAB'
  192.      Indent current line "appropriately" in a mode-dependent fashion.
  193. `LFD'
  194.      Perform RET followed by TAB (`newline-and-indent').
  195. `M-^'
  196.      Merge two lines (`delete-indentation').  This would cancel out the
  197.      effect of LFD.
  198. `C-M-o'
  199.      Split line at point; text on the line after point becomes a new
  200.      line indented to the same column that it now starts in
  201.      (`split-line').
  202. `M-m'
  203.      Move (forward or back) to the first nonblank character on the
  204.      current line (`back-to-indentation').
  205. `C-M-\'
  206.      Indent several lines to same column (`indent-region').
  207. `C-x TAB'
  208.      Shift block of lines rigidly right or left (`indent-rigidly').
  209. `M-i'
  210.      Indent from point to the next prespecified tab stop column
  211.      (`tab-to-tab-stop').
  212. `M-x indent-relative'
  213.      Indent from point to under an indentation point in the previous
  214.      line.
  215.    Most programming languages have some indentation convention.  For
  216. Lisp code, lines are indented according to their nesting in
  217. parentheses.  The same general idea is used for C code, though many
  218. details are different.
  219.    Whatever the language, to indent a line, use the TAB command.  Each
  220. major mode defines this command to perform the sort of indentation
  221. appropriate for the particular language.  In Lisp mode, TAB aligns the
  222. line according to its depth in parentheses.  No matter where in the
  223. line you are when you type TAB, it aligns the line as a whole.  In C
  224. mode, TAB implements a subtle and sophisticated indentation style that
  225. knows about many aspects of C syntax.
  226.    In Text mode, TAB runs the command `tab-to-tab-stop', which indents
  227. to the next tab stop column.  You can set the tab stops with `M-x
  228. edit-tab-stops'.
  229. * Menu:
  230. * Indentation Commands::  Various commands and techniques for indentation.
  231. * Tab Stops::             You can set arbitrary "tab stops" and then
  232.                             indent to the next tab stop when you want to.
  233. * Just Spaces::           You can request indentation using just spaces.
  234. File: emacs,  Node: Indentation Commands,  Next: Tab Stops,  Prev: Indentation,  Up: Indentation
  235. Indentation Commands and Techniques
  236. ===================================
  237.    If you just want to insert a tab character in the buffer, you can
  238. type `C-q TAB'.
  239.    To move over the indentation on a line, do `M-m'
  240. (`back-to-indentation').  This command, given anywhere on a line,
  241. positions point at the first nonblank character on the line.
  242.    To insert an indented line before the current line, do `C-a C-o
  243. TAB'.  To make an indented line after the current line, use `C-e LFD'.
  244.    `C-M-o' (`split-line') moves the text from point to the end of the
  245. line vertically down, so that the current line becomes two lines.
  246. `C-M-o' first moves point forward over any spaces and tabs.  Then it
  247. inserts after point a newline and enough indentation to reach the same
  248. column point is on.  Point remains before the inserted newline; in this
  249. regard, `C-M-o' resembles `C-o'.
  250.    To join two lines cleanly, use the `M-^' (`delete-indentation')
  251. command.  It deletes the indentation at the front of the current line,
  252. and the line boundary as well, replacing them with a single space.  As
  253. a special case (useful for Lisp code) the single space is omitted if
  254. the characters to be joined are consecutive open parentheses or closing
  255. parentheses, or if the junction follows another newline.  To delete
  256. just the indentation of a line, go to the beginning of the line and use
  257. `M-\' (`delete-horizontal-space'), which deletes all spaces and tabs
  258. around the cursor.
  259.    If you have a fill prefix, `M-^' deletes the fill prefix if it
  260. appears after the newline that is deleted.  *Note Fill Prefix::.
  261.    There are also commands for changing the indentation of several
  262. lines at once.  `C-M-\' (`indent-region') gives each line which begins
  263. in the region the "usual" indentation by invoking TAB at the beginning
  264. of the line.  A numeric argument specifies the column to indent to, and
  265. each line is shifted left or right so that its first nonblank character
  266. appears in that column.  `C-x TAB' (`indent-rigidly') moves all of the
  267. lines in the region right by its argument (left, for negative
  268. arguments).  The whole group of lines moves rigidly sideways, which is
  269. how the command gets its name.
  270.    `M-x indent-relative' indents at point based on the previous line
  271. (actually, the last nonempty line).  It inserts whitespace at point,
  272. moving point, until it is underneath an indentation point in the
  273. previous line.  An indentation point is the end of a sequence of
  274. whitespace or the end of the line.  If point is farther right than any
  275. indentation point in the previous line, the whitespace before point is
  276. deleted and the first indentation point then applicable is used.  If no
  277. indentation point is applicable even then, `indent-relative' runs
  278. `tab-to-tab-stop' (*note Tab Stops::.).
  279.    `indent-relative' is the definition of TAB in Indented Text mode.
  280. *Note Text::.
  281. File: emacs,  Node: Tab Stops,  Next: Just Spaces,  Prev: Indentation Commands,  Up: Indentation
  282. Tab Stops
  283. =========
  284.    For typing in tables, you can use Text mode's definition of TAB,
  285. `tab-to-tab-stop'.  This command inserts indentation before point,
  286. enough to reach the next tab stop column.  If you are not in Text mode,
  287. this command can be found on the key `M-i'.
  288.    You can specify the tab stops used by `M-i'.  They are stored in a
  289. variable called `tab-stop-list', as a list of column-numbers in
  290. increasing order.
  291.    The convenient way to set the tab stops is with `M-x edit-tab-stops',
  292. which creates and selects a buffer containing a description of the tab
  293. stop settings.  You can edit this buffer to specify different tab
  294. stops, and then type `C-c C-c' to make those new tab stops take effect.
  295. In the tab stop buffer, `C-c C-c' runs the function
  296. `edit-tab-stops-note-changes' rather than its usual definition
  297. `save-buffer'.  `edit-tab-stops' records which buffer was current when
  298. you invoked it, and stores the tab stops back in that buffer; normally
  299. all buffers share the same tab stops and changing them in one buffer
  300. affects all, but if you happen to make `tab-stop-list' local in one
  301. buffer then `edit-tab-stops' in that buffer will edit the local
  302. settings.
  303.    Here is what the text representing the tab stops looks like for
  304. ordinary tab stops every eight columns.
  305.              :       :       :       :       :       :
  306.      0         1         2         3         4
  307.      0123456789012345678901234567890123456789012345678
  308.      To install changes, type C-c C-c
  309.    The first line contains a colon at each tab stop.  The remaining
  310. lines are present just to help you see where the colons are and know
  311. what to do.
  312.    Note that the tab stops that control `tab-to-tab-stop' have nothing
  313. to do with displaying tab characters in the buffer.  *Note Display
  314. Vars::, for more information on that.
  315. File: emacs,  Node: Just Spaces,  Prev: Tab Stops,  Up: Indentation
  316. Tabs vs. Spaces
  317. ===============
  318.    Emacs normally uses both tabs and spaces to indent lines.  If you
  319. prefer, all indentation can be made from spaces only.  To request this,
  320. set `indent-tabs-mode' to `nil'.  This is a per-buffer variable;
  321. altering the variable affects only the current buffer, but there is a
  322. default value which you can change as well.  *Note Locals::.
  323.    There are also commands to convert tabs to spaces or vice versa,
  324. always preserving the columns of all nonblank text.  `M-x tabify' scans
  325. the region for sequences of spaces, and converts sequences of at least
  326. three spaces to tabs if that can be done without changing indentation.
  327. `M-x untabify' changes all tabs in the region to appropriate numbers of
  328. spaces.
  329. File: emacs,  Node: Text,  Next: Programs,  Prev: Indentation,  Up: Top
  330. Commands for Human Languages
  331. ****************************
  332.    The term "text" has two widespread meanings in our area of the
  333. computer field.  One is data that is a sequence of characters.  Any file
  334. that you edit with Emacs is text, in this sense of the word.  The other
  335. meaning is more restrictive: a sequence of characters in a human
  336. language for humans to read (possibly after processing by a text
  337. formatter), as opposed to a program or commands for a program.
  338.    Human languages have syntactic/stylistic conventions that can be
  339. supported or used to advantage by editor commands: conventions involving
  340. words, sentences, paragraphs, and capital letters.  This chapter
  341. describes Emacs commands for all of these things.  There are also
  342. commands for "filling", which means rearranging the lines of a
  343. paragraph to be approximately equal in length.  The commands for moving
  344. over and killing words, sentences and paragraphs, while intended
  345. primarily for editing text, are also often useful for editing programs.
  346.    Emacs has several major modes for editing human language text.  If
  347. the file contains text pure and simple, use Text mode, which customizes
  348. Emacs in small ways for the syntactic conventions of text.  For text
  349. which contains embedded commands for text formatters, Emacs has other
  350. major modes, each for a particular text formatter.  Thus, for input to
  351. TeX, you would use TeX mode; for input to nroff, Nroff mode.
  352. * Menu:
  353. * Words::         Moving over and killing words.
  354. * Sentences::     Moving over and killing sentences.
  355. * Paragraphs::      Moving over paragraphs.
  356. * Pages::      Moving over pages.
  357. * Filling::       Filling or justifying text.
  358. * Case::          Changing the case of text.
  359. * Text Mode::     The major modes for editing text files.
  360. * Outline Mode::  The major mode for editing outlines.
  361. * TeX Mode::      The major modes for editing input to the formatter TeX.
  362. * Nroff Mode::    The major mode for editing input to the formatter nroff.
  363. File: emacs,  Node: Words,  Next: Sentences,  Up: Text
  364. Words
  365. =====
  366.    Emacs has commands for moving over or operating on words.  By
  367. convention, the keys for them are all Meta characters.
  368. `M-f'
  369.      Move forward over a word (`forward-word').
  370. `M-b'
  371.      Move backward over a word (`backward-word').
  372. `M-d'
  373.      Kill up to the end of a word (`kill-word').
  374. `M-DEL'
  375.      Kill back to the beginning of a word (`backward-kill-word').
  376. `M-@'
  377.      Mark the end of the next word (`mark-word').
  378. `M-t'
  379.      Transpose two words or drag a word across other words
  380.      (`transpose-words').
  381.    Notice how these keys form a series that parallels the
  382. character-based `C-f', `C-b', `C-d', `C-t' and DEL.  `M-@' is related
  383. to `C-@', which is an alias for `C-SPC'.
  384.    The commands `M-f' (`forward-word') and `M-b' (`backward-word') move
  385. forward and backward over words.  These Meta characters are thus
  386. analogous to the corresponding control characters, `C-f' and `C-b',
  387. which move over single characters in the text.  The analogy extends to
  388. numeric arguments, which serve as repeat counts.  `M-f' with a negative
  389. argument moves backward, and `M-b' with a negative argument moves
  390. forward.  Forward motion stops right after the last letter of the word,
  391. while backward motion stops right before the first letter.
  392.    `M-d' (`kill-word') kills the word after point.  To be precise, it
  393. kills everything from point to the place `M-f' would move to.  Thus, if
  394. point is in the middle of a word, `M-d' kills just the part after
  395. point.  If some punctuation comes between point and the next word, it
  396. is killed along with the word.  (If you wish to kill only the next word
  397. but not the punctuation before it, simply do `M-f' to get the end, and
  398. kill the word backwards with `M-DEL'.) `M-d' takes arguments just like
  399. `M-f'.
  400.    `M-DEL' (`backward-kill-word') kills the word before point.  It
  401. kills everything from point back to where `M-b' would move to.  If
  402. point is after the space in `FOO, BAR', then `FOO, ' is killed.  (If
  403. you wish to kill just `FOO', do `M-b M-d' instead of `M-DEL'.)
  404.    `M-t' (`transpose-words') exchanges the word before or containing
  405. point with the following word.  The delimiter characters between the
  406. words do not move.  For example, `FOO, BAR' transposes into `BAR, FOO'
  407. rather than `BAR FOO,'.  *Note Transpose::, for more on transposition
  408. and on arguments to transposition commands.
  409.    To operate on the next N words with an operation which applies
  410. between point and mark, you can either set the mark at point and then
  411. move over the words, or you can use the command `M-@' (`mark-word')
  412. which does not move point, but sets the mark where `M-f' would move to.
  413. `M-@' accepts a numeric argument that says how many words to scan for
  414. the place to put the mark.
  415.    The word commands' understanding of syntax is completely controlled
  416. by the syntax table.  Any character can, for example, be declared to be
  417. a word delimiter.  *Note Syntax::.
  418. File: emacs,  Node: Sentences,  Next: Paragraphs,  Prev: Words,  Up: Text
  419. Sentences
  420. =========
  421.    The Emacs commands for manipulating sentences and paragraphs are
  422. mostly on Meta keys, so as to be like the word-handling commands.
  423. `M-a'
  424.      Move back to the beginning of the sentence (`backward-sentence').
  425. `M-e'
  426.      Move forward to the end of the sentence (`forward-sentence').
  427. `M-k'
  428.      Kill forward to the end of the sentence (`kill-sentence').
  429. `C-x DEL'
  430.      Kill back to the beginning of the sentence
  431.      (`backward-kill-sentence').
  432.    The commands `M-a' and `M-e' (`backward-sentence' and
  433. `forward-sentence') move to the beginning and end of the current
  434. sentence, respectively.  They were chosen to resemble `C-a' and `C-e',
  435. which move to the beginning and end of a line.  Unlike them, `M-a' and
  436. `M-e' if repeated or given numeric arguments move over successive
  437. sentences.  Emacs assumes that the typist's convention is followed, and
  438. thus considers a sentence to end wherever there is a `.', `?' or `!'
  439. followed by the end of a line or two spaces, with any number of `)',
  440. `]', `'', or `"' characters allowed in between.  A sentence also begins
  441. or ends wherever a paragraph begins or ends.
  442.    Neither `M-a' nor `M-e' moves past the newline or spaces beyond the
  443. sentence edge at which it is stopping.
  444.    Just as `C-a' and `C-e' have a kill command, `C-k', to go with them,
  445. so `M-a' and `M-e' have a corresponding kill command `M-k'
  446. (`kill-sentence') which kills from point to the end of the sentence.
  447. With minus one as an argument it kills back to the beginning of the
  448. sentence.  Larger arguments serve as a repeat count.
  449.    There is a special command, `C-x DEL' (`backward-kill-sentence') for
  450. killing back to the beginning of a sentence, because this is useful
  451. when you change your mind in the middle of composing text.
  452.    The variable `sentence-end' controls recognition of the end of a
  453. sentence.  It is a regexp that matches the last few characters of a
  454. sentence, together with the whitespace following the sentence.  Its
  455. normal value is
  456.      "[.?!][]\"')]*\\($\\|\t\\|  \\)[ \t\n]*"
  457. This example is explained in the section on regexps.  *Note Regexps::.
  458. File: emacs,  Node: Paragraphs,  Next: Pages,  Prev: Sentences,  Up: Text
  459. Paragraphs
  460. ==========
  461.    The Emacs commands for manipulating paragraphs are also Meta keys.
  462. `M-{'
  463.      Move back to previous paragraph beginning (`backward-paragraph').
  464. `M-}'
  465.      Move forward to next paragraph end (`forward-paragraph').
  466. `M-h'
  467.      Put point and mark around this or next paragraph
  468.      (`mark-paragraph').
  469.    `M-{' moves to the beginning of the current or previous paragraph,
  470. while `M-}' moves to the end of the current or next paragraph.  Blank
  471. lines and text formatter command lines separate paragraphs and are not
  472. part of any paragraph.  Also, an indented line starts a new paragraph.
  473.    In major modes for programs (as opposed to Text mode), paragraphs
  474. begin and end only at blank lines.  This makes the paragraph commands
  475. continue to be useful even though there are no paragraphs per se.
  476.    When there is a fill prefix, then paragraphs are delimited by all
  477. lines which don't start with the fill prefix.  *Note Filling::.
  478.    When you wish to operate on a paragraph, you can use the command
  479. `M-h' (`mark-paragraph') to set the region around it.  This command
  480. puts point at the beginning and mark at the end of the paragraph point
  481. was in.  If point is between paragraphs (in a run of blank lines, or at
  482. a boundary), the paragraph following point is surrounded by point and
  483. mark.  If there are blank lines preceding the first line of the
  484. paragraph, one of these blank lines is included in the region.  Thus,
  485. for example, `M-h C-w' kills the paragraph around or after point.
  486.    The precise definition of a paragraph boundary is controlled by the
  487. variables `paragraph-separate' and `paragraph-start'.  The value of
  488. `paragraph-start' is a regexp that should match any line that either
  489. starts or separates paragraphs.  The value of `paragraph-separate' is
  490. another regexp that should match only lines that separate paragraphs
  491. without being part of any paragraph.  Lines that start a new paragraph
  492. and are contained in it must match both regexps.  For example, normally
  493. `paragraph-start' is `"^[ \t\n\f]"' and `paragraph-separate' is `"^[
  494. \t\f]*$"'.
  495.    Normally it is desirable for page boundaries to separate paragraphs.
  496. The default values of these variables recognize the usual separator for
  497. pages.
  498. File: emacs,  Node: Pages,  Next: Filling,  Prev: Paragraphs,  Up: Text
  499. Pages
  500. =====
  501.    Files are often thought of as divided into "pages" by the "formfeed"
  502. character (ASCII control-L, octal code 014).  For example, if a file is
  503. printed on a line printer, each page of the file, in this sense, will
  504. start on a new page of paper.  Emacs treats a page-separator character
  505. just like any other character.  You can insert it with `C-q C-l', or
  506. delete it with DEL.  Thus, you are free to paginate your file or not.
  507. However, since pages are often meaningful divisions of the file, Emacs
  508. provides commands to move over them and operate on them.
  509. `C-x ['
  510.      Move point to previous page boundary (`backward-page').
  511. `C-x ]'
  512.      Move point to next page boundary (`forward-page').
  513. `C-x C-p'
  514.      Put point and mark around this page (or another page)
  515.      (`mark-page').
  516. `C-x l'
  517.      Count the lines in this page (`count-lines-page').
  518.    The `C-x [' (`backward-page') command moves point to immediately
  519. after the previous page delimiter.  If point is already right after a
  520. page delimiter, it skips that one and stops at the previous one.  A
  521. numeric argument serves as a repeat count.  The `C-x ]' (`forward-page')
  522. command moves forward past the next page delimiter.
  523.    The `C-x C-p' command (`mark-page') puts point at the beginning of
  524. the current page and the mark at the end.  The page delimiter at the end
  525. is included (the mark follows it).  The page delimiter at the front is
  526. excluded (point follows it).  This command can be followed by `C-w' to
  527. kill a page which is to be moved elsewhere.  If it is inserted after a
  528. page delimiter, at a place where `C-x ]' or `C-x [' would take you, then
  529. the page will be properly delimited before and after once again.
  530.    A numeric argument to `C-x C-p' is used to specify which page to go
  531. to, relative to the current one.  Zero means the current page.  One
  532. means the next page, and -1 means the previous one.
  533.    The `C-x l' command (`count-lines-page') is good for deciding where
  534. to break a page in two.  It prints in the echo area the total number of
  535. lines in the current page, and then divides it up into those preceding
  536. the current line and those following, as in
  537.      Page has 96 (72+25) lines
  538. Notice that the sum is off by one; this is correct if point is not at
  539. the beginning of a line.
  540.    The variable `page-delimiter' controls where pages begin.  Its value
  541. is a regexp that matches the beginning of a line that separates pages.
  542. The normal value of this variable is `"^\f"', which matches a formfeed
  543. character at the beginning of a line.
  544. File: emacs,  Node: Filling,  Next: Case,  Prev: Pages,  Up: Text
  545. Filling Text
  546. ============
  547.    With Auto Fill mode, text can be "filled" (broken up into lines that
  548. fit in a specified width) as you insert it.  If you alter existing text
  549. it may no longer be properly filled; then you can use the explicit fill
  550. commands to fill the paragraph again.
  551. * Menu:
  552. * Auto Fill::       Auto Fill mode breaks long lines automatically.
  553. * Fill Commands::  Commands to refill paragraphs and center lines.
  554. * Fill Prefix::    Filling when every line is indented or in a comment, etc.
  555. File: emacs,  Node: Auto Fill,  Next: Fill Commands,  Up: Filling
  556. Auto Fill Mode
  557. --------------
  558.    "Auto Fill" mode is a minor mode in which lines are broken
  559. automatically when they become too wide.  Breaking happens only when
  560. you type a SPC or RET.
  561. `M-x auto-fill-mode'
  562.      Enable or disable Auto Fill mode.
  563. `SPC'
  564. `RET'
  565.      In Auto Fill mode, break lines when appropriate.
  566.    `M-x auto-fill-mode' turns Auto Fill mode on if it was off, or off if
  567. it was on.  With a positive numeric argument it always turns Auto Fill
  568. mode on, and with a negative argument always turns it off.  You can see
  569. when Auto Fill mode is in effect by the presence of the word `Fill' in
  570. the mode line, inside the parentheses.  Auto Fill mode is a minor mode,
  571. turned on or off for each buffer individually.  *Note Minor Modes::.
  572.    In Auto Fill mode, lines are broken automatically at spaces when
  573. they get longer than the desired width.  Line breaking and
  574. rearrangement takes place only when you type SPC or RET.  If you wish
  575. to insert a space or newline without permitting line-breaking, type
  576. `C-q SPC' or `C-q LFD' (recall that a newline is really a linefeed).
  577. Also, `C-o' inserts a newline without line breaking.
  578.    Auto Fill mode works well with Lisp mode, because when it makes a new
  579. line in Lisp mode it indents that line with TAB.  If a line ending in a
  580. comment gets too long, the text of the comment is split into two
  581. comment lines.  Optionally new comment delimiters are inserted at the
  582. end of the first line and the beginning of the second so that each line
  583. is a separate comment; the variable `comment-multi-line' controls the
  584. choice (*note Comments::.).
  585.    Auto Fill mode does not refill entire paragraphs.  It can break
  586. lines but cannot merge lines.  So editing in the middle of a paragraph
  587. can result in a paragraph that is not correctly filled.  The easiest
  588. way to make the paragraph properly filled again is usually with the
  589. explicit fill commands.  *Note Fill Commands::.
  590.    Many users like Auto Fill mode and want to use it in all text files.
  591. The section on init files says how to arrange this permanently for
  592. yourself.  *Note Init File::.
  593. File: emacs,  Node: Fill Commands,  Next: Fill Prefix,  Prev: Auto Fill,  Up: Filling
  594. Explicit Fill Commands
  595. ----------------------
  596. `M-q'
  597.      Fill current paragraph (`fill-paragraph').
  598. `C-x f'
  599.      Set the fill column (`set-fill-column').
  600. `M-x fill-region'
  601.      Fill each paragraph in the region (`fill-region').
  602. `M-x fill-region-as-paragraph.'
  603.      Fill the region, considering it as one paragraph.
  604. `M-s'
  605.      Center a line.
  606.    To refill a paragraph, use the command `M-q' (`fill-paragraph').
  607. This operates on the paragraph that point is inside, or the one after
  608. point if point is between paragraphs.  Refilling works by removing all
  609. the line-breaks, then inserting new ones where necessary.
  610.    The command `M-s' (`center-line') centers the current line within
  611. the current fill column.  With an argument, it centers several lines
  612. individually and moves past them.
  613.    To refill many paragraphs, use `M-x fill-region', which divides the
  614. region into paragraphs and fills each of them.
  615.    `M-q' and `fill-region' use the same criteria as `M-h' for finding
  616. paragraph boundaries (*note Paragraphs::.).  For more control, you can
  617. use `M-x fill-region-as-paragraph', which refills everything between
  618. point and mark.  This command deletes any blank lines within the
  619. region, so separate blocks of text end up combined into one block.
  620.    A numeric argument to `M-q' causes it to "justify" the text as well
  621. as filling it.  This means that extra spaces are inserted to make the
  622. right margin line up exactly at the fill column.  To remove the extra
  623. spaces, use `M-q' with no argument.  (Likewise for `fill-region'.)
  624.    When ADAPTIVE-FILL-MODE is non-`nil' (which is normally the case),
  625. if you use `fill-region-as-paragraph' on an indented paragraph and you
  626. don't have a fill prefix, it uses the indentation of the second line of
  627. the paragraph as the fill prefix.  The effect of adaptive filling is
  628. not noticeable in Text mode, because an indented line counts as a
  629. paragraph starter and thus each line of an indented paragraph is
  630. considered a paragraph of its own.  But you do notice the effect in
  631. Indented Text mode and some other major modes.
  632.    The maximum line width for filling is in the variable `fill-column'.
  633. Altering the value of `fill-column' makes it local to the current
  634. buffer; until that time, the default value is in effect.  The default is
  635. initially 70.  *Note Locals::.
  636.    The easiest way to set `fill-column' is to use the command `C-x f'
  637. (`set-fill-column').  With no argument, it sets `fill-column' to the
  638. current horizontal position of point.  With a numeric argument, it uses
  639. that as the new fill column.
  640. File: emacs,  Node: Fill Prefix,  Prev: Fill Commands,  Up: Filling
  641. The Fill Prefix
  642. ---------------
  643.    To fill a paragraph in which each line starts with a special marker
  644. (which might be a few spaces, giving an indented paragraph), use the
  645. "fill prefix" feature.  The fill prefix is a string which Emacs expects
  646. every line to start with, and which is not included in filling.
  647. `C-x .'
  648.      Set the fill prefix (`set-fill-prefix').
  649. `M-q'
  650.      Fill a paragraph using current fill prefix (`fill-paragraph').
  651. `M-x fill-individual-paragraphs'
  652.      Fill the region, considering each change of indentation as
  653.      starting a new paragraph.
  654. `M-x fill-nonuniform-paragraphs'
  655.      Fill the region, considering only paragraph-separator lines as
  656.      starting a new paragraph.
  657.    To specify a fill prefix, move to a line that starts with the desired
  658. prefix, put point at the end of the prefix, and give the command
  659. `C-x .' (`set-fill-prefix').  That's a period after the `C-x'.  To turn
  660. off the fill prefix, specify an empty prefix: type `C-x .' with point
  661. at the beginning of a line.
  662.    When a fill prefix is in effect, the fill commands remove the fill
  663. prefix from each line before filling and insert it on each line after
  664. filling.  The fill prefix is also inserted on new lines made
  665. automatically by Auto Fill mode.  Lines that do not start with the fill
  666. prefix are considered to start paragraphs, both in `M-q' and the
  667. paragraph commands; this is just right if you are using paragraphs with
  668. hanging indentation (every line indented except the first one).  Lines
  669. which are blank or indented once the prefix is removed also separate or
  670. start paragraphs; this is what you want if you are writing
  671. multi-paragraph comments with a comment delimiter on each line.
  672.    For example, if `fill-column' is 40 and you set the fill prefix to
  673. `;; ', then `M-q' in the following text
  674.      ;; This is an
  675.      ;; example of a paragraph
  676.      ;; inside a Lisp-style comment.
  677. produces this:
  678.      ;; This is an example of a paragraph
  679.      ;; inside a Lisp-style comment.
  680.    The `C-o' command inserts the fill prefix on new lines it creates,
  681. when you use it at the beginning of a line (*note Blank Lines::.).
  682. Conversely, the command `M-^' deletes the prefix (if it occurs) after
  683. the newline that it deletes (*note Indentation::.).
  684.    You can use `M-x fill-individual-paragraphs' to set the fill prefix
  685. for each paragraph automatically.  This command divides the region into
  686. paragraphs, treating every change in the amount of indentation as the
  687. start of a new paragraph, and fills each of these paragraphs.  Thus,
  688. all the lines in one "paragraph" have the same amount of indentation.
  689. That indentation serves as the fill prefix for that paragraph.
  690.    `M-x fill-nonuniform-paragraphs' is a similar command that divides
  691. the region into paragraphs in a different way.  It considers only
  692. paragraph-separating lines (as defined by `paragraph-separate') as
  693. starting a new paragraph.  Since this means that the lines of one
  694. paragraph may have different amounts of indentation, the fill prefix
  695. used is the smallest amount of indentation of any of the lines of the
  696. paragraph.
  697.    The fill prefix is stored in the variable `fill-prefix'.  Its value
  698. is a string, or `nil' when there is no fill prefix.  This is a
  699. per-buffer variable; altering the variable affects only the current
  700. buffer, but there is a default value which you can change as well.
  701. *Note Locals::.
  702. File: emacs,  Node: Case,  Next: Text Mode,  Prev: Filling,  Up: Text
  703. Case Conversion Commands
  704. ========================
  705.    Emacs has commands for converting either a single word or any
  706. arbitrary range of text to upper case or to lower case.
  707. `M-l'
  708.      Convert following word to lower case (`downcase-word').
  709. `M-u'
  710.      Convert following word to upper case (`upcase-word').
  711. `M-c'
  712.      Capitalize the following word (`capitalize-word').
  713. `C-x C-l'
  714.      Convert region to lower case (`downcase-region').
  715. `C-x C-u'
  716.      Convert region to upper case (`upcase-region').
  717.    The word conversion commands are the most useful.  `M-l'
  718. (`downcase-word') converts the word after point to lower case, moving
  719. past it.  Thus, repeating `M-l' converts successive words.  `M-u'
  720. (`upcase-word') converts to all capitals instead, while `M-c'
  721. (`capitalize-word') puts the first letter of the word into upper case
  722. and the rest into lower case.  All these commands convert several words
  723. at once if given an argument.  They are especially convenient for
  724. converting a large amount of text from all upper case to mixed case,
  725. because you can move through the text using `M-l', `M-u' or `M-c' on
  726. each word as appropriate, occasionally using `M-f' instead to skip a
  727. word.
  728.    When given a negative argument, the word case conversion commands
  729. apply to the appropriate number of words before point, but do not move
  730. point.  This is convenient when you have just typed a word in the wrong
  731. case: you can give the case conversion command and continue typing.
  732.    If a word case conversion command is given in the middle of a word,
  733. it applies only to the part of the word which follows point.  This is
  734. just like what `M-d' (`kill-word') does.  With a negative argument,
  735. case conversion applies only to the part of the word before point.
  736.    The other case conversion commands are `C-x C-u' (`upcase-region')
  737. and `C-x C-l' (`downcase-region'), which convert everything between
  738. point and mark to the specified case.  Point and mark do not move.
  739.    The region case conversion commands `upcase-region' and
  740. `downcase-region' are normally disabled.  This means that they ask for
  741. confirmation if you try to use them.  When you confirm, you may enable
  742. the command, which means it will not ask for confirmation again.  *Note
  743. Disabling::.
  744. File: emacs,  Node: Text Mode,  Next: Outline Mode,  Prev: Case,  Up: Text
  745. Text Mode
  746. =========
  747.    When you edit files of text in a human language, it's more convenient
  748. to use Text mode rather than Fundamental mode.  Invoke `M-x text-mode'
  749. to enter Text mode.  In Text mode, TAB runs the function
  750. `tab-to-tab-stop', which allows you to use arbitrary tab stops set with
  751. `M-x edit-tab-stops' (*note Tab Stops::.).  Features concerned with
  752. comments in programs are turned off except when explicitly invoked.
  753. The syntax table is changed so that periods are not considered part of
  754. a word, while apostrophes, backspaces and underlines are.
  755.    A similar variant mode is Indented Text mode, intended for editing
  756. text in which most lines are indented.  This mode defines TAB to run
  757. `indent-relative' (*note Indentation::.), and makes Auto Fill indent
  758. the lines it creates.  The result is that normally a line made by Auto
  759. Filling, or by LFD, is indented just like the previous line.  Use `M-x
  760. indented-text-mode' to select this mode.
  761.    Entering Text mode or Indented Text mode runs the hook
  762. `text-mode-hook'.  Other major modes related to Text mode also run this
  763. hook, followed by hooks of their own; this includes Nroff mode, TeX
  764. mode, Outline mode and Mail mode.  Hook functions on `text-mode-hook'
  765. can look at the value of `major-mode' to see which of these modes is
  766. actually being entered.  *Note Hooks::.
  767. * Menu:
  768.   Two modes similar to Text mode are of use for editing text that is to
  769. be passed through a text formatter before achieving the form in which
  770. humans are to read it.
  771. * Nroff Mode::  The major mode for editing input to the formatter nroff.
  772. * TeX Mode::    The major modes for editing input to the formatter TeX.
  773.   Another similar mode is used for editing outlines.  It allows you
  774. to view the text at various levels of detail.  You can view either
  775. the outline headings alone or both headings and text; you can also
  776. hide some of the headings at lower levels from view to make the high
  777. level structure more visible.
  778. * Outline Mode::The major mode for editing outlines.
  779. File: emacs,  Node: Outline Mode,  Next: TeX Mode,  Prev: Text Mode,  Up: Text
  780. Outline Mode
  781. ============
  782.    Outline mode is a major mode much like Text mode but intended for
  783. editing outlines.  It allows you to make parts of the text temporarily
  784. invisible so that you can see just the overall structure of the
  785. outline.  Type `M-x outline-mode' to switch to Outline mode as the
  786. major mode of the current buffer.  Type `M-x outline-minor-mode' to
  787. enable Outline mode as a minor mode in the current buffer.  When
  788. Outline minor mode is enabled, the `C-c' commands of Outline mode
  789. replace those of the major mode.
  790.    When a line is invisible in outline mode, it does not appear on the
  791. screen.  The screen appears exactly as if the invisible line were
  792. deleted, except that an ellipsis (three periods in a row) appears at
  793. the end of the previous visible line (only one ellipsis no matter how
  794. many invisible lines follow).
  795.    All editing commands treat the text of the invisible line as part of
  796. the previous visible line.  For example, `C-n' moves onto the next
  797. visible line.  Killing an entire visible line, including its
  798. terminating newline, really kills all the following invisible lines
  799. along with it; yanking it all back yanks the invisible lines and they
  800. remain invisible.
  801.    Entering Outline mode runs the hook `text-mode-hook' followed by the
  802. hook `outline-mode-hook' (*note Hooks::.).
  803. * Menu:
  804. * Format: Outline Format.       What the text of an outline looks like.
  805. * Motion: Outline Motion.       Special commands for moving through
  806.                                      outlines.
  807. * Visibility: Outline Visibility.  Commands to control what is visible.
  808. File: emacs,  Node: Outline Format,  Next: Outline Motion,  Up: Outline Mode
  809. Format of Outlines
  810. ------------------
  811.    Outline mode assumes that the lines in the buffer are of two types:
  812. "heading lines" and "body lines".  A heading line represents a topic in
  813. the outline.  Heading lines start with one or more stars; the number of
  814. stars determines the depth of the heading in the outline structure.
  815. Thus, a heading line with one star is a major topic; all the heading
  816. lines with two stars between it and the next one-star heading are its
  817. subtopics; and so on.  Any line that is not a heading line is a body
  818. line.  Body lines belong with the preceding heading line.  Here is an
  819. example:
  820.      * Food
  821.      
  822.      This is the body,
  823.      which says something about the topic of food.
  824.      
  825.      ** Delicious Food
  826.      
  827.      This is the body of the second-level header.
  828.      
  829.      ** Distasteful Food
  830.      
  831.      This could have
  832.      a body too, with
  833.      several lines.
  834.      
  835.      *** Dormitory Food
  836.      
  837.      * Shelter
  838.      
  839.      A second first-level topic with its header line.
  840.    A heading line together with all following body lines is called
  841. collectively an "entry".  A heading line together with all following
  842. deeper heading lines and their body lines is called a "subtree".
  843.    You can customize the criterion for distinguishing heading lines by
  844. setting the variable `outline-regexp'.  Any line whose beginning has a
  845. match for this regexp is considered a heading line.  Matches that start
  846. within a line (not at the beginning) do not count.  The length of the
  847. matching text determines the level of the heading; longer matches make
  848. a more deeply nested level.  Thus, for example, if a text formatter has
  849. commands `@chapter', `@section' and `@subsection' to divide the
  850. document into chapters and sections, you could make those lines count
  851. as heading lines by setting `outline-regexp' to
  852. `"@chap\\|@\\(sub\\)*section"'.  Note the trick: the two words
  853. `chapter' and `section' are equally long, but by defining the regexp to
  854. match only `chap' we ensure that the length of the text matched on a
  855. chapter heading is shorter, so that Outline mode will know that
  856. sections are contained in chapters.  This works as long as no other
  857. command starts with `@chap'.
  858.    Outline mode makes a line invisible by changing the newline before it
  859. into an ASCII control-M (code 015).  Most editing commands that work on
  860. lines treat an invisible line as part of the previous line because,
  861. strictly speaking, it *is* part of that line, since there is no longer a
  862. newline in between.  When you save the file in Outline mode, control-M
  863. characters are saved as newlines, so the invisible lines become ordinary
  864. lines in the file.  But saving does not change the visibility status of
  865. a line inside Emacs.
  866. File: emacs,  Node: Outline Motion,  Next: Outline Visibility,  Prev: Outline Format,  Up: Outline Mode
  867. Outline Motion Commands
  868. -----------------------
  869.    There are some special motion commands in Outline mode that move
  870. backward and forward to heading lines.
  871. `C-c C-n'
  872.      Move point to the next visible heading line
  873.      (`outline-next-visible-heading').
  874. `C-c C-p'
  875.      Move point to the previous visible heading line
  876.      (`outline-previous-visible-heading').
  877. `C-c C-f'
  878.      Move point to the next visible heading line at the same level as
  879.      the one point is on (`outline-forward-same-level').
  880. `C-c C-b'
  881.      Move point to the previous visible heading line at the same level
  882.      (`outline-backward-same-level').
  883. `C-c C-u'
  884.      Move point up to a lower-level (more inclusive) visible heading
  885.      line (`outline-up-heading').
  886.    `C-c C-n' (`next-visible-heading') moves down to the next heading
  887. line.  `C-c C-p' (`previous-visible-heading') moves similarly backward.
  888. Both accept numeric arguments as repeat counts.  The names emphasize
  889. that invisible headings are skipped, but this is not really a special
  890. feature.  All editing commands that look for lines ignore the invisible
  891. lines automatically.
  892.    More powerful motion commands understand the level structure of
  893. headings.  `C-c C-f' (`outline-forward-same-level') and `C-c C-b'
  894. (`outline-backward-same-level') move from one heading line to another
  895. visible heading at the same depth in the outline.  `C-c C-u'
  896. (`outline-up-heading') moves backward to another heading that is less
  897. deeply nested.
  898.