home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / demacs / info / emacs.9 < prev    next >
Encoding:
Text File  |  1991-12-09  |  51.7 KB  |  1,139 lines

  1. Info file emacs, produced by texinfo-format-buffer   -*-Text-*-
  2. from file emacs.tex
  3.  
  4. This file documents the GNU Emacs editor.
  5.  
  6. Copyright (C) 1985, 1986 Richard M. Stallman.
  7.  
  8. Permission is granted to make and distribute verbatim copies of
  9. this manual provided the copyright notice and this permission notice
  10. are preserved on all copies.
  11.  
  12. Permission is granted to copy and distribute modified versions of this
  13. manual under the conditions for verbatim copying, provided also that the
  14. sections entitled "The GNU Manifesto", "Distribution" and "GNU Emacs
  15. General Public License" are included exactly as in the original, and
  16. provided that the entire resulting derived work is distributed under the
  17. terms of a permission notice identical to this one.
  18.  
  19. Permission is granted to copy and distribute translations of this manual
  20. into another language, under the above conditions for modified versions,
  21. except that the sections entitled "The GNU Manifesto", "Distribution"
  22. and "GNU Emacs General Public License" may be included in a translation
  23. approved by the author instead of in the original English.
  24.  
  25. 
  26. File: emacs  Node: Mail Format, Prev: Sending Mail, Up: Sending Mail, Next: Mail Headers
  27.  
  28. The Format of the Mail Buffer
  29. =============================
  30.  
  31.   In addition to the "text" or contents, a message has "header
  32. fields" which say who sent it, when, to whom, why, and so on.  Some header
  33. fields such as the date and sender are created automatically after the
  34. message is sent.  Others, such as the recipient names, must be specified by
  35. you in order to send the message properly.
  36.  
  37.   Mail mode provides a few commands to help you edit some header fields,
  38. and some are preinitialized in the buffer automatically at times.  You can
  39. insert or edit any header fields using ordinary editing commands.
  40.  
  41.   The line in the buffer that says
  42.  
  43.      --text follows this line--
  44.  
  45. is a special delimiter that separates the headers you have specified from
  46. the text.  Whatever follows this line is the text of the message; the
  47. headers precede it.  The delimiter line itself does not appear in the
  48. message actually sent.  The text used for the delimiter line is controlled
  49. by the variable `mail-header-separator'.
  50.  
  51. Here is an example of what the headers and text in the `*mail*' buffer
  52. might look like.
  53.  
  54.      To: rms@mc
  55.      CC: mly@mc, rg@oz
  56.      Subject: The Emacs Manual
  57.      --Text follows this line--
  58.      Please ignore this message.
  59.  
  60. 
  61. File: emacs  Node: Mail Headers, Prev: Mail Format, Up: Sending Mail, Next: Mail Mode
  62.  
  63. Mail Header Fields
  64. ==================
  65.  
  66.   There are several header fields you can use in the `*mail*' buffer.
  67. Each header field starts with a field name at the beginning of a line,
  68. terminated by a colon.  It does not matter whether you use upper or lower
  69. case in the field name.  After the colon and optional whitespace comes the
  70. contents of the field.
  71.  
  72. `To'     
  73.      This field contains the mailing addresses to which the message is
  74.      addressed.
  75.      
  76. `Subject'     
  77.      The contents of the `Subject' field should be a piece of text
  78.      that says what the message is about.  The reason `Subject' fields
  79.      are useful is that most mail-reading programs can provide a summary of
  80.      messages, listing the subject of each message but not its text.
  81.      
  82. `CC'     
  83.      This field contains additional mailing addresses to send the message
  84.      to, but whose readers should not regard the message as addressed to
  85.      them.
  86.      
  87. `BCC'     
  88.      This field contains additional mailing addresses to send the message
  89.      to, but which should not appear in the header of the message actually
  90.      sent.
  91.      
  92. `FCC'     
  93.      This field contains the name of one file (in Unix mail file format) to
  94.      which a copy of the message should be appended when the message is
  95.      sent.
  96.      
  97. `From'     
  98.      Use the `From' field to say who you are, when the account you are
  99.      using to send the mail is not your own.  The contents of the
  100.      `From' field should be a valid mailing address, since replies
  101.      will normally go there.
  102.      
  103. `Reply-To'     
  104.      Use the `Reply-to' field to direct replies to a different
  105.      address, not your own.  There is no difference between `From' and
  106.      `Reply-to' in their effect on where replies go, but they convey a
  107.      different meaning to the human who reads the message.
  108.      
  109. `In-Reply-To'     
  110.      This field contains a piece of text describing a message you are
  111.      replying to.  Some mail systems can use this information to correlate
  112.      related pieces of mail.  Normally this field is filled in by Rmail
  113.      when you are replying to a message in Rmail, and you never need to
  114.      think about it (*Note Rmail::).
  115.  
  116. The `To', `CC', `BCC' and `FCC' fields can appear
  117. any number of times, to specify many places to send the message.
  118.  
  119. The `To', `CC', and `BCC' fields can have continuation lines.  All the
  120. lines starting with whitespace, following the line on which the field
  121. starts, are considered part of the field.  For example,
  122.  
  123.      To: foo@here, this@there,
  124.        me@gnu.cambridge.mass.usa.earth.spiral3281
  125.  
  126. If you have a `~/.mailrc' file, Emacs will scan it for mail aliases
  127. the first time you try to send mail in an Emacs session.  Aliases found
  128. in the `To', `CC', and `BCC' fields will be expanded where
  129. appropriate.
  130.  
  131.   If the variable `mail-archive-file-name' is non-`nil', it should be a
  132. string naming a file; every time you start to edit a message to send,
  133. an `FCC' field will be put in for that file.  Unless you remove the
  134. `FCC' field, every message will be written into that file when it is
  135. sent.
  136.  
  137. 
  138. File: emacs  Node: Mail Mode, Prev: Mail Headers, Up: Sending Mail
  139.  
  140. Mail Mode
  141. =========
  142.  
  143.   The major mode used in the `*mail*' buffer is Mail mode, which is
  144. much like Text mode except that various special commands are provided on
  145. the `C-c' prefix.  These commands all have to do specifically with
  146. editing or sending the message.
  147.  
  148. `C-c C-s'     
  149.      Send the message, and leave the `*mail*' buffer selected
  150.      (`mail-send').
  151. `C-c C-c'     
  152.      Send the message, and select some other buffer (`mail-send-and-exit').
  153. `C-c C-f C-t'     
  154.      Move to the `To' header field, creating one if there is none
  155.      (`mail-to').
  156. `C-c C-f C-s'     
  157.      Move to the `Subject' header field, creating one if there is
  158.      none (`mail-subject').
  159. `C-c C-f C-c'     
  160.      Move to the `CC' header field, creating one if there is none
  161.      (`mail-cc').
  162. `C-c C-w'     
  163.      Insert the file `~/.signature' at the end of the message text
  164.      (`mail-signature').
  165. `C-c C-y'     
  166.      Yank the selected message from Rmail (`mail-yank-original').
  167.      This command does nothing unless your command to start sending a
  168.      message was issued with Rmail.
  169. `C-c C-q'     
  170.      Fill all paragraphs of yanked old messages, each individually
  171.      (`mail-fill-yanked-message').
  172.  
  173.   There are two ways to send the message.  `C-c C-s' (`mail-send')
  174. sends the message and marks the `*mail*' buffer unmodified, but leaves
  175. that buffer selected so that you can modify the message (perhaps with new
  176. recipients) and send it again.  `C-c C-c' (`mail-send-and-exit')
  177. sends and then deletes the window (if there is another window) or switches
  178. to another buffer.  It puts the `*mail*' buffer at the lowest priority
  179. for automatic reselection, since you are finished with using it.  This is
  180. the usual way to send the message.
  181.  
  182.   Mail mode provides some other special commands that are useful for
  183. editing the headers and text of the message before you send it.  There are
  184. three commands defined to move point to particular header fields, all based
  185. on the prefix `C-c C-f' (`C-f' is for "field").  They are
  186. `C-c C-f C-t' (`mail-to') to move to the `To' field, `C-c
  187. C-f C-s' (`mail-subject') for the `Subject' field, and `C-c
  188. C-f C-c' (`mail-cc') for the `CC' field.  These fields have
  189. special motion commands because they are the most common fields for the
  190. user to want to edit.
  191.  
  192.   `C-c C-w' (`mail-signature') adds a standard piece text at the end of the
  193. message to say more about who you are.  The text comes from the file
  194. `.signature' in your home directory.
  195.  
  196.   When mail sending is invoked from the Rmail mail reader using an Rmail
  197. command, `C-c C-y' can be used inside the `*mail*' buffer to insert the
  198. text of the message you are replying to.  Normally it indents each line of
  199. that message four spaces and eliminates most header fields.  A numeric
  200. argument specifies the number of spaces to indent.  An argument of just
  201. `C-u' says not to indent at all and not to eliminate anything.  `C-c C-y'
  202. always uses the current message from the `RMAIL' buffer, so you can insert
  203. several old messages by selecting one in `RMAIL', switching to `*mail*' and
  204. yanking it, then switching back to `RMAIL' to select another.
  205.  
  206.   After using `C-c C-y', the command `C-c C-q' (`mail-fill-yanked-message') can
  207. be used to fill the paragraphs of the yanked old message or messages.  One
  208. use of `C-c C-q' fills all such paragraphs, each one separately.
  209.  
  210.   Turning on Mail mode (which `C-x m' does automatically) calls the
  211. value of `text-mode-hook', if it is not void or `nil', and then calls
  212. the value of `mail-mode-hook' if that is not void or `nil'.
  213.  
  214. 
  215. File: emacs  Node: Rmail, Prev: Sending Mail, Up: Top, Next: Recursive Edit
  216.  
  217. Reading Mail with Rmail
  218. ***********************
  219.  
  220.   Rmail is an Emacs subsystem for reading and disposing of mail that you
  221. receive.  Rmail stores mail messages in files called Rmail files.  Reading
  222. the message in an Rmail file is done in a special major mode, Rmail mode,
  223. which redefines most letters to run commands for managing mail.  To enter
  224. Rmail, type `M-x rmail'.  This reads your primary mail file, merges
  225. new mail in from your inboxes, displays the first new message, and lets
  226. you begin reading.
  227.  
  228.   Using Rmail in the simplest fashion, you have one Rmail file `~/RMAIL'
  229. in which all of your mail is saved.  It is called your "primary mail
  230. file".  In more sophisticated usage, you can copy messages into other Rmail
  231. files and then edit those files with Rmail.
  232.  
  233.   Rmail displays only one message at a time.  It is called the "current
  234. message".  Rmail mode's special commands can do such things as move to
  235. another message, delete the message, copy the message into another file, or
  236. send a reply.
  237.  
  238.   Within the Rmail file, messages are arranged sequentially in order
  239. of receipt.  They are also assigned consecutive integers as their
  240. "message numbers".  The number of the current message is displayed
  241. in Rmail's mode line, followed by the total number of messages in the
  242. file.  You can move to a message by specifying its message number
  243. using the `j' key (*Note Rmail Motion::).
  244.  
  245.   Following the usual conventions of Emacs, changes in an Rmail file become
  246. permanent only when the file is saved.  You can do this with `s'
  247. (`rmail-save'), which also expunges deleted messages from the file
  248. first (*Note Rmail Deletion::).  To save the file without expunging, use
  249. `C-x C-s'.  Rmail saves the Rmail file spontaneously when moving new
  250. mail from an inbox file (*Note Rmail Inbox::).
  251.  
  252.   You can exit Rmail with `q' (`rmail-quit'); this expunges and saves the
  253. Rmail file and then switches to another buffer.  But there is no need to
  254. `exit' formally.  If you switch from Rmail to editing in other buffers, and
  255. never happen to switch back, you have exited.  Just make sure to save the
  256. Rmail file eventually (like any other file you have changed).  `C-x s'
  257. is a good enough way to do this (*Note Saving::).
  258.  
  259. * Menu:
  260.  
  261. * Scroll: Rmail Scrolling.   Scrolling through a message.
  262. * Motion: Rmail Motion.      Moving to another message.
  263. * Deletion: Rmail Deletion.  Deleting and expunging messages.
  264. * Inbox: Rmail Inbox.        How mail gets into the Rmail file.
  265. * Files: Rmail Files.        Using multiple Rmail files.
  266. * Output: Rmail Output.         Copying message out to files.
  267. * Labels: Rmail Labels.      Classifying messages by labeling them.
  268. * Summary: Rmail Summary.    Summaries show brief info on many messages.
  269. * Reply: Rmail Reply.        Sending replies to messages you are viewing.
  270. * Editing: Rmail Editing.    Editing message text and headers in Rmail.
  271. * Digest: Rmail Digest.      Extracting the messages from a digest message.
  272.  
  273. 
  274. File: emacs  Node: Rmail Scrolling, Prev: Rmail, Up: Rmail, Next: Rmail Motion
  275.  
  276. Scrolling Within a Message
  277. ==========================
  278.  
  279.   When Rmail displays a message that does not fit on the screen, it is
  280. necessary to scroll through it.  This could be done with `C-v', `M-v'
  281. and `M-<', but in Rmail scrolling is so frequent that it deserves to be
  282. easier to type.
  283.  
  284. `SPC'     
  285.      Scroll forward (`scroll-up').
  286. `DEL'     
  287.      Scroll backward (`scroll-down').
  288. `.'     
  289.      Scroll to start of message (`rmail-beginning-of-message').
  290.  
  291.   Since the most common thing to do while reading a message is to scroll
  292. through it by screenfuls, Rmail makes SPC and DEL synonyms of
  293. `C-v' (`scroll-up') and `M-v' (`scroll-down')
  294.  
  295.   The command `.' (`rmail-beginning-of-message') scrolls back to the
  296. beginning of the selected message.  This is not quite the same as `M-<':
  297. for one thing, it does not set the mark; for another, it resets the buffer
  298. boundaries to the current message if you have changed them.
  299.  
  300. 
  301. File: emacs  Node: Rmail Motion, Prev: Rmail Scrolling, Up: Rmail, Next: Rmail Deletion
  302.  
  303. Moving Among Messages
  304. =====================
  305.  
  306.   The most basic thing to do with a message is to read it.  The way to do
  307. this in Rmail is to make the message current.  You can make any message
  308. current given its message number using the `j' command, but the usual
  309. thing to do is to move sequentially through the file, since this is the
  310. order of receipt of messages.  When you enter Rmail, you are positioned at
  311. the first new message (new messages are those received since the previous
  312. use of Rmail), or at the last message if there are no new messages this
  313. time.  Move forward to see the other new messages; move backward to
  314. reexamine old messages.
  315.  
  316. `n'     
  317.      Move to the next nondeleted message, skipping any intervening deleted 
  318.      messages (`rmail-next-undeleted-message').
  319. `p'     
  320.      Move to the previous nondeleted message 
  321.      (`rmail-previous-undeleted-message').
  322. `M-n'     
  323.      Move to the next message, including deleted messages
  324.      (`rmail-next-message').
  325. `M-p'     
  326.      Move to the previous message, including deleted messages
  327.      (`rmail-previous-message').
  328. `j'     
  329.      Move to the first message.  With argument N, move to
  330.      message number N (`rmail-show-message').
  331. `>'     
  332.      Move to the last message (`rmail-last-message').
  333.      
  334. `M-s REGEXP RET'     
  335.      Move to the next message containing a match for REGEXP
  336.      (`rmail-search').  If REGEXP is empty, the last regexp used is
  337.      used again.
  338.      
  339. `- M-s REGEXP RET'     
  340.      Move to the previous message containing a match for REGEXP.
  341.      If REGEXP is empty, the last regexp used is used again.
  342.  
  343.   `n' and `p' are the usual way of moving among messages in Rmail.  They
  344. move through the messages sequentially, but skip over deleted messages,
  345. which is usually what you want to do.  Their command definitions are named
  346. `rmail-next-undeleted-message' and `rmail-previous-undeleted-message'.  If
  347. you do not want to skip deleted messages---for example, if you want to move
  348. to a message to undelete it---use the variants `M-n' and `M-p'
  349. (`rmail-next-message' and `rmail-previous-message').  A numeric argument to
  350. any of these commands serves as a repeat count.
  351.  
  352.   In Rmail, you can specify a numeric argument by typing the digits.
  353. It is not necessary to type `C-u' first.
  354.  
  355.   The `M-s' (`rmail-search') command is Rmail's version of search.  The
  356. usual incremental search command `C-s' works in Rmail, but it searches
  357. only within the current message.  The purpose of `M-s' is to search for
  358. another message.  It reads a regular expression (*Note Regexps::)
  359. nonincrementally, then searches starting at the beginning of the following
  360. message for a match.  The message containing the match is selected.
  361.  
  362.   To search backward in the file for another message, give `M-s' a
  363. negative argument.  In Rmail this can be done with `- M-s'.
  364.  
  365.   It is also possible to search for a message based on labels.
  366. *Note Rmail Labels::.
  367.  
  368.   To move to a message specified by absolute message number, use `j'
  369. (`rmail-show-message') with the message number as argument.  With no
  370. argument, `j' selects the first message.  `>' (`rmail-last-message') selects
  371. the last message.
  372.  
  373. 
  374. File: emacs  Node: Rmail Deletion, Prev: Rmail Motion, Up: Rmail, Next: Rmail Inbox
  375.  
  376. Deleting Messages
  377. =================
  378.  
  379.   When you no longer need to keep a message, you can "delete" it.  This
  380. flags it as ignorable, and some Rmail commands will pretend it is no longer
  381. present; but it still has its place in the Rmail file, and still has its
  382. message number.
  383.  
  384.   "Expunging" the Rmail file actually removes the deleted messages.
  385. The remaining messages are renumbered consecutively.  Expunging is the only
  386. action that changes the message number of any message, except for
  387. undigestifying (*Note Rmail Digest::).
  388.  
  389. `d'     
  390.      Delete the current message, and move to the next nondeleted message
  391.      (`rmail-delete-forward').
  392. `C-d'     
  393.      Delete the current message, and move to the previous nondeleted
  394.      message (`rmail-delete-backward').
  395. `u'     
  396.      Undelete the current message, or move back to a deleted message and
  397.      undelete it (`rmail-undelete-previous-message').
  398. `x'     
  399. `e'     
  400.      Expunge the Rmail file (`rmail-expunge').  These two
  401.      commands are synonyms.
  402.  
  403.   There are two Rmail commands for deleting messages.  Both delete the
  404. current message and select another message.  `d' (`rmail-delete-forward')
  405. moves to the following message, skipping messages already deleted, while
  406. `C-d' (`rmail-delete-backward') moves to the previous nondeleted message.
  407. If there is no nondeleted message to move to in the specified direction,
  408. the message that was just deleted remains current.
  409.  
  410.   To make all the deleted messages finally vanish from the Rmail file,
  411. type `e' (`rmail-expunge').  Until you do this, you can still "undelete"
  412. the deleted messages.
  413.  
  414.   To undelete, type
  415. `u' (`rmail-undelete-previous-message'), which is designed to cancel the
  416. effect of a `d' command (usually).  It undeletes the current message
  417. if the current message is deleted.  Otherwise it moves backward to previous
  418. messages until a deleted message is found, and undeletes that message.
  419.  
  420.   You can usually undo a `d' with a `u' because the `u' moves back to and
  421. undeletes the message that the `d' deleted.  But this does not work when
  422. the `d' skips a few already-deleted messages that follow the message being
  423. deleted; then the `u' command will undelete the last of the messages that
  424. were skipped.  There is no clean way to avoid this problem.  However, by
  425. repeating the `u' command, you can eventually get back to the message that
  426. you intended to undelete.  You can also reach that message with `M-p'
  427. commands and then type `u'.
  428.  
  429.   A deleted message has the `deleted' attribute, and as a result
  430. `deleted' appears in the mode line when the current message is
  431. deleted.  In fact, deleting or undeleting a message is nothing more than
  432. adding or removing this attribute.  *Note Rmail Labels::.
  433.  
  434. 
  435. File: emacs  Node: Rmail Inbox, Prev: Rmail Deletion, Up: Rmail, Next: Rmail Files
  436.  
  437. Rmail Files and Inboxes
  438. =======================
  439.  
  440.   Unix places incoming mail for you in a file that we call your "inbox".
  441. When you start up Rmail, it copies the new messages from your inbox into
  442. your primary mail file, an Rmail file, which also contains other messages
  443. saved from previous Rmail sessions.  It is in this file that you actually
  444. read the mail with Rmail.  This operation is called "getting new mail".
  445. It can be repeated at any time using the `g' key in Rmail.  The inbox
  446. file name is `/usr/spool/mail/USERNAME' in Berkeley Unix,
  447. `/usr/mail/USERNAME' in system V.
  448.  
  449.   There are two reason for having separate Rmail files and inboxes.
  450.  
  451.   1. The format in which Unix delivers the mail in the inbox is not
  452.      adequate for Rmail mail storage.  It has no way to record attributes
  453.      (such as `deleted') or user-specified labels; it has no way to record
  454.      old headers and reformatted headers; it has no way to record cached
  455.      summary line information.
  456.      
  457.   2. It is very cumbersome to access an inbox file without danger of losing
  458.      mail, because it is necessary to interlock with mail delivery.
  459.      Moreover, different Unix systems use different interlocking
  460.      techniques.  The strategy of moving mail out of the inbox once and for
  461.      all into a separate Rmail file avoids the need for interlocking in all
  462.      the rest of Rmail, since only Rmail operates on the Rmail file.
  463.  
  464.   When getting new mail, Rmail first copies the new mail from the inbox
  465. file to the Rmail file; then it saves the Rmail file; then it deletes the
  466. inbox file.  This way, a system crash may cause duplication of mail between
  467. the inbox and the Rmail file, but cannot lose mail.
  468.  
  469.   Copying mail from an inbox in the system's mailer directory actually puts
  470. it in an intermediate file `~/.newmail'.  This is because the
  471. interlocking is done by a C program that copies to another file.
  472. `~/.newmail' is deleted after mail merging is successful.  If there is
  473. a crash at the wrong time, this file will continue to exist and will be
  474. used as an inbox the next time you get new mail.
  475.  
  476. 
  477. File: emacs  Node: Rmail Files, Prev: Rmail Inbox, Up: Rmail, Next: Rmail Output
  478.  
  479. Multiple Mail Files
  480. ===================
  481.  
  482.   Rmail operates by default on your "primary mail file", which is named
  483. `~/RMAIL' and receives your incoming mail from your system inbox file.
  484. But you can also have other mail files and edit them with Rmail.  These
  485. files can receive mail through their own inboxes, or you can move messages
  486. into them by explicit command in Rmail (*Note Rmail Output::).
  487.  
  488. `i FILE RET'     
  489.      Read FILE into Emacs and run Rmail on it (`rmail-input').
  490.      
  491. `M-x set-rmail-inbox-list RET FILES RET'     
  492.      Specify inbox file names for current Rmail file to get mail from.
  493.      
  494. `g'     
  495.      Merge new mail from current Rmail file's inboxes
  496.      (`rmail-get-new-mail').
  497.      
  498. `C-u g FILE'     
  499.      Merge new mail from inbox file FILE.
  500.  
  501.   To run Rmail on a file other than your primary mail file, you may use the
  502. `i' (`rmail-input') command in Rmail.  This visits the file, puts it in
  503. Rmail mode, and then gets new mail from the file's inboxes if any.
  504. You can also use `M-x rmail-input' even when not in Rmail.
  505.  
  506.   The file you read with `i' does not have to be in Rmail file format.
  507. It could also be Unix mail format, or mmdf format; or it could be a mixture
  508. of all three, as long as each message belongs to one of the three formats.
  509. Rmail recognizes all three and converts all the messages to proper Rmail
  510. format before showing you the file.
  511.  
  512.   Each Rmail file can contain a list of inbox file names; you can specify
  513. this list with `M-x set-rmail-inbox-list RET FILES RET'.  The argument can
  514. contain any number of file names, separated by commas.  It can also be
  515. empty, which specifies that this file should have no inboxes.  Once a list
  516. of inboxes is specified, the Rmail file remembers it permanently until it
  517. is explicitly changed.
  518.  
  519.   If an Rmail file has inboxes, new mail is merged in from the inboxes when
  520. the Rmail file is brought into Rmail, and when the `g' (`rmail-get-new-mail')
  521. command is used.  If the Rmail file specifies no inboxes, then no new mail
  522. is merged in at these times.  A special exception is made for your primary
  523. mail file in using the standard system inbox for it if it does not specify
  524. any.
  525.  
  526.   To merge mail from a file that is not the usual inbox, give the `g'
  527. key a numeric argument, as in `C-u g'.  Then it reads a file name and
  528. merges mail from that file.  The inbox file is not deleted or changed in
  529. any way when `g' with an argument is used.  This is, therefore, a
  530. general way of merging one file of messages into another.
  531.  
  532. 
  533. File: emacs  Node: Rmail Output, Prev: Rmail Files, Up: Rmail, Next: Rmail Labels
  534.  
  535. Copying Messages Out to Files
  536. =============================
  537.  
  538. `o FILE RET'     
  539.      Append a copy of the current message to the file FILE,
  540.      writing it in Rmail file format (`rmail-output-to-rmail-file').
  541.      
  542. `C-o FILE RET'     
  543.      Append a copy of the current message to the file FILE,
  544.      writing it in Unix mail file format (`rmail-output').
  545.  
  546.   If an Rmail file has no inboxes, how does it get anything in it?  By
  547. explicit `o' commands.
  548.  
  549.   `o' (`rmail-output-to-rmail-file') appends the current message
  550. in Rmail format to the end of the specified file.  This is the best command
  551. to use to move messages between Rmail files.  If the other Rmail file is
  552. currently visited, the copying is done into the other file's Emacs buffer
  553. instead.  You should eventually save it on disk.
  554.  
  555.   The `C-o' (`rmail-output') command in Rmail appends a copy of the current
  556. message to a specified file, in Unix mail file format.  This is useful for
  557. moving messages into files to be read by other mail processors that do not
  558. understand Rmail format.
  559.  
  560.   Copying a message with `o' or `C-o' gives the original copy of the
  561. message the `filed' attribute, so that `filed' appears in the mode
  562. line when such a message is current.
  563.  
  564.   Normally you should use only `o' to output messages to other Rmail
  565. files, never `C-o'.  But it is also safe if you always use `C-o',
  566. never `o'.  When a file is visited in Rmail, the last message is
  567. checked, and if it is in Unix format, the entire file is scanned and all
  568. Unix-format messages are converted to Rmail format.  (The reason for
  569. checking the last message is that scanning the file is slow and most Rmail
  570. files have only Rmail format messages.)  If you use `C-o' consistently,
  571. the last message is sure to be in Unix format, so Rmail will convert all
  572. messages properly.
  573.  
  574.   The case where you might want to use `C-o' always, instead of `o'
  575. always, is when you or other users want to append mail to the same file
  576. from other mail processors.  Other mail processors probably do not know
  577. Rmail format but do know Unix format.
  578.  
  579.   In any case, always use `o' to add to an Rmail file that is being
  580. visited in Rmail.  Adding messages with `C-o' to the actual disk file
  581. will trigger a "simultaneous editing" warning when you ask to save the
  582. Emacs buffer, and will be lost if you do save.
  583.  
  584. 
  585. File: emacs  Node: Rmail Labels, Prev: Rmail Output, Up: Rmail, Next: Rmail Summary
  586.  
  587. Labels
  588. ======
  589.  
  590.   Each message can have various "labels" assigned to it as a means of
  591. classification.  A label has a name; different names mean different labels.
  592. Any given label is either present or absent on a particular message.  A few
  593. label names have standard meanings and are given to messages automatically
  594. by Rmail when appropriate; these special labels are called "attributes".
  595. All other labels are assigned by the user.
  596.  
  597. `a LABEL RET'     
  598.      Assign the label LABEL to the current message (`rmail-add-label').
  599. `k LABEL RET'     
  600.      Remove the label LABEL from the current message (`rmail-kill-label').
  601. `C-M-n LABELS RET'     
  602.      Move to the next message that has one of the labels LABELS
  603.      (`rmail-next-labeled-message').
  604. `C-M-p LABELS RET'     
  605.      Move to the previous message that has one of the labels LABELS
  606.      (`rmail-previous-labeled-message').
  607. `C-M-l LABELS RET'     
  608.      Make a summary of all messages containing any of the labels LABELS
  609.      (`rmail-summary-by-labels').
  610.  
  611. Specifying an empty string for one these commands means to use the last
  612. label specified for any of these commands.
  613.  
  614.   The `a' (`rmail-add-label') and `k' (`rmail-kill-label') commands allow
  615. you to assign or remove any label on the current message.  If the LABEL
  616. argument is empty, it means to assign or remove the same label most
  617. recently assigned or removed.
  618.  
  619.   Once you have given messages labels to classify them as you wish, there
  620. are two ways to use the labels: in moving and in summaries.
  621.  
  622.   The command `C-M-n LABELS RET' (`rmail-next-labeled-message') moves to
  623. the next message that has one of the labels LABELS.  LABELS is one or more
  624. label names, separated by commas.  `C-M-p'
  625. (`rmail-previous-labeled-message') is similar, but moves backwards to
  626. previous messages.  A preceding numeric argument to either one serves as a
  627. repeat count.
  628.  
  629.   The command `C-M-l LABELS RET' (`rmail-summary-by-labels') displays a
  630. summary containing only the messages that have at least one of a specified
  631. set of messages.  The argument LABELS is one or more label names, separated
  632. by commas.  *Note Rmail Summary::, for information on summaries.
  633.  
  634.   If the LABELS argument to `C-M-n', `C-M-p' or `C-M-l' is empty, it means
  635. to use the last set of labels specified for any of these commands.
  636.  
  637.   Some labels such as `deleted' and `filed' have built-in meanings and
  638. are assigned to or removed from messages automatically at appropriate
  639. times; these labels are called "attributes".  Here is a list of Rmail
  640. attributes:
  641.  
  642. `unseen'     
  643.      Means the message has never been current.  Assigned to messages when
  644.      they come from an inbox file, and removed when a message is made
  645.      current.
  646. `deleted'     
  647.      Means the message is deleted.  Assigned by deletion commands and
  648.      removed by undeletion commands (*Note Rmail Deletion::).
  649. `filed'     
  650.      Means the message has been copied to some other file.  Assigned by the
  651.      file output commands (*Note Rmail Files::).
  652. `answered'     
  653.      Means you have mailed an answer to the message.  Assigned by the `r'
  654.      command (`rmail-reply').  *Note Rmail Reply::.
  655. `forwarded'     
  656.      Means you have forwarded the message to other users.  Assigned by the
  657.      `f' command (`rmail-forward').  *Note Rmail Reply::.
  658. `edited'     
  659.      Means you have edited the text of the message within Rmail.
  660.      *Note Rmail Editing::.
  661.  
  662.   All other labels are assigned or removed only by the user, and it is up
  663. to the user to decide what they mean.
  664.  
  665. 
  666. File: emacs  Node: Rmail Summary, Prev: Rmail Labels, Up: Rmail, Next: Rmail Reply
  667.  
  668. Summaries
  669. =========
  670.  
  671.   A "summary" is a buffer containing one line per message that Rmail
  672. can make and display to give you an overview of the mail in an Rmail file.
  673. Each line shows the message number, the sender, the labels, and the
  674. subject.  When the summary buffer is selected, various commands can be used
  675. to select messages by moving in the summary buffer, or delete or undelete
  676. messages.
  677.  
  678.   A summary buffer applies to a single Rmail file only; if you are
  679. editing multiple Rmail files, they have separate summary buffers.  The
  680. summary buffer name is made by appending `-summary' to the Rmail buffer's
  681. name.  Only one summary buffer will be displayed at a time unless you make
  682. several windows and select the summary buffers by hand.
  683.  
  684. * Menu:
  685.  
  686. * Rmail Make Summary::  Making various sorts of summaries.
  687. * Rmail Summary Edit::  Manipulating messages from the summary.
  688.  
  689. 
  690. File: emacs  Node: Rmail Make Summary, Prev: Rmail Summary, Up: Rmail Summary, Next: Rmail Summary Edit
  691.  
  692. Making Summaries
  693. ----------------
  694.  
  695.   Here are the commands to create a summary for the current Rmail file.
  696. Summaries do not update automatically; to make an updated summary, you
  697. must use one of these commands again.
  698.  
  699. `h'     
  700. `C-M-h'     
  701.      Summarize all messages (`rmail-summary').
  702. `l LABELS RET'     
  703. `C-M-l LABELS RET'     
  704.      Summarize message that have one or more of the specified labels
  705.      (`rmail-summary-by-labels').
  706. `C-M-r RCPTS RET'     
  707.      Summarize messages that have one or more of the specified recipients
  708.      (`rmail-summary-by-recipients')
  709.  
  710.   The `h' or `C-M-h' (`rmail-summary') command fills the summary buffer
  711. for the current Rmail file with a summary of all the messages in the file.
  712. It then displays and selects the summary buffer in another window.
  713.  
  714.   `C-M-l LABELS RET' (`rmail-summary-by-labels') makes a partial summary
  715. mentioning only the messages that have one or more of the labels LABELS.
  716. LABELS should contain label names separated by commas.
  717.  
  718.   `C-M-r RCPTS RET' (`rmail-summary-by-recipients') makes a partial summary
  719. mentioning only the messages that have one or more of the recipients RCPTS.
  720. RCPTS should contain mailing addresses separated by commas.
  721.  
  722.   Note that there is only one summary buffer for any Rmail file; making one
  723. kind of summary discards any previously made summary.
  724.  
  725. 
  726. File: emacs  Node: Rmail Summary Edit, Prev: Rmail Make Summary, Up: Rmail Summary
  727.  
  728. Editing in Summaries
  729. --------------------
  730.  
  731.   Summary buffers are given the major mode Rmail Summary mode, which
  732. provides the following special commands:
  733.  
  734. `j'     
  735.      Select the message described by the line that point is on
  736.      (`rmail-summary-goto-msg').
  737. `C-n'     
  738.      Move to next line and select its message in Rmail
  739.      (`rmail-summary-next-all').
  740. `C-p'     
  741.      Move to previous line and select its message
  742.      (`rmail-summary-previous-all').
  743. `n'     
  744.      Move to next line, skipping lines saying `deleted', and select its
  745.      message (`rmail-summary-next-msg').
  746. `p'     
  747.      Move to previous line, skipping lines saying `deleted', and select
  748.      its message (`rmail-summary-previous-msg').
  749. `d'     
  750.      Delete the current line's message, then do like `n'
  751.      (`rmail-summary-delete-forward').
  752. `u'     
  753.      Undelete and select this message or the previous deleted message in
  754.      the summary (`rmail-summary-undelete').
  755. `SPC'     
  756.      Scroll the other window (presumably Rmail) forward
  757.      (`rmail-summary-scroll-msg-up').
  758. `DEL'     
  759.      Scroll the other window backward (`rmail-summary-scroll-msg-down').
  760. `x'     
  761.      Kill the summary window (`rmail-summary-exit').
  762. `q'     
  763.      Exit Rmail (`rmail-summary-quit').
  764.  
  765.   The keys `C-n' and `C-p' are modified in Rmail Summary mode so that in
  766. addition to moving point in the summary buffer they also cause the line's
  767. message to become current in the associated Rmail buffer.  That buffer is
  768. also made visible in another window if it is not already so.
  769.  
  770.   `n' and `p' are similar to `C-n' and `C-p', but skip lines that say
  771. `message deleted'.  They are like the `n' and `p' keys of Rmail itself.
  772. Note, however, that in a partial summary these commands move only among the
  773. message listed in the summary.
  774.  
  775.   The other Emacs cursor motion commands are not changed in Rmail Summary
  776. mode, so it is easy to get the point on a line whose message is not
  777. selected in Rmail.  This can also happen if you switch to the Rmail window
  778. and switch messages there.  To get the Rmail buffer back in sync with the
  779. summary, use the `j' (`rmail-summary-goto-msg') command, which selects
  780. in Rmail the message of the current summary line.
  781.  
  782.   Deletion and undeletion can also be done from the summary buffer.  They
  783. always work based on where point is located in the summary buffer, ignoring
  784. which message is selected in Rmail.  `d' (`rmail-summary-delete-forward')
  785. deletes the current line's message, then moves to the next line whose
  786. message is not deleted and selects that message.  The inverse of this is
  787. `u' (`rmail-summary-undelete'), which moves back (if necessary) to a line
  788. whose message is deleted, undeletes that message, and selects it in Rmail.
  789.  
  790.   When moving through messages with the summary buffer, it is convenient to
  791. be able to scroll the message while remaining in the summary window.  The
  792. commands SPC (`rmail-summary-scroll-up') and DEL
  793. (`rmail-summary-scroll-down') do this.  They scroll the message just as
  794. those same keys do when the Rmail buffer is selected.
  795.  
  796.   When you are finished using the summary, type `x' (`rmail-summary-exit')
  797. to kill the summary buffer's window.
  798.  
  799.   You can also exit Rmail while in the summary.  `q' (`rmail-summary-quit')
  800. kills the summary window, then saves the Rmail file and switches to another
  801. buffer.
  802.  
  803. 
  804. File: emacs  Node: Rmail Reply, Prev: Rmail Summary, Up: Rmail, Next: Rmail Editing
  805.  
  806. Sending Replies
  807. ===============
  808.  
  809.   Rmail has several commands that use Mail mode to send outgoing mail.
  810. *Note Sending Mail::, for information on using Mail mode.  What are
  811. documented here are the special commands of Rmail for entering Mail mode.
  812. Note that the usual keys for sending mail, `C-x m' and `C-x 4 m', are
  813. available in Rmail mode and work just as they usually do.
  814.  
  815. `m'     
  816.      Send a message (`rmail-mail').
  817. `c'     
  818.      Continue editing already started outgoing message (`rmail-continue').
  819. `r'     
  820.      Send a reply to the current Rmail message (`rmail-reply').
  821. `f'     
  822.      Forward current message to other users (`rmail-forward').
  823.  
  824.   The most common reason to send a message while in Rmail is to reply to
  825. the message you are reading.  To do this, type `r' (`rmail-reply').  This
  826. displays the `*mail*' buffer in another window, much like `C-x 4 m', but
  827. preinitializes the `Subject', `To', `CC' and `In-reply-to' header fields
  828. based on the message being replied to.  The `To' field is given the sender
  829. of that message, and the `CC' gets all the recipients of that message (but
  830. recipients that match elements of the list `rmail-dont-reply-to' are
  831. omitted; by default, this list contains your own mailing address).
  832.  
  833.   Once you have initialized the `*mail*' buffer this way, sending the
  834. mail goes as usual (*Note Sending Mail::).  You can edit the presupplied
  835. header fields if they are not right for you.
  836.  
  837.   One additional Mail mode command is available when mailing is invoked
  838. from Rmail: `C-c C-y' (`mail-yank-original') inserts into the outgoing
  839. message a copy of the current Rmail message; normally this is the message
  840. you are replying to, but you can also switch to the Rmail buffer, select a
  841. different message, switch back, and yank new current message.  Normally the
  842. yanked message is indented four spaces and has most header fields deleted
  843. from it; an argument to `C-c y' specifies the amount to indent, and `C-u
  844. C-c C-y' does not indent at all and does not delete any header fields.
  845.  
  846.   Another frequent reason to send mail in Rmail is to forward the current
  847. message to other users.  `f' (`rmail-forward') makes this easy by
  848. preinitializing the `*mail*' buffer with the current message as the text,
  849. and a subject designating a forwarded message.  All you have to do is fill
  850. in the recipients and send.
  851.  
  852.   The `m' (`rmail-mail') command is used to start editing an outgoing
  853. message that is not a reply.  It leaves the header fields empty.  Its only
  854. difference from `C-x 4 m' is that it makes the Rmail buffer accessible for
  855. `C-c y', just as `r' does.  Thus, `m' can be used to reply to or forward a
  856. message; it can do anything `r' or `f' can do.
  857.  
  858.   The `c' (`rmail-continue') command resumes editing the `*mail*' buffer,
  859. to finish editing an outgoing message you were already composing, or to
  860. alter a message you have sent.
  861.  
  862. 
  863. File: emacs  Node: Rmail Editing, Prev: Rmail Reply, Up: Rmail, Next: Rmail Digest
  864.  
  865. Editing Within a Message
  866. ========================
  867.  
  868.   Rmail mode provides a few special commands for moving within and editing
  869. the current message.  In addition, the usual Emacs commands are available
  870. (except for a few, such as `C-M-n' and `C-M-h', that are redefined by Rmail for
  871. other purposes).  However, the Rmail buffer is normally read-only, and to
  872. alter it you must use the Rmail command `w' described below.
  873.  
  874. `t'     
  875.      Toggle display of original headers (`rmail-toggle-headers').
  876. `w'     
  877.      Edit current message (`rmail-edit-current-message').
  878.  
  879.   Rmail reformats the header of each message before displaying it.
  880. Normally this involves deleting most header fields, on the grounds that
  881. they are not interesting.  The variable `rmail-ignored-headers' should
  882. contain a regexp that matches the header fields to discard in this way.
  883. The original headers are saved permanently, and to see what they look like,
  884. use the `t' (`rmail-toggle-headers') command.  This discards the reformatted
  885. headers of the current message and displays it with the original headers.
  886. Repeating `t' reformats the message again.  Selecting the message again
  887. also reformats.
  888.  
  889.   The Rmail buffer is normally read only, and most of the characters you
  890. would type to modify it (including most letters) are redefined as Rmail
  891. commands.  This is usually not a problem since it is rare to want to change
  892. the text of a message.  When you do want to do this, the way is to type
  893. `w' (`rmail-edit-current-message'), which changes from Rmail mode into
  894. Rmail Edit mode, another major mode which is nearly the same as Text mode.
  895. The mode line illustrates this change.
  896.  
  897.   In Rmail Edit mode, letters insert themselves as usual and the Rmail
  898. commands are not available.  When you are finished editing the message and
  899. are ready to go back to Rmail, type `C-c C-c', which switches back to
  900. Rmail mode.  Alternatively, you can return to Rmail mode but cancel all the
  901. editing that you have done by typing `C-c C-]'.
  902.  
  903.   Entering Rmail Edit mode calls with no arguments the value of the variable
  904. `text-mode-hook', if that value exists and is not `nil'; then it
  905. does the same with the variable `rmail-edit-mode-hook'.  It adds the
  906. attribute `edited' to the message.
  907.  
  908. 
  909. File: emacs  Node: Rmail Digest, Prev: Rmail Editing, Up: Rmail
  910.  
  911. Digest Messages
  912. ===============
  913.  
  914.   A "digest message" is a message which exists to contain and carry
  915. several other messages.  Digests are used on moderated mailing lists; all
  916. the messages that arrive for the list during a period of time such as one
  917. day are put inside a single digest which is then sent to the subscribers.
  918. Transmitting the single digest uses much less computer time than
  919. transmitting the individual messages even though the total size is the
  920. same, because the per-message overhead in network mail transmission is
  921. considerable.
  922.  
  923.   When you receive a digest message, the most convenient way to read it is
  924. to "undigestify" it: to turn it back into many individual messages.
  925. Then you can read and delete the individual messages as it suits you.
  926.  
  927.   To undigestify a message, select it and then type `M-x
  928. undigestify-rmail-message'.  This copies each submessage as a separate
  929. Rmail message and inserts them all following the digest.  The digest
  930. message itself is flagged as deleted.
  931.  
  932. 
  933. File: emacs  Node: Recursive Edit, Prev: Rmail, Up: Top, Next: Narrowing
  934.  
  935. Recursive Editing Levels
  936. ========================
  937.  
  938.   A "recursive edit" is a situation in which you are using Emacs
  939. commands to perform arbitrary editing while in the middle of another Emacs
  940. command.  For example, when you type `C-r' inside of a `query-replace',
  941. you enter a recursive edit in which you can change the current buffer.  On
  942. exiting from the recursive edit, you go back to the `query-replace'.
  943.  
  944.   "Exiting" the recursive edit means returning to the unfinished
  945. command, which continues execution.  For example, exiting the recursive
  946. edit requested by `C-r' in `query-replace' causes query replacing
  947. to resume.  Exiting is done with `C-M-c' (`exit-recursive-edit').
  948.  
  949.   You can also "abort" the recursive edit.  This is like exiting, but
  950. also quits the unfinished command immediately.  Use the command `C-]'
  951. (`abort-recursive-edit') for this.  *Note Quitting::.
  952.  
  953.   The mode line shows you when you are in a recursive edit by displaying
  954. square brackets around the parentheses that always surround the major and
  955. minor mode names.  Every window's mode line shows this, in the same way,
  956. since being in a recursive edit is true of Emacs as a whole rather than
  957. any particular buffer.
  958.  
  959.   It is possible to be in recursive edits within recursive edits.  For
  960. example, after typing `C-r' in a `query-replace', you might type a
  961. command that entered the debugger.  In such circumstances, two or more sets
  962. of square brackets appear in the mode line.  Exiting the inner recursive
  963. edit (such as, with the debugger `c' command) would resume the command
  964. where it called the debugger.  After the end of this command, you would be
  965. able to exit the first recursive edit.  Aborting also gets out of only one
  966. level of recursive edit; it returns immediately to the command level of the
  967. previous recursive edit.  So you could immediately abort that one too.
  968.  
  969.   Alternatively, the command `M-x top-level' aborts all levels of
  970. recursive edits, returning immediately to the top level command reader.
  971.  
  972.   The text being edited inside the recursive edit need not be the same text
  973. that you were editing at top level.  It depends on what the recursive edit
  974. is for.  If the command that invokes the recursive edit selects a different
  975. buffer first, that is the buffer you will edit recursively.  In any case,
  976. you can switch buffers within the recursive edit in the normal manner (as
  977. long as the buffer-switching keys have not been rebound).  You could
  978. probably do all the rest of your editing inside the recursive edit,
  979. visiting files and all.  But this could have surprising effects (such as
  980. stack overflow) from time to time.  So remember to exit or abort the
  981. recursive edit when you no longer need it.
  982.  
  983.   In general, GNU Emacs tries to avoid using recursive edits.  It is
  984. usually preferable to allow the user to switch among the possible editing
  985. modes in any order he likes.  With recursive edits, the only way to get to
  986. another state is to go "back" to the state that the recursive edit was
  987. invoked from.
  988.  
  989. 
  990. File: emacs  Node: Narrowing, Prev: Recursive Edit, Up: Top, Next: Sorting
  991.  
  992. Narrowing
  993. =========
  994.  
  995.   "Narrowing" means focusing in on some portion of the buffer, making
  996. the rest temporarily invisible and inaccessible.  Cancelling the narrowing,
  997. and making the entire buffer once again visible, is called "widening".
  998. The amount of narrowing in effect in a buffer at any time is called the
  999. buffer's "restriction".
  1000.  
  1001. `C-x n'     
  1002.      Narrow down to between point and mark (`narrow-to-region').
  1003. `C-x w'     
  1004.      Widen to make the entire buffer visible again (`widen').
  1005.  
  1006.   When you have narrowed down to a part of the buffer, that part appears to
  1007. be all there is.  You can't see the rest, you can't move into it (motion
  1008. commands won't go outside the visible part), you can't change it in any
  1009. way.  However, it is not gone, and if you save the file all the invisible
  1010. text will be saved.  In addition to sometimes making it easier to
  1011. concentrate on a single subroutine or paragraph by eliminating clutter,
  1012. narrowing can be used to restrict the range of operation of a replace
  1013. command or repeating keyboard macro.  The word `Narrow' appears in the
  1014. mode line whenever narrowing is in effect.
  1015.  
  1016.   The primary narrowing command is `C-x n' (`narrow-to-region').
  1017. It sets the current buffer's restrictions so that the text in the current
  1018. region remains visible but all text before the region or after the region
  1019. is invisible.  Point and mark do not change.
  1020.  
  1021.   Because narrowing can easily confuse users who do not understand it,
  1022. `narrow-to-region' is normally a disabled command.  Attempting to use
  1023. this command asks for confirmation and gives you the option of enabling it;
  1024. once you enable the command, confirmation will no longer be required for
  1025. it.  *Note Disabling::.
  1026.  
  1027.   The way to undo narrowing is to widen with `C-x w' (`widen').
  1028. This makes all text in the buffer accessible again.
  1029.  
  1030.   You can get information on what part of the buffer you are narrowed down
  1031. to using the `C-x =' command.  *Note Position Info::.
  1032.  
  1033. 
  1034. File: emacs  Node: Sorting, Prev: Narrowing, Up: Top, Next: Shell
  1035.  
  1036. Sorting Text
  1037. ============
  1038.  
  1039.   Emacs provides several commands for sorting text in the buffer.  All
  1040. operate on the contents of the region (the text between point and the
  1041. mark).  They divide the text of the region into many "sort records",
  1042. identify a "sort key" for each record, and then reorder the records
  1043. into the order determined by the sort keys.  The records are ordered so
  1044. that their keys are in alphabetical order, or, for numeric sorting, in
  1045. numeric order.  In alphabetic sorting, all upper case letters `A' through
  1046. `Z' come before lower case `a', in accord with the ASCII character
  1047. sequence.
  1048.  
  1049.   The various sort commands differ in how they divide the text into sort
  1050. records and in which part of each record is used as the sort key.  Most of
  1051. the commands make each line a separate sort record, but some commands use
  1052. paragraphs or pages as sort records.  Most of the sort commands use each
  1053. entire sort record as its own sort key, but some use only a portion of the
  1054. record as the sort key.
  1055.  
  1056. `M-x sort-lines'     
  1057.      Divide the region into lines, and sort by comparing the entire
  1058.      text of a line.  A prefix argument means sort into descending order.
  1059.      
  1060. `M-x sort-paragraphs'     
  1061.      Divide the region into paragraphs, and sort by comparing the entire
  1062.      text of a paragraph (except for leading blank lines).  A prefix
  1063.      argument means sort into descending order.
  1064.      
  1065. `M-x sort-pages'     
  1066.      Divide the region into pages, and sort by comparing the entire
  1067.      text of a page (except for leading blank lines).  A prefix
  1068.      argument means sort into descending order.
  1069.      
  1070. `M-x sort-fields'     
  1071.      Divide the region into lines, and sort by comparing the contents of
  1072.      one field in each line.  Fields are defined as separated by
  1073.      whitespace, so the first run of consecutive non-whitespace characters
  1074.      in a line constitutes field 1, the second such run constitutes field
  1075.      2, etc.
  1076.      
  1077.      You specify which field to sort by with a numeric argument: 1 to sort
  1078.      by field 1, etc.  A negative argument means sort into descending
  1079.      order.  Thus, minus 2 means sort by field 2 in reverse-alphabetical
  1080.      order.
  1081.      
  1082. `M-x sort-numeric-fields'     
  1083.      Like `M-x sort-fields' except the specified field is converted
  1084.      to a number for each line, and the numbers are compared.  `10'
  1085.      comes before `2' when considered as text, but after it when
  1086.      considered as a number.
  1087.      
  1088. `M-x sort-columns'     
  1089.      Like `M-x sort-fields' except that the text within each line
  1090.      used for comparison comes from a fixed range of columns.  See below
  1091.      for an explanation.
  1092.  
  1093. For example, if the buffer contains
  1094.  
  1095.      On systems where clash detection (locking of files being edited) is
  1096.      implemented, Emacs also checks the first time you modify a buffer
  1097.      whether the file has changed on disk since it was last visited or
  1098.      saved.  If it has, you are asked to confirm that you want to change
  1099.      the buffer.
  1100.  
  1101. then if you apply `M-x sort-lines' to the entire buffer you get
  1102.  
  1103.      On systems where clash detection (locking of files being edited) is
  1104.      implemented, Emacs also checks the first time you modify a buffer
  1105.      saved.  If it has, you are asked to confirm that you want to change
  1106.      the buffer.
  1107.      whether the file has changed on disk since it was last visited or
  1108.  
  1109. where the upper case `O' comes before all lower case letters.  If you apply
  1110. instead `C-u 2 M-x sort-fields' you get
  1111.  
  1112.      implemented, Emacs also checks the first time you modify a buffer
  1113.      saved.  If it has, you are asked to confirm that you want to change
  1114.      the buffer.
  1115.      On systems where clash detection (locking of files being edited) is
  1116.      whether the file has changed on disk since it was last visited or
  1117.  
  1118. where the sort keys were `Emacs', `If', `buffer', `systems' and `the'.
  1119.  
  1120.   `M-x sort-columns' requires more explanation.  You specify the
  1121. columns by putting point at one of the columns and the mark at the other
  1122. column.  Because this means you cannot put point or the mark at the
  1123. beginning of the first line to sort, this command uses an unusual
  1124. definition of `region': all of the line point is in is considered part of
  1125. the region, and so is all of the line the mark is in.
  1126.  
  1127.   For example, to sort a table by information found in columns 10 to 15,
  1128. you could put the mark on column 10 in the first line of the table, and
  1129. point on column 15 in the last line of the table, and then use this command.
  1130. Or you could put the mark on column 15 in the first line and point on
  1131. column 10 in the last line.
  1132.  
  1133.   This can be thought of as sorting the rectangle specified by point and
  1134. the mark, except that the text on each line to the left or right of the
  1135. rectangle moves along with the text inside the rectangle.
  1136. *Note Rectangles::.
  1137.  
  1138. 
  1139.