home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / emacs.i10 (.txt) < prev    next >
GNU Info File  |  1993-06-14  |  52KB  |  872 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.47 from the
  2. input file emacs.tex.
  3.    This file documents the GNU Emacs editor.
  4.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.
  5.    Permission is granted to make and distribute verbatim copies of this
  6. manual provided the copyright notice and this permission notice are
  7. preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  11. General Public License" are included exactly as in the original, and
  12. provided that the entire resulting derived work is distributed under the
  13. terms of a permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the sections entitled "The GNU Manifesto",
  17. "Distribution" and "GNU General Public License" may be included in a
  18. translation approved by the author instead of in the original English.
  19. File: emacs,  Node: Rmail Deletion,  Next: Rmail Inbox,  Prev: Rmail Motion,  Up: Rmail
  20. Deleting Messages
  21. =================
  22.    When you no longer need to keep a message, you can "delete" it.  This
  23. flags it as ignorable, and some Rmail commands will pretend it is no
  24. longer present; but it still has its place in the Rmail file, and still
  25. has its message number.
  26.    "Expunging" the Rmail file actually removes the deleted messages.
  27. The remaining messages are renumbered consecutively.  Expunging is the
  28. only action that changes the message number of any message, except for
  29. undigestifying (*note Rmail Digest::.).
  30.      Delete the current message, and move to the next nondeleted message
  31.      (`rmail-delete-forward').
  32. `C-d'
  33.      Delete the current message, and move to the previous nondeleted
  34.      message (`rmail-delete-backward').
  35.      Undelete the current message, or move back to a deleted message and
  36.      undelete it (`rmail-undelete-previous-message').
  37.      Expunge the Rmail file (`rmail-expunge').  These two commands are
  38.      synonyms.
  39.    There are two Rmail commands for deleting messages.  Both delete the
  40. current message and select another message.  `d'
  41. (`rmail-delete-forward') moves to the following message, skipping
  42. messages already deleted, while `C-d' (`rmail-delete-backward') moves
  43. to the previous nondeleted message. If there is no nondeleted message
  44. to move to in the specified direction, the message that was just
  45. deleted remains current.
  46.    To make all the deleted messages finally vanish from the Rmail file,
  47. type `e' (`rmail-expunge').  Until you do this, you can still "undelete"
  48. the deleted messages.
  49.    To undelete, type `u' (`rmail-undelete-previous-message'), which is
  50. designed to cancel the effect of a `d' command (usually).  It undeletes
  51. the current message if the current message is deleted.  Otherwise it
  52. moves backward to previous messages until a deleted message is found,
  53. and undeletes that message.
  54.    You can usually undo a `d' with a `u' because the `u' moves back to
  55. and undeletes the message that the `d' deleted.  But this does not work
  56. when the `d' skips a few already-deleted messages that follow the
  57. message being deleted; then the `u' command will undelete the last of
  58. the messages that were skipped.  There is no clean way to avoid this
  59. problem.  However, by repeating the `u' command, you can eventually get
  60. back to the message that you intended to undelete.  You can also reach
  61. that message with `M-p' commands and then type `u'.
  62.    A deleted message has the `deleted' attribute, and as a result
  63. `deleted' appears in the mode line when the current message is deleted.
  64.  In fact, deleting or undeleting a message is nothing more than adding
  65. or removing this attribute.  *Note Rmail Labels::.
  66. File: emacs,  Node: Rmail Inbox,  Next: Rmail Files,  Prev: Rmail Deletion,  Up: Rmail
  67. Rmail Files and Inboxes
  68. =======================
  69.    Unix places incoming mail for you in a file that we call your
  70. "inbox". When you start up Rmail, it copies the new messages from your
  71. inbox into your primary mail file, an Rmail file, which also contains
  72. other messages saved from previous Rmail sessions.  It is in this file
  73. that you actually read the mail with Rmail.  This operation is called
  74. "getting new mail". It can be repeated at any time using the `g' key in
  75. Rmail.  The inbox file name is `/usr/spool/mail/USERNAME' in Berkeley
  76. Unix, `/usr/mail/USERNAME' in system V.
  77.    There are two reason for having separate Rmail files and inboxes.
  78.   1. The format in which Unix delivers the mail in the inbox is not
  79.      adequate for Rmail mail storage.  It has no way to record
  80.      attributes (such as `deleted') or user-specified labels; it has no
  81.      way to record old headers and reformatted headers; it has no way
  82.      to record cached summary line information.
  83.   2. It is very cumbersome to access an inbox file without danger of
  84.      losing mail, because it is necessary to interlock with mail
  85.      delivery. Moreover, different Unix systems use different
  86.      interlocking techniques.  The strategy of moving mail out of the
  87.      inbox once and for all into a separate Rmail file avoids the need
  88.      for interlocking in all the rest of Rmail, since only Rmail
  89.      operates on the Rmail file.
  90.    When getting new mail, Rmail first copies the new mail from the inbox
  91. file to the Rmail file; then it saves the Rmail file; then it deletes
  92. the inbox file.  This way, a system crash may cause duplication of mail
  93. between the inbox and the Rmail file, but cannot lose mail.
  94.    Copying mail from an inbox in the system's mailer directory actually
  95. puts it in an intermediate file `~/.newmail'.  This is because the
  96. interlocking is done by a C program that copies to another file.
  97. `~/.newmail' is deleted after mail merging is successful.  If there is
  98. a crash at the wrong time, this file will continue to exist and will be
  99. used as an inbox the next time you get new mail.
  100. File: emacs,  Node: Rmail Files,  Next: Rmail Output,  Prev: Rmail Inbox,  Up: Rmail
  101. Multiple Mail Files
  102. ===================
  103.    Rmail operates by default on your "primary mail file", which is named
  104. `~/RMAIL' and receives your incoming mail from your system inbox file.
  105. But you can also have other mail files and edit them with Rmail.  These
  106. files can receive mail through their own inboxes, or you can move
  107. messages into them by explicit command in Rmail (*note Rmail Output::.).
  108. `i FILE RET'
  109.      Read FILE into Emacs and run Rmail on it (`rmail-input').
  110. `M-x set-rmail-inbox-list RET FILES RET'
  111.      Specify inbox file names for current Rmail file to get mail from.
  112.      Merge new mail from current Rmail file's inboxes
  113.      (`rmail-get-new-mail').
  114. `C-u g FILE'
  115.      Merge new mail from inbox file FILE.
  116.    To run Rmail on a file other than your primary mail file, you may
  117. use the `i' (`rmail-input') command in Rmail.  This visits the file,
  118. puts it in Rmail mode, and then gets new mail from the file's inboxes
  119. if any. You can also use `M-x rmail-input' even when not in Rmail.
  120.    The file you read with `i' does not have to be in Rmail file format.
  121. It could also be Unix mail format, or mmdf format; or it could be a
  122. mixture of all three, as long as each message belongs to one of the
  123. three formats. Rmail recognizes all three and converts all the messages
  124. to proper Rmail format before showing you the file.
  125.    Each Rmail file can contain a list of inbox file names; you can
  126. specify this list with `M-x set-rmail-inbox-list RET FILES RET'.  The
  127. argument can contain any number of file names, separated by commas.  It
  128. can also be empty, which specifies that this file should have no
  129. inboxes.  Once a list of inboxes is specified, the Rmail file remembers
  130. it permanently until it is explicitly changed.
  131.    If an Rmail file has inboxes, new mail is merged in from the inboxes
  132. when the Rmail file is brought into Rmail, and when the `g'
  133. (`rmail-get-new-mail') command is used.  If the Rmail file specifies no
  134. inboxes, then no new mail is merged in at these times.  A special
  135. exception is made for your primary mail file in using the standard
  136. system inbox for it if it does not specify any.
  137.    To merge mail from a file that is not the usual inbox, give the `g'
  138. key a numeric argument, as in `C-u g'.  Then it reads a file name and
  139. merges mail from that file.  The inbox file is not deleted or changed in
  140. any way when `g' with an argument is used.  This is, therefore, a
  141. general way of merging one file of messages into another.
  142. File: emacs,  Node: Rmail Output,  Next: Rmail Labels,  Prev: Rmail Files,  Up: Rmail
  143. Copying Messages Out to Files
  144. =============================
  145. `o FILE RET'
  146.      Append a copy of the current message to the file FILE, writing it
  147.      in Rmail file format (`rmail-output-to-rmail-file').
  148. `C-o FILE RET'
  149.      Append a copy of the current message to the file FILE, writing it
  150.      in Unix mail file format (`rmail-output').
  151.    If an Rmail file has no inboxes, how does it get anything in it?  By
  152. explicit `o' commands.
  153.    `o' (`rmail-output-to-rmail-file') appends the current message in
  154. Rmail format to the end of the specified file.  This is the best command
  155. to use to move messages between Rmail files.  If the other Rmail file is
  156. currently visited, the copying is done into the other file's Emacs
  157. buffer instead.  You should eventually save it on disk.
  158.    The `C-o' (`rmail-output') command in Rmail appends a copy of the
  159. current message to a specified file, in Unix mail file format.  This is
  160. useful for moving messages into files to be read by other mail
  161. processors that do not understand Rmail format.
  162.    Copying a message with `o' or `C-o' gives the original copy of the
  163. message the `filed' attribute, so that `filed' appears in the mode line
  164. when such a message is current.
  165.    Normally you should use only `o' to output messages to other Rmail
  166. files, never `C-o'.  But it is also safe if you always use `C-o', never
  167. `o'.  When a file is visited in Rmail, the last message is checked, and
  168. if it is in Unix format, the entire file is scanned and all Unix-format
  169. messages are converted to Rmail format.  (The reason for checking the
  170. last message is that scanning the file is slow and most Rmail files
  171. have only Rmail format messages.)  If you use `C-o' consistently, the
  172. last message is sure to be in Unix format, so Rmail will convert all
  173. messages properly.
  174.    The case where you might want to use `C-o' always, instead of `o'
  175. always, is when you or other users want to append mail to the same file
  176. from other mail processors.  Other mail processors probably do not know
  177. Rmail format but do know Unix format.
  178.    In any case, always use `o' to add to an Rmail file that is being
  179. visited in Rmail.  Adding messages with `C-o' to the actual disk file
  180. will trigger a "simultaneous editing" warning when you ask to save the
  181. Emacs buffer, and will be lost if you do save.
  182. File: emacs,  Node: Rmail Labels,  Next: Rmail Summary,  Prev: Rmail Output,  Up: Rmail
  183. Labels
  184. ======
  185.    Each message can have various "labels" assigned to it as a means of
  186. classification.  A label has a name; different names mean different
  187. labels. Any given label is either present or absent on a particular
  188. message.  A few label names have standard meanings and are given to
  189. messages automatically by Rmail when appropriate; these special labels
  190. are called "attributes". All other labels are assigned by the user.
  191. `a LABEL RET'
  192.      Assign the label LABEL to the current message (`rmail-add-label').
  193. `k LABEL RET'
  194.      Remove the label LABEL from the current message
  195.      (`rmail-kill-label').
  196. `C-M-n LABELS RET'
  197.      Move to the next message that has one of the labels LABELS
  198.      (`rmail-next-labeled-message').
  199. `C-M-p LABELS RET'
  200.      Move to the previous message that has one of the labels LABELS
  201.      (`rmail-previous-labeled-message').
  202. `C-M-l LABELS RET'
  203.      Make a summary of all messages containing any of the labels LABELS
  204.      (`rmail-summary-by-labels').
  205. Specifying an empty string for one these commands means to use the last
  206. label specified for any of these commands.
  207.    The `a' (`rmail-add-label') and `k' (`rmail-kill-label') commands
  208. allow you to assign or remove any label on the current message.  If the
  209. LABEL argument is empty, it means to assign or remove the same label
  210. most recently assigned or removed.
  211.    Once you have given messages labels to classify them as you wish,
  212. there are two ways to use the labels: in moving and in summaries.
  213.    The command `C-M-n LABELS RET' (`rmail-next-labeled-message') moves
  214. to the next message that has one of the labels LABELS.  LABELS is one
  215. or more label names, separated by commas.  `C-M-p'
  216. (`rmail-previous-labeled-message') is similar, but moves backwards to
  217. previous messages.  A preceding numeric argument to either one serves
  218. as a repeat count.
  219.    The command `C-M-l LABELS RET' (`rmail-summary-by-labels') displays
  220. a summary containing only the messages that have at least one of a
  221. specified set of messages.  The argument LABELS is one or more label
  222. names, separated by commas. *Note Rmail Summary::, for information on
  223. summaries.
  224.    If the LABELS argument to `C-M-n', `C-M-p' or `C-M-l' is empty, it
  225. means to use the last set of labels specified for any of these commands.
  226.    Some labels such as `deleted' and `filed' have built-in meanings and
  227. are assigned to or removed from messages automatically at appropriate
  228. times; these labels are called "attributes".  Here is a list of Rmail
  229. attributes:
  230. `unseen'
  231.      Means the message has never been current.  Assigned to messages
  232.      when they come from an inbox file, and removed when a message is
  233.      made current.
  234. `deleted'
  235.      Means the message is deleted.  Assigned by deletion commands and
  236.      removed by undeletion commands (*note Rmail Deletion::.).
  237. `filed'
  238.      Means the message has been copied to some other file.  Assigned by
  239.      the file output commands (*note Rmail Files::.).
  240. `answered'
  241.      Means you have mailed an answer to the message.  Assigned by the
  242.      `r' command (`rmail-reply').  *Note Rmail Reply::.
  243. `forwarded'
  244.      Means you have forwarded the message to other users.  Assigned by
  245.      the `f' command (`rmail-forward').  *Note Rmail Reply::.
  246. `edited'
  247.      Means you have edited the text of the message within Rmail. *Note
  248.      Rmail Editing::.
  249.    All other labels are assigned or removed only by the user, and it is
  250. up to the user to decide what they mean.
  251. File: emacs,  Node: Rmail Summary,  Next: Rmail Reply,  Prev: Rmail Labels,  Up: Rmail
  252. Summaries
  253. =========
  254.    A "summary" is a buffer containing one line per message that Rmail
  255. can make and display to give you an overview of the mail in an Rmail
  256. file. Each line shows the message number, the sender, the labels, and
  257. the subject.  When the summary buffer is selected, various commands can
  258. be used to select messages by moving in the summary buffer, or delete
  259. or undelete messages.
  260.    A summary buffer applies to a single Rmail file only; if you are
  261. editing multiple Rmail files, they have separate summary buffers.  The
  262. summary buffer name is made by appending `-summary' to the Rmail
  263. buffer's name.  Only one summary buffer will be displayed at a time
  264. unless you make several windows and select the summary buffers by hand.
  265. * Menu:
  266. * Rmail Make Summary::  Making various sorts of summaries.
  267. * Rmail Summary Edit::  Manipulating messages from the summary.
  268. File: emacs,  Node: Rmail Make Summary,  Next: Rmail Summary Edit,  Prev: Rmail Summary,  Up: Rmail Summary
  269. Making Summaries
  270. ----------------
  271.    Here are the commands to create a summary for the current Rmail file.
  272. Summaries do not update automatically; to make an updated summary, you
  273. must use one of these commands again.
  274. `C-M-h'
  275.      Summarize all messages (`rmail-summary').
  276. `l LABELS RET'
  277. `C-M-l LABELS RET'
  278.      Summarize message that have one or more of the specified labels
  279.      (`rmail-summary-by-labels').
  280. `C-M-r RCPTS RET'
  281.      Summarize messages that have one or more of the specified
  282.      recipients (`rmail-summary-by-recipients')
  283.    The `h' or `C-M-h' (`rmail-summary') command fills the summary buffer
  284. for the current Rmail file with a summary of all the messages in the
  285. file. It then displays and selects the summary buffer in another window.
  286.    `C-M-l LABELS RET' (`rmail-summary-by-labels') makes a partial
  287. summary mentioning only the messages that have one or more of the
  288. labels LABELS.  LABELS should contain label names separated by commas.
  289.    `C-M-r RCPTS RET' (`rmail-summary-by-recipients') makes a partial
  290. summary mentioning only the messages that have one or more of the
  291. recipients RCPTS.  RCPTS should contain mailing addresses separated by
  292. commas.
  293.    Note that there is only one summary buffer for any Rmail file;
  294. making one kind of summary discards any previously made summary.
  295. File: emacs,  Node: Rmail Summary Edit,  Prev: Rmail Make Summary,  Up: Rmail Summary
  296. Editing in Summaries
  297. --------------------
  298.    Summary buffers are given the major mode Rmail Summary mode, which
  299. provides the following special commands:
  300.      Select the message described by the line that point is on
  301.      (`rmail-summary-goto-msg').
  302. `C-n'
  303.      Move to next line and select its message in Rmail
  304.      (`rmail-summary-next-all').
  305. `C-p'
  306.      Move to previous line and select its message
  307.      (`rmail-summary-previous-all').
  308.      Move to next line, skipping lines saying `deleted', and select its
  309.      message (`rmail-summary-next-msg').
  310.      Move to previous line, skipping lines saying `deleted', and select
  311.      its message (`rmail-summary-previous-msg').
  312.      Delete the current line's message, then do like `n'
  313.      (`rmail-summary-delete-forward').
  314.      Undelete and select this message or the previous deleted message in
  315.      the summary (`rmail-summary-undelete').
  316. `SPC'
  317.      Scroll the other window (presumably Rmail) forward
  318.      (`rmail-summary-scroll-msg-up').
  319. `DEL'
  320.      Scroll the other window backward (`rmail-summary-scroll-msg-down').
  321.      Kill the summary window (`rmail-summary-exit').
  322.      Exit Rmail (`rmail-summary-quit').
  323.    The keys `C-n' and `C-p' are modified in Rmail Summary mode so that
  324. in addition to moving point in the summary buffer they also cause the
  325. line's message to become current in the associated Rmail buffer.  That
  326. buffer is also made visible in another window if it is not already so.
  327.    `n' and `p' are similar to `C-n' and `C-p', but skip lines that say
  328. `message deleted'.  They are like the `n' and `p' keys of Rmail itself.
  329.  Note, however, that in a partial summary these commands move only
  330. among the message listed in the summary.
  331.    The other Emacs cursor motion commands are not changed in Rmail
  332. Summary mode, so it is easy to get the point on a line whose message is
  333. not selected in Rmail.  This can also happen if you switch to the Rmail
  334. window and switch messages there.  To get the Rmail buffer back in sync
  335. with the summary, use the `j' (`rmail-summary-goto-msg') command, which
  336. selects in Rmail the message of the current summary line.
  337.    Deletion and undeletion can also be done from the summary buffer. 
  338. They always work based on where point is located in the summary buffer,
  339. ignoring which message is selected in Rmail.  `d'
  340. (`rmail-summary-delete-forward') deletes the current line's message,
  341. then moves to the next line whose message is not deleted and selects
  342. that message.  The inverse of this is `u' (`rmail-summary-undelete'),
  343. which moves back (if necessary) to a line whose message is deleted,
  344. undeletes that message, and selects it in Rmail.
  345.    When moving through messages with the summary buffer, it is
  346. convenient to be able to scroll the message while remaining in the
  347. summary window. The commands SPC (`rmail-summary-scroll-msg-up') and DEL
  348. (`rmail-summary-scroll-msg-down') do this.  They scroll the message just
  349. as those same keys do when the Rmail buffer is selected.
  350.    When you are finished using the summary, type `x'
  351. (`rmail-summary-exit') to kill the summary buffer's window.
  352.    You can also exit Rmail while in the summary.  `q'
  353. (`rmail-summary-quit') kills the summary window, then saves the Rmail
  354. file and switches to another buffer.
  355. File: emacs,  Node: Rmail Reply,  Next: Rmail Editing,  Prev: Rmail Summary,  Up: Rmail
  356. Sending Replies
  357. ===============
  358.    Rmail has several commands that use Mail mode to send outgoing mail.
  359. *Note Sending Mail::, for information on using Mail mode.  What are
  360. documented here are the special commands of Rmail for entering Mail
  361. mode. Note that the usual keys for sending mail, `C-x m' and `C-x 4 m',
  362. are available in Rmail mode and work just as they usually do.
  363.      Send a message (`rmail-mail').
  364.      Continue editing already started outgoing message
  365.      (`rmail-continue').
  366.      Send a reply to the current Rmail message (`rmail-reply').
  367.      Forward current message to other users (`rmail-forward').
  368.    The most common reason to send a message while in Rmail is to reply
  369. to the message you are reading.  To do this, type `r' (`rmail-reply'). 
  370. This displays the `*mail*' buffer in another window, much like `C-x 4
  371. m', but preinitializes the `Subject', `To', `CC' and `In-reply-to'
  372. header fields based on the message being replied to.  The `To' field is
  373. given the sender of that message, and the `CC' gets all the recipients
  374. of that message (but recipients that match elements of the list
  375. `rmail-dont-reply-to' are omitted; by default, this list contains your
  376. own mailing address).
  377.    Once you have initialized the `*mail*' buffer this way, sending the
  378. mail goes as usual (*note Sending Mail::.).  You can edit the
  379. presupplied header fields if they are not right for you.
  380.    One additional Mail mode command is available when mailing is invoked
  381. from Rmail: `C-c C-y' (`mail-yank-original') inserts into the outgoing
  382. message a copy of the current Rmail message; normally this is the
  383. message you are replying to, but you can also switch to the Rmail
  384. buffer, select a different message, switch back, and yank new current
  385. message.  Normally the yanked message is indented four spaces and has
  386. most header fields deleted from it; an argument to `C-c C-y' specifies
  387. the amount to indent, and `C-u C-c C-y' does not indent at all and does
  388. not delete any header fields.
  389.    Another frequent reason to send mail in Rmail is to forward the
  390. current message to other users.  `f' (`rmail-forward') makes this easy
  391. by preinitializing the `*mail*' buffer with the current message as the
  392. text, and a subject designating a forwarded message.  All you have to
  393. do is fill in the recipients and send.
  394.    The `m' (`rmail-mail') command is used to start editing an outgoing
  395. message that is not a reply.  It leaves the header fields empty. Its
  396. only difference from `C-x 4 m' is that it makes the Rmail buffer
  397. accessible for `C-c y', just as `r' does.  Thus, `m' can be used to
  398. reply to or forward a message; it can do anything `r' or `f' can do.
  399.    The `c' (`rmail-continue') command resumes editing the `*mail*'
  400. buffer, to finish editing an outgoing message you were already
  401. composing, or to alter a message you have sent.
  402. File: emacs,  Node: Rmail Editing,  Next: Rmail Digest,  Prev: Rmail Reply,  Up: Rmail
  403. Editing Within a Message
  404. ========================
  405.    Rmail mode provides a few special commands for moving within and
  406. editing the current message.  In addition, the usual Emacs commands are
  407. available (except for a few, such as `C-M-n' and `C-M-h', that are
  408. redefined by Rmail for other purposes).  However, the Rmail buffer is
  409. normally read-only, and to alter it you must use the Rmail command `w'
  410. described below.
  411.      Toggle display of original headers (`rmail-toggle-headers').
  412.      Edit current message (`rmail-edit-current-message').
  413.    Rmail reformats the header of each message before displaying it.
  414. Normally this involves deleting most header fields, on the grounds that
  415. they are not interesting.  The variable `rmail-ignored-headers' should
  416. contain a regexp that matches the header fields to discard in this way.
  417. The original headers are saved permanently, and to see what they look
  418. like, use the `t' (`rmail-toggle-headers') command.  This discards the
  419. reformatted headers of the current message and displays it with the
  420. original headers. Repeating `t' reformats the message again.  Selecting
  421. the message again also reformats.
  422.    The Rmail buffer is normally read only, and most of the characters
  423. you would type to modify it (including most letters) are redefined as
  424. Rmail commands.  This is usually not a problem since it is rare to want
  425. to change the text of a message.  When you do want to do this, the way
  426. is to type `w' (`rmail-edit-current-message'), which changes from Rmail
  427. mode into Rmail Edit mode, another major mode which is nearly the same
  428. as Text mode. The mode line illustrates this change.
  429.    In Rmail Edit mode, letters insert themselves as usual and the Rmail
  430. commands are not available.  When you are finished editing the message
  431. and are ready to go back to Rmail, type `C-c C-c', which switches back
  432. to Rmail mode.  Alternatively, you can return to Rmail mode but cancel
  433. all the editing that you have done by typing `C-c C-]'.
  434.    Entering Rmail Edit mode calls with no arguments the value of the
  435. variable `text-mode-hook', if that value exists and is not `nil'; then
  436. it does the same with the variable `rmail-edit-mode-hook'.  It adds the
  437. attribute `edited' to the message.
  438. File: emacs,  Node: Rmail Digest,  Prev: Rmail Editing,  Up: Rmail
  439. Digest Messages
  440. ===============
  441.    A "digest message" is a message which exists to contain and carry
  442. several other messages.  Digests are used on moderated mailing lists;
  443. all the messages that arrive for the list during a period of time such
  444. as one day are put inside a single digest which is then sent to the
  445. subscribers. Transmitting the single digest uses much less computer
  446. time than transmitting the individual messages even though the total
  447. size is the same, because the per-message overhead in network mail
  448. transmission is considerable.
  449.    When you receive a digest message, the most convenient way to read
  450. it is to "undigestify" it: to turn it back into many individual
  451. messages. Then you can read and delete the individual messages as it
  452. suits you.
  453.    To undigestify a message, select it and then type `M-x
  454. undigestify-rmail-message'.  This copies each submessage as a separate
  455. Rmail message and inserts them all following the digest.  The digest
  456. message itself is flagged as deleted.
  457. File: emacs,  Node: Recursive Edit,  Next: Narrowing,  Prev: Rmail,  Up: Top
  458. Recursive Editing Levels
  459. ========================
  460.    A "recursive edit" is a situation in which you are using Emacs
  461. commands to perform arbitrary editing while in the middle of another
  462. Emacs command.  For example, when you type `C-r' inside of a
  463. `query-replace', you enter a recursive edit in which you can change the
  464. current buffer.  On exiting from the recursive edit, you go back to the
  465. `query-replace'.
  466.    "Exiting" the recursive edit means returning to the unfinished
  467. command, which continues execution.  For example, exiting the recursive
  468. edit requested by `C-r' in `query-replace' causes query replacing to
  469. resume.  Exiting is done with `C-M-c' (`exit-recursive-edit').
  470.    You can also "abort" the recursive edit.  This is like exiting, but
  471. also quits the unfinished command immediately.  Use the command `C-]'
  472. (`abort-recursive-edit') for this.  *Note Quitting::.
  473.    The mode line shows you when you are in a recursive edit by
  474. displaying square brackets around the parentheses that always surround
  475. the major and minor mode names.  Every window's mode line shows this,
  476. in the same way, since being in a recursive edit is true of Emacs as a
  477. whole rather than any particular buffer.
  478.    It is possible to be in recursive edits within recursive edits.  For
  479. example, after typing `C-r' in a `query-replace', you might type a
  480. command that entered the debugger.  In such circumstances, two or more
  481. sets of square brackets appear in the mode line.  Exiting the inner
  482. recursive edit (such as, with the debugger `c' command) would resume
  483. the command where it called the debugger.  After the end of this
  484. command, you would be able to exit the first recursive edit.  Aborting
  485. also gets out of only one level of recursive edit; it returns
  486. immediately to the command level of the previous recursive edit.  So
  487. you could immediately abort that one too.
  488.    Alternatively, the command `M-x top-level' aborts all levels of
  489. recursive edits, returning immediately to the top level command reader.
  490.    The text being edited inside the recursive edit need not be the same
  491. text that you were editing at top level.  It depends on what the
  492. recursive edit is for.  If the command that invokes the recursive edit
  493. selects a different buffer first, that is the buffer you will edit
  494. recursively.  In any case, you can switch buffers within the recursive
  495. edit in the normal manner (as long as the buffer-switching keys have
  496. not been rebound).  You could probably do all the rest of your editing
  497. inside the recursive edit, visiting files and all.  But this could have
  498. surprising effects (such as stack overflow) from time to time.  So
  499. remember to exit or abort the recursive edit when you no longer need it.
  500.    In general, GNU Emacs tries to avoid using recursive edits.  It is
  501. usually preferable to allow the user to switch among the possible
  502. editing modes in any order he likes.  With recursive edits, the only
  503. way to get to another state is to go "back" to the state that the
  504. recursive edit was invoked from.
  505. File: emacs,  Node: Narrowing,  Next: Sorting,  Prev: Recursive Edit,  Up: Top
  506. Narrowing
  507. =========
  508.    "Narrowing" means focusing in on some portion of the buffer, making
  509. the rest temporarily invisible and inaccessible.  Cancelling the
  510. narrowing, and making the entire buffer once again visible, is called
  511. "widening". The amount of narrowing in effect in a buffer at any time
  512. is called the buffer's "restriction".
  513. `C-x n'
  514.      Narrow down to between point and mark (`narrow-to-region').
  515. `C-x w'
  516.      Widen to make the entire buffer visible again (`widen').
  517.    When you have narrowed down to a part of the buffer, that part
  518. appears to be all there is.  You can't see the rest, you can't move
  519. into it (motion commands won't go outside the visible part), you can't
  520. change it in any way.  However, it is not gone, and if you save the
  521. file all the invisible text will be saved.  In addition to sometimes
  522. making it easier to concentrate on a single subroutine or paragraph by
  523. eliminating clutter, narrowing can be used to restrict the range of
  524. operation of a replace command or repeating keyboard macro.  The word
  525. `Narrow' appears in the mode line whenever narrowing is in effect.
  526.    The primary narrowing command is `C-x n' (`narrow-to-region'). It
  527. sets the current buffer's restrictions so that the text in the current
  528. region remains visible but all text before the region or after the
  529. region is invisible.  Point and mark do not change.
  530.    Because narrowing can easily confuse users who do not understand it,
  531. `narrow-to-region' is normally a disabled command.  Attempting to use
  532. this command asks for confirmation and gives you the option of enabling
  533. it; once you enable the command, confirmation will no longer be
  534. required for it.  *Note Disabling::.
  535.    The way to undo narrowing is to widen with `C-x w' (`widen'). This
  536. makes all text in the buffer accessible again.
  537.    You can get information on what part of the buffer you are narrowed
  538. down to using the `C-x =' command.  *Note Position Info::.
  539. File: emacs,  Node: Sorting,  Next: Shell,  Prev: Narrowing,  Up: Top
  540. Sorting Text
  541. ============
  542.    Emacs provides several commands for sorting text in the buffer.  All
  543. operate on the contents of the region (the text between point and the
  544. mark).  They divide the text of the region into many "sort records",
  545. identify a "sort key" for each record, and then reorder the records
  546. into the order determined by the sort keys.  The records are ordered so
  547. that their keys are in alphabetical order, or, for numeric sorting, in
  548. numeric order.  In alphabetic sorting, all upper case letters `A'
  549. through `Z' come before lower case `a', in accord with the ASCII
  550. character sequence.
  551.    The various sort commands differ in how they divide the text into
  552. sort records and in which part of each record is used as the sort key. 
  553. Most of the commands make each line a separate sort record, but some
  554. commands use paragraphs or pages as sort records.  Most of the sort
  555. commands use each entire sort record as its own sort key, but some use
  556. only a portion of the record as the sort key.
  557. `M-x sort-lines'
  558.      Divide the region into lines, and sort by comparing the entire
  559.      text of a line.  A prefix argument means sort into descending
  560.      order.
  561. `M-x sort-paragraphs'
  562.      Divide the region into paragraphs, and sort by comparing the entire
  563.      text of a paragraph (except for leading blank lines).  A prefix
  564.      argument means sort into descending order.
  565. `M-x sort-pages'
  566.      Divide the region into pages, and sort by comparing the entire
  567.      text of a page (except for leading blank lines).  A prefix
  568.      argument means sort into descending order.
  569. `M-x sort-fields'
  570.      Divide the region into lines, and sort by comparing the contents of
  571.      one field in each line.  Fields are defined as separated by
  572.      whitespace, so the first run of consecutive non-whitespace
  573.      characters in a line constitutes field 1, the second such run
  574.      constitutes field 2, etc.
  575.      You specify which field to sort by with a numeric argument: 1 to
  576.      sort by field 1, etc.  A negative argument means sort into
  577.      descending order.  Thus, minus 2 means sort by field 2 in
  578.      reverse-alphabetical order.
  579. `M-x sort-numeric-fields'
  580.      Like `M-x sort-fields' except the specified field is converted to
  581.      a number for each line, and the numbers are compared.  `10' comes
  582.      before `2' when considered as text, but after it when considered
  583.      as a number.
  584. `M-x sort-columns'
  585.      Like `M-x sort-fields' except that the text within each line used
  586.      for comparison comes from a fixed range of columns.  See below for
  587.      an explanation.
  588.    For example, if the buffer contains
  589.      On systems where clash detection (locking of files being edited) is
  590.      implemented, Emacs also checks the first time you modify a buffer
  591.      whether the file has changed on disk since it was last visited or
  592.      saved.  If it has, you are asked to confirm that you want to change
  593.      the buffer.
  594. then if you apply `M-x sort-lines' to the entire buffer you get
  595.      On systems where clash detection (locking of files being edited) is
  596.      implemented, Emacs also checks the first time you modify a buffer
  597.      saved.  If it has, you are asked to confirm that you want to change
  598.      the buffer.
  599.      whether the file has changed on disk since it was last visited or
  600. where the upper case `O' comes before all lower case letters.  If you
  601. apply instead `C-u 2 M-x sort-fields' you get
  602.      implemented, Emacs also checks the first time you modify a buffer
  603.      saved.  If it has, you are asked to confirm that you want to change
  604.      the buffer.
  605.      On systems where clash detection (locking of files being edited) is
  606.      whether the file has changed on disk since it was last visited or
  607. where the sort keys were `Emacs', `If', `buffer', `systems' and `the'.
  608.    `M-x sort-columns' requires more explanation.  You specify the
  609. columns by putting point at one of the columns and the mark at the other
  610. column.  Because this means you cannot put point or the mark at the
  611. beginning of the first line to sort, this command uses an unusual
  612. definition of `region': all of the line point is in is considered part
  613. of the region, and so is all of the line the mark is in.
  614.    For example, to sort a table by information found in columns 10 to
  615. 15, you could put the mark on column 10 in the first line of the table,
  616. and point on column 15 in the last line of the table, and then use this
  617. command. Or you could put the mark on column 15 in the first line and
  618. point on column 10 in the last line.
  619.    This can be thought of as sorting the rectangle specified by point
  620. and the mark, except that the text on each line to the left or right of
  621. the rectangle moves along with the text inside the rectangle. *Note
  622. Rectangles::.
  623. File: emacs,  Node: Shell,  Next: Hardcopy,  Prev: Sorting,  Up: Top
  624. Running Shell Commands from Emacs
  625. =================================
  626.    Emacs has commands for passing single command lines to inferior shell
  627. processes; it can also run a shell interactively with input and output
  628. to an Emacs buffer `*shell*'.
  629. `M-!'
  630.      Run a specified shell command line and display the output
  631.      (`shell-command').
  632. `M-|'
  633.      Run a specified shell command line with region contents as input;
  634.      optionally replace the region with the output
  635.      (`shell-command-on-region').
  636. `M-x shell'
  637.      Run a subshell with input and output through an Emacs buffer. You
  638.      can then give commands interactively.
  639. * Menu:
  640. * Single Shell::         How to run one shell command and return.
  641. * Interactive Shell::    Permanent shell taking input via Emacs.
  642. * Shell Mode::           Special Emacs commands used with permanent shell.
  643. File: emacs,  Node: Single Shell,  Next: Interactive Shell,  Prev: Shell,  Up: Shell
  644. Single Shell Commands
  645. ---------------------
  646.    `M-!' (`shell-command') reads a line of text using the minibuffer
  647. and creates an inferior shell to execute the line as a command.
  648. Standard input from the command comes from the null device.  If the
  649. shell command produces any output, the output goes into an Emacs buffer
  650. named `*Shell Command Output*', which is displayed in another window
  651. but not selected.  A numeric argument, as in `M-1 M-!', directs this
  652. command to insert any output into the current buffer.  In that case,
  653. point is left before the output and the mark is set after the output.
  654.    `M-|' (`shell-command-on-region') is like `M-!' but passes the
  655. contents of the region as input to the shell command, instead of no
  656. input.  If a numeric argument is used, meaning insert output in the
  657. current buffer, then the old region is deleted first and the output
  658. replaces it as the contents of the region.
  659.    Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
  660. use.  This variable is initialized based on your `SHELL' environment
  661. variable when Emacs is started.  If the file name does not specify a
  662. directory, the directories in the list `exec-path' are searched; this
  663. list is initialized based on the environment variable `PATH' when Emacs
  664. is started.  Your `.emacs' file can override either or both of these
  665. default initializations.
  666.    With `M-!' and `M-|', Emacs has to wait until the shell command
  667. completes.  You can quit with `C-g'; that terminates the shell command.
  668. File: emacs,  Node: Interactive Shell,  Next: Shell Mode,  Prev: Single Shell,  Up: Shell
  669. Interactive Inferior Shell
  670. --------------------------
  671.    To run a subshell interactively, putting its typescript in an Emacs
  672. buffer, use `M-x shell'.  This creates (or reuses) a buffer named
  673. `*shell*' and runs a subshell with input coming from and output going
  674. to that buffer.  That is to say, any "terminal output" from the subshell
  675. will go into the buffer, advancing point, and any "terminal input" for
  676. the subshell comes from text in the buffer.  To give input to the
  677. subshell, go to the end of the buffer and type the input, terminated by
  678.    Emacs does not wait for the subshell to do anything.  You can switch
  679. windows or buffers and edit them while the shell is waiting, or while
  680. it is running a command.  Output from the subshell waits until Emacs
  681. has time to process it; this happens whenever Emacs is waiting for
  682. keyboard input or for time to elapse.
  683.    If you would like multiple subshells, change the name of buffer
  684. `*shell*' to something different by using `M-x rename-buffer'.  The
  685. next use of `M-x shell' will create a new buffer `*shell*' with its own
  686. subshell.  By renaming this buffer as well you can create a third one,
  687. and so on.  All the subshells run independently and in parallel.
  688.    The file name used to load the subshell is the value of the variable
  689. `explicit-shell-file-name', if that is non-`nil'.  Otherwise, the
  690. environment variable `ESHELL' is used, or the environment variable
  691. `SHELL' if there is no `ESHELL'.  If the file name specified is
  692. relative, the directories in the list `exec-path' are searched (*note
  693. Single Shell Commands: Single Shell.).
  694.    As soon as the subshell is started, it is sent as input the contents
  695. of the file `~/.emacs_SHELLNAME', if that file exists, where SHELLNAME
  696. is the name of the file that the shell was loaded from. For example, if
  697. you use `csh', the file sent to it is `~/.emacs_csh'.
  698.    `cd', `pushd' and `popd' commands given to the inferior shell are
  699. watched by Emacs so it can keep the `*shell*' buffer's default
  700. directory the same as the shell's working directory.  These commands
  701. are recognized syntactically by examining lines of input that are sent.
  702.  If you use aliases for these commands, you can tell Emacs to recognize
  703. them also.  For example, if the value of the variable
  704. `shell-pushd-regexp' matches the beginning of a shell command line,
  705. that line is regarded as a `pushd' command.  Change this variable when
  706. you add aliases for `pushd'.  Likewise, `shell-popd-regexp' and
  707. `shell-cd-regexp' are used to recognize commands with the meaning of
  708. `popd' and `cd'.  These commands are recognized only at the beginning
  709. of a shell command line.
  710.    If Emacs gets an error while trying to handle what it believes is a
  711. `cd', `pushd' or `popd' command, and the value of
  712. `shell-set-directory-error-hook' is non-`nil', that value is called as
  713. a function with no arguments.
  714. File: emacs,  Node: Shell Mode,  Prev: Interactive Shell,  Up: Shell
  715. Shell Mode
  716. ----------
  717.    The shell buffer uses Shell mode, which defines several special keys
  718. attached to the `C-c' prefix.  They are chosen to resemble the usual
  719. editing and job control characters present in shells that are not under
  720. Emacs, except that you must type `C-c' first.  Here is a complete list
  721. of the special key bindings of Shell mode:
  722. `RET'
  723.      At end of buffer send line as input; otherwise, copy current line
  724.      to end of buffer and send it (`send-shell-input').  When a line is
  725.      copied, any text at the beginning of the line that matches the
  726.      variable `shell-prompt-pattern' is left out; this variable's value
  727.      should be a regexp string that matches the prompts that you use in
  728.      your subshell.
  729. `C-c C-d'
  730.      Send end-of-file as input, probably causing the shell or its
  731.      current subjob to finish (`shell-send-eof').
  732. `C-c C-u'
  733.      Kill all text that has yet to be sent as input
  734.      (`kill-shell-input').
  735. `C-c C-w'
  736.      Kill a word before point (`backward-kill-word').
  737. `C-c C-c'
  738.      Interrupt the shell or its current subjob if any
  739.      (`interrupt-shell-subjob').
  740. `C-c C-z'
  741.      Stop the shell or its current subjob if any (`stop-shell-subjob').
  742. `C-c C-\'
  743.      Send quit signal to the shell or its current subjob if any
  744.      (`quit-shell-subjob').
  745. `C-c C-o'
  746.      Delete last batch of output from shell (`kill-output-from-shell').
  747. `C-c C-r'
  748.      Scroll top of last batch of output to top of window
  749.      (`show-output-from-shell').
  750. `C-c C-y'
  751.      Copy the previous bunch of shell input, and insert it into the
  752.      buffer before point (`copy-last-shell-input').  No final newline
  753.      is inserted, and the input copied is not resubmitted until you type
  754.      RET.
  755. File: emacs,  Node: Hardcopy,  Next: Dissociated Press,  Prev: Shell,  Up: Top
  756. Hardcopy Output
  757. ===============
  758.    The Emacs commands for making hardcopy derive their names from the
  759. Unix commands `print' and `lpr'.
  760. `M-x print-buffer'
  761.      Print hardcopy of current buffer using Unix command `print' (`lpr
  762.      -p').  This makes page headings containing the file name and page
  763.      number.
  764. `M-x lpr-buffer'
  765.      Print hardcopy of current buffer using Unix command `lpr'. This
  766.      makes no page headings.
  767. `M-x print-region'
  768.      Like `print-buffer' but prints only the current region.
  769. `M-x lpr-region'
  770.      Like `lpr-buffer' but prints only the current region.
  771.    All the hardcopy commands pass extra switches to the `lpr' program
  772. based on the value of the variable `lpr-switches'.  Its value should be
  773. a list of strings, each string a switch starting with `-'.  For
  774. example, the value could be `("-Pfoo")' to print on printer `foo'.
  775. File: emacs,  Node: Dissociated Press,  Next: Amusements,  Prev: Hardcopy,  Up: Top
  776. Dissociated Press
  777. =================
  778.    `M-x dissociated-press' is a command for scrambling a file of text
  779. either word by word or character by character.  Starting from a buffer
  780. of straight English, it produces extremely amusing output.  The input
  781. comes from the current Emacs buffer.  Dissociated Press writes its
  782. output in a buffer named `*Dissociation*', and redisplays that buffer
  783. after every couple of lines (approximately) to facilitate reading it.
  784.    `dissociated-press' asks every so often whether to continue
  785. operating.  Answer `n' to stop it.  You can also stop at any time by
  786. typing `C-g'.  The dissociation output remains in the `*Dissociation*'
  787. buffer for you to copy elsewhere if you wish.
  788.    Dissociated Press operates by jumping at random from one point in the
  789. buffer to another.  In order to produce plausible output rather than
  790. gibberish, it insists on a certain amount of overlap between the end of
  791. one run of consecutive words or characters and the start of the next. 
  792. That is, if it has just printed out `president' and then decides to
  793. jump to a different point in the file, it might spot the `ent' in
  794. `pentagon' and continue from there, producing `presidentagon'.  Long
  795. sample texts produce the best results.
  796.    A positive argument to `M-x dissociated-press' tells it to operate
  797. character by character, and specifies the number of overlap characters.
  798.  A negative argument tells it to operate word by word and specifies the
  799. number of overlap words.  In this mode, whole words are treated as the
  800. elements to be permuted, rather than characters.  No argument is
  801. equivalent to an argument of two.  For your againformation, the output
  802. goes only into the buffer `*Dissociation*'.  The buffer you start with
  803. is not changed.
  804.    Dissociated Press produces nearly the same results as a Markov chain
  805. based on a frequency table constructed from the sample text.  It is,
  806. however, an independent, ignoriginal invention.  Dissociated Press
  807. techniquitously copies several consecutive characters from the sample
  808. between random choices, whereas a Markov chain would choose randomly for
  809. each word or character.  This makes for more plausible sounding results,
  810. and runs faster.
  811.    It is a mustatement that too much use of Dissociated Press can be a
  812. developediment to your real work.  Sometimes to the point of outragedy.
  813. And keep dissociwords out of your documentation, if you want it to be
  814. well userenced and properbose.  Have fun.  Your buggestions are welcome.
  815. File: emacs,  Node: Amusements,  Next: Emulation,  Prev: Dissociated Press,  Up: Top
  816. Other Amusements
  817. ================
  818.    If you are a little bit bored, you can try `M-x hanoi'.  If you are
  819. considerably bored, give it a numeric argument.  If you are very very
  820. bored, try an argument of 9.  Sit back and watch.
  821.    When you are frustrated, try the famous Eliza program.  Just do `M-x
  822. doctor'.  End each input by typing `RET' twice.
  823.    When you are feeling strange, type `M-x yow'.
  824. File: emacs,  Node: Emulation,  Next: Customization,  Prev: Amusements,  Up: Top
  825. Emulation
  826. =========
  827.    GNU Emacs can be programmed to emulate (more or less) most other
  828. editors.  Standard facilities can emulate these:
  829. EDT (DEC VMS editor)
  830.      Turn on EDT emulation with `M-x edt-emulation-on'.  `M-x
  831.      edt-emulation-off' restores normal Emacs command bindings.
  832.      Most of the EDT emulation commands are keypad keys, and most
  833.      standard Emacs key bindings are still available.  The EDT
  834.      emulation rebindings are done in the global keymap, so there is no
  835.      problem switching buffers or major modes while in EDT emulation.
  836. Gosling Emacs
  837.      Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
  838.      set-gosmacs-bindings'.  This redefines many keys, mostly on the
  839.      `C-x' and `ESC' prefixes, to work as they do in Gosmacs. `M-x
  840.      set-gnu-bindings' returns to normal GNU Emacs by rebinding the
  841.      same keys to the definitions they had at the time `M-x
  842.      set-gosmacs-bindings' was done.
  843.      It is also possible to run Mocklisp code written for Gosling Emacs.
  844.      *Note Mocklisp::.
  845. vi (Berkeley Unix editor)
  846.      Turn on vi emulation with `M-x vi-mode'.  This is a major mode
  847.      that replaces the previously established major mode.  All of the
  848.      vi commands that, in real vi, enter "input" mode are programmed in
  849.      the Emacs emulator to return to the previous major mode.  Thus,
  850.      ordinary Emacs serves as vi's "input" mode.
  851.      Because vi emulation works through major modes, it does not work
  852.      to switch buffers during emulation.  Return to normal Emacs first.
  853.      If you plan to use vi emulation much, you probably want to bind a
  854.      key to the `vi-mode' command.
  855. vi (alternate emulator)
  856.      Another vi emulator said to resemble real vi more thoroughly is
  857.      invoked by `M-x vip-mode'.  "Input" mode in this emulator is
  858.      changed from ordinary Emacs so you can use ESC to go back to
  859.      emulated vi command mode.  To get from emulated vi command mode
  860.      back to ordinary Emacs, type `C-z'.
  861.      This emulation does not work through major modes, and it is
  862.      possible to switch buffers in various ways within the emulator. 
  863.      It is not so necessary to assign a key to the command `vip-mode' as
  864.      it is with `vi-mode' because terminating insert mode does not use
  865.      it.
  866.      For full information, see the long comment at the beginning of the
  867.      source file, which is `lisp/vip.el' in the Emacs distribution.
  868.    I am interested in hearing which vi emulator users prefer, as well
  869. as in receiving more complete user documentation for either or both
  870. emulators. Warning: loading both at once may cause name conficts; no
  871. one has checked.
  872.