home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / emacs.i09 (.txt) < prev    next >
GNU Info File  |  1993-06-14  |  50KB  |  863 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: Lisp Debug,  Next: Lisp Interaction,  Prev: Lisp Eval,  Up: Running
  20. The Emacs-Lisp Debugger
  21. =======================
  22.    GNU Emacs contains a debugger for Lisp programs executing inside it.
  23. This debugger is normally not used; many commands frequently get Lisp
  24. errors when invoked in inappropriate contexts (such as `C-f' at the end
  25. of the buffer) and it would be very unpleasant for that to enter a
  26. special debugging mode.  When you want to make Lisp errors invoke the
  27. debugger, you must set the variable `debug-on-error' to non-`nil'. 
  28. Quitting with `C-g' is not considered an error, and `debug-on-error'
  29. has no effect on the handling of `C-g'.  However, if you set
  30. `debug-on-quit' non-`nil', `C-g' will invoke the debugger. This can be
  31. useful for debugging an infinite loop; type `C-g' once the loop has had
  32. time to reach its steady state.  `debug-on-quit' has no effect on
  33. errors.
  34.    You can also cause the debugger to be entered when a specified
  35. function is called, or at a particular place in Lisp code.  Use `M-x
  36. debug-on-entry' with argument FUN-NAME to cause function FUN-NAME to
  37. enter the debugger as soon as it is called.  Use `M-x
  38. cancel-debug-on-entry' to make the function stop entering the debugger
  39. when called.  (Redefining the function also does this.)  To enter the
  40. debugger from some other place in Lisp code, you must insert the
  41. expression `(debug)' there and install the changed code with `C-M-x'. 
  42. *Note Lisp Eval::.
  43.    When the debugger is entered, it displays the previously selected
  44. buffer in one window and a buffer named `*Backtrace*' in another
  45. window.  The backtrace buffer contains one line for each level of Lisp
  46. function execution currently going on.  At the beginning of this buffer
  47. is a message describing the reason that the debugger was invoked (such
  48. as, what error message if it was invoked due to an error).
  49.    The backtrace buffer is read-only, and is in a special major mode,
  50. Backtrace mode, in which letters are defined as debugger commands.  The
  51. usual Emacs editing commands are available; you can switch windows to
  52. examine the buffer that was being edited at the time of the error, and
  53. you can also switch buffers, visit files, and do any other sort of
  54. editing. However, the debugger is a recursive editing level (*note
  55. Recursive Edit::.) and it is wise to go back to the backtrace buffer
  56. and exit the debugger officially when you don't want to use it any
  57. more.  Exiting the debugger kills the backtrace buffer.
  58.    The contents of the backtrace buffer show you the functions that are
  59. executing and the arguments that were given to them.  It has the
  60. additional purpose of allowing you to specify a stack frame by moving
  61. point to the line describing that frame.  The frame whose line point is
  62. on is considered the "current frame".  Some of the debugger commands
  63. operate on the current frame.  Debugger commands are mainly used for
  64. stepping through code an expression at a time.  Here is a list of them.
  65.      Exit the debugger and continue execution.  In most cases,
  66.      execution of the program continues as if the debugger had never
  67.      been entered (aside from the effect of any variables or data
  68.      structures you may have changed while inside the debugger).  This
  69.      includes entry to the debugger due to function entry or exit,
  70.      explicit invocation, quitting or certain errors.  Most errors
  71.      cannot be continued; trying to continue one of them causes the
  72.      same error to occur again.
  73.      Continue execution, but enter the debugger the next time a Lisp
  74.      function is called.  This allows you to step through the
  75.      subexpressions of an expression, seeing what values the
  76.      subexpressions compute and what else they do.
  77.      The stack frame made for the function call which enters the
  78.      debugger in this way will be flagged automatically for the
  79.      debugger to be called when the frame is exited.  You can use the
  80.      `u' command to cancel this flag.
  81.      Set up to enter the debugger when the current frame is exited. 
  82.      Frames that will invoke the debugger on exit are flagged with
  83.      stars.
  84.      Don't enter the debugger when the current frame is exited.  This
  85.      cancels a `b' command on that frame.
  86.      Read a Lisp expression in the minibuffer, evaluate it, and print
  87.      the value in the echo area.  This is the same as the command
  88.      `M-ESC', except that `e' is not normally disabled like `M-ESC'.
  89.      Terminate the program being debugged; return to top-level Emacs
  90.      command execution.
  91.      If the debugger was entered due to a `C-g' but you really want to
  92.      quit, not to debug, use the `q' command.
  93.      Return a value from the debugger.  The value is computed by
  94.      reading an expression with the minibuffer and evaluating it.
  95.      The value returned by the debugger makes a difference when the
  96.      debugger was invoked due to exit from a Lisp call frame (as
  97.      requested with `b'); then the value specified in the `r' command
  98.      is used as the value of that frame.
  99.      The debugger's return value also matters with many errors.  For
  100.      example, `wrong-type-argument' errors will use the debugger's
  101.      return value instead of the invalid argument; `no-catch' errors
  102.      will use the debugger value as a throw tag instead of the tag that
  103.      was not found. If an error was signaled by calling the Lisp
  104.      function `signal', the debugger's return value is returned as the
  105.      value of `signal'.
  106. File: emacs,  Node: Lisp Interaction,  Next: External Lisp,  Prev: Lisp Debug,  Up: Running
  107. Lisp Interaction Buffers
  108. ========================
  109.    The buffer `*scratch*' which is selected when Emacs starts up is
  110. provided for evaluating Lisp expressions interactively inside Emacs. 
  111. Both the expressions you evaluate and their output goes in the buffer.
  112.    The `*scratch*' buffer's major mode is Lisp Interaction mode, which
  113. is the same as Emacs-Lisp mode except for one command, LFD.  In
  114. Emacs-Lisp mode, LFD is an indentation command, as usual.  In Lisp
  115. Interaction mode, LFD is bound to `eval-print-last-sexp'.  This
  116. function reads the Lisp expression before point, evaluates it, and
  117. inserts the value in printed representation before point.
  118.    Thus, the way to use the `*scratch*' buffer is to insert Lisp
  119. expressions at the end, ending each one with LFD so that it will be
  120. evaluated. The result is a complete typescript of the expressions you
  121. have evaluated and their values.
  122.    The rationale for this feature is that Emacs must have a buffer when
  123. it starts up, but that buffer is not useful for editing files since a
  124. new buffer is made for every file that you visit.  The Lisp interpreter
  125. typescript is the most useful thing I can think of for the initial
  126. buffer to do.  `M-x lisp-interaction-mode' will put any buffer in Lisp
  127. Interaction mode.
  128. File: emacs,  Node: External Lisp,  Prev: Lisp Interaction,  Up: Running
  129. Running an External Lisp
  130. ========================
  131.    Emacs has facilities for running programs in other Lisp systems. 
  132. You can run a Lisp process as an inferior of Emacs, and pass
  133. expressions to it to be evaluated.  You can also pass changed function
  134. definitions directly from the Emacs buffers in which you edit the Lisp
  135. programs to the inferior Lisp process.
  136.    To run an inferior Lisp process, type `M-x run-lisp'.  This runs the
  137. program named `lisp', the same program you would run by typing `lisp'
  138. as a shell command, with both input and output going through an Emacs
  139. buffer named `*lisp*'.  That is to say, any "terminal output" from Lisp
  140. will go into the buffer, advancing point, and any "terminal input" for
  141. Lisp comes from text in the buffer.  To give input to Lisp, go to the
  142. end of the buffer and type the input, terminated by RET.  The `*lisp*'
  143. buffer is in Inferior Lisp mode, a mode which has all the special
  144. characteristics of Lisp mode and Shell mode (*note Shell Mode::.).
  145.    For the source files of programs to run in external Lisps, use Lisp
  146. mode. This mode can be selected with `M-x lisp-mode', and is used
  147. automatically for files whose names end in `.l' or `.lisp', as most Lisp
  148. systems usually expect.
  149.    When you edit a function in a Lisp program you are running, the
  150. easiest way to send the changed definition to the inferior Lisp process
  151. is the key `C-M-x'.  In Lisp mode, this runs the function
  152. `lisp-send-defun', which finds the defun around or following point and
  153. sends it as input to the Lisp process.  (Emacs can send input to any
  154. inferior process regardless of what buffer is current.)
  155.    Contrast the meanings of `C-M-x' in Lisp mode (for editing programs
  156. to be run in another Lisp system) and Emacs-Lisp mode (for editing Lisp
  157. programs to be run in Emacs): in both modes it has the effect of
  158. installing the function definition that point is in, but the way of
  159. doing so is different according to where the relevant Lisp environment
  160. is found. *Note Lisp Modes::.
  161. File: emacs,  Node: Abbrevs,  Next: Picture,  Prev: Running,  Up: Top
  162. Abbrevs
  163. *******
  164.    An "abbrev" is a word which "expands", if you insert it, into some
  165. different text.  Abbrevs are defined by the user to expand in specific
  166. ways.  For example, you might define `foo' as an abbrev expanding to
  167. `find outer otter'.  With this abbrev defined, you would be able to get
  168. `find outer otter ' into the buffer by typing `f o o SPC'.
  169.    Abbrevs expand only when Abbrev mode (a minor mode) is enabled.
  170. Disabling Abbrev mode does not cause abbrev definitions to be forgotten,
  171. but they do not expand until Abbrev mode is enabled again.  The command
  172. `M-x abbrev-mode' toggles Abbrev mode; with a numeric argument, it
  173. turns Abbrev mode on if the argument is positive, off otherwise. *Note
  174. Minor Modes::.  `abbrev-mode' is also a variable; Abbrev mode is on
  175. when the variable is non-`nil'.  The variable `abbrev-mode'
  176. automatically becomes local to the current buffer when it is set.
  177.    Abbrev definitions can be "mode-specific"--active only in one major
  178. mode.  Abbrevs can also have "global" definitions that are active in
  179. all major modes.  The same abbrev can have a global definition and
  180. various mode-specific definitions for different major modes.  A mode
  181. specific definition for the current major mode overrides a global
  182. definition.
  183.    Abbrevs can be defined interactively during the editing session. 
  184. Lists of abbrev definitions can also be saved in files and reloaded in
  185. later sessions.  Some users keep extensive lists of abbrevs that they
  186. load in every session.
  187.    A second kind of abbreviation facility is called the "dynamic
  188. expansion".  Dynamic abbrev expansion happens only when you give an
  189. explicit command and the result of the expansion depends only on the
  190. current contents of the buffer.  *Note Dynamic Abbrevs::.
  191. * Menu:
  192. * Defining Abbrevs::  Defining an abbrev, so it will expand when typed.
  193. * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
  194. * Editing Abbrevs::   Viewing or editing the entire list of defined abbrevs.
  195. * Saving Abbrevs::    Saving the entire list of abbrevs for another session.
  196. * Dynamic Abbrevs::   Abbreviations for words already in the buffer.
  197. File: emacs,  Node: Defining Abbrevs,  Next: Expanding Abbrevs,  Prev: Abbrevs,  Up: Abbrevs
  198. Defining Abbrevs
  199. ================
  200. `C-x +'
  201.      Define an abbrev to expand into some text before point
  202.      (`add-global-abbrev').
  203. `C-x C-a'
  204.      Similar, but define an abbrev available only in the current major
  205.      mode (`add-mode-abbrev').
  206. `C-x -'
  207.      Define a word in the buffer as an abbrev
  208.      (`inverse-add-global-abbrev').
  209. `C-x C-h'
  210.      Define a word in the buffer as a mode-specific abbrev
  211.      (`inverse-add-mode-abbrev').
  212. `M-x kill-all-abbrevs'
  213.      After this command, there are no abbrev definitions in effect.
  214.    The usual way to define an abbrev is to enter the text you want the
  215. abbrev to expand to, position point after it, and type `C-x +'
  216. (`add-global-abbrev').  This reads the abbrev itself using the
  217. minibuffer, and then defines it as an abbrev for one or more words
  218. before point.  Use a numeric argument to say how many words before
  219. point should be taken as the expansion.  For example, to define the
  220. abbrev `foo' as mentioned above, insert the text `find outer otter' and
  221. then type `C-u 3 C-x + f o o RET'.
  222.    An argument of zero to `C-x +' means to use the contents of the
  223. region as the expansion of the abbrev being defined.
  224.    The command `C-x C-a' (`add-mode-abbrev') is similar, but defines a
  225. mode-specific abbrev.  Mode specific abbrevs are active only in a
  226. particular major mode.  `C-x C-a' defines an abbrev for the major mode
  227. in effect at the time `C-x C-a' is typed.  The arguments work the same
  228. as for `C-x +'.
  229.    If the text of the abbrev you want is already in the buffer instead
  230. of the expansion, use command `C-x -' (`inverse-add-global-abbrev')
  231. instead of `C-x +', or use `C-x C-h' (`inverse-add-mode-abbrev')
  232. instead of `C-x C-a'.  These commands are called "inverse" because they
  233. invert the meaning of the argument found in the buffer and the argument
  234. read using the minibuffer.
  235.    To change the definition of an abbrev, just add the new definition. 
  236. You will be asked to confirm if the abbrev has a prior definition.  To
  237. remove an abbrev definition, give a negative argument to `C-x +' or `C-x
  238. C-a'.  You must choose the command to specify whether to kill a global
  239. definition or a mode-specific definition for the current mode, since
  240. those two definitions are independent for one abbrev.
  241.    `M-x kill-all-abbrevs' removes all the abbrev definitions there are.
  242. File: emacs,  Node: Expanding Abbrevs,  Next: Editing Abbrevs,  Prev: Defining Abbrevs,  Up: Abbrevs
  243. Controlling Abbrev Expansion
  244. ============================
  245.    An abbrev expands whenever it is present in the buffer just before
  246. point and a self-inserting punctuation character (SPC, comma, etc.) is
  247. typed.  Most often the way an abbrev is used is to insert the abbrev
  248. followed by punctuation.
  249.    Abbrev expansion preserves case; thus, `foo' expands into `find
  250. outer otter'; `Foo' into `Find outer otter', and `FOO' into `FIND OUTER
  251. OTTER' or `Find Outer Otter' according to the variable
  252. `abbrev-all-caps' (a non-`nil' value chooses the first of the two
  253. expansions).
  254.    These two commands are used to control abbrev expansion:
  255. `M-''
  256.      Separate a prefix from a following abbrev to be expanded
  257.      (`abbrev-prefix-mark').
  258. `C-x ''
  259.      Expand the abbrev before point (`expand-abbrev'). This is
  260.      effective even when Abbrev mode is not enabled.
  261. `M-x unexpand-abbrev'
  262.      Undo last abbrev expansion.
  263. `M-x expand-region-abbrevs'
  264.      Expand some or all abbrevs found in the region.
  265.    You may wish to expand an abbrev with a prefix attached; for
  266. example, if `cnst' expands into `construction', you might want to use
  267. it to enter `reconstruction'.  It does not work to type `recnst',
  268. because that is not necessarily a defined abbrev.  What does work is to
  269. use the command `M-'' (`abbrev-prefix-mark') in between the prefix `re'
  270. and the abbrev `cnst'.  First, insert `re'.  Then type `M-''; this
  271. inserts a minus sign in the buffer to indicate that it has done its
  272. work.  Then insert the abbrev `cnst'; the buffer now contains
  273. `re-cnst'.  Now insert a punctuation character to expand the abbrev
  274. `cnst' into `construction'.  The minus sign is deleted at this point,
  275. because `M-'' left word for this to be done.  The resulting text is the
  276. desired `reconstruction'.
  277.    If you actually want the text of the abbrev in the buffer, rather
  278. than its expansion, you can accomplish this by inserting the following
  279. punctuation with `C-q'.  Thus, `foo C-q -' leaves `foo-' in the buffer.
  280.    If you expand an abbrev by mistake, you can undo the expansion
  281. (replace the expansion by the original abbrev text) with `M-x
  282. unexpand-abbrev'. `C-_' (`undo') can also be used to undo the
  283. expansion; but first it will undo the insertion of the following
  284. punctuation character!
  285.    `M-x expand-region-abbrevs' searches through the region for defined
  286. abbrevs, and for each one found offers to replace it with its expansion.
  287. This command is useful if you have typed in text using abbrevs but
  288. forgot to turn on Abbrev mode first.  It may also be useful together
  289. with a special set of abbrev definitions for making several global
  290. replacements at once.  This command is effective even if Abbrev mode is
  291. not enabled.
  292. File: emacs,  Node: Editing Abbrevs,  Next: Saving Abbrevs,  Prev: Expanding Abbrevs,  Up: Abbrevs
  293. Examining and Editing Abbrevs
  294. =============================
  295. `M-x list-abbrevs'
  296.      Print a list of all abbrev definitions.
  297. `M-x edit-abbrevs'
  298.      Edit a list of abbrevs; you can add, alter or remove definitions.
  299.    The output from `M-x list-abbrevs' looks like this:
  300.      (lisp-mode-abbrev-table)
  301.      "dk"           0    "define-key"
  302.      (global-abbrev-table)
  303.      "dfn"           0    "definition"
  304. (Some blank lines of no semantic significance, and some other abbrev
  305. tables, have been omitted.)
  306.    A line containing a name in parentheses is the header for abbrevs in
  307. a particular abbrev table; `global-abbrev-table' contains all the global
  308. abbrevs, and the other abbrev tables that are named after major modes
  309. contain the mode-specific abbrevs.
  310.    Within each abbrev table, each nonblank line defines one abbrev.  The
  311. word at the beginning is the abbrev.  The number that appears is the
  312. number of times the abbrev has been expanded.  Emacs keeps track of
  313. this to help you see which abbrevs you actually use, in case you decide
  314. to eliminate those that you don't use often.  The string at the end of
  315. the line is the expansion.
  316.    `M-x edit-abbrevs' allows you to add, change or kill abbrev
  317. definitions by editing a list of them in an Emacs buffer.  The list has
  318. the same format described above.  The buffer of abbrevs is called
  319. `*Abbrevs*', and is in Edit-Abbrevs mode.  This mode redefines the key
  320. `C-c C-c' to install the abbrev definitions as specified in the buffer.
  321.  The command that does this is `edit-abbrevs-redefine'.  Any abbrevs
  322. not described in the buffer are eliminated when this is done.
  323.    `edit-abbrevs' is actually the same as `list-abbrevs' except that it
  324. selects the buffer `*Abbrevs*' whereas `list-abbrevs' merely displays
  325. it in another window.
  326. File: emacs,  Node: Saving Abbrevs,  Next: Dynamic Abbrevs,  Prev: Editing Abbrevs,  Up: Abbrevs
  327. Saving Abbrevs
  328. ==============
  329.    These commands allow you to keep abbrev definitions between editing
  330. sessions.
  331. `M-x write-abbrev-file'
  332.      Write a file describing all defined abbrevs.
  333. `M-x read-abbrev-file'
  334.      Read such a file and define abbrevs as specified there.
  335. `M-x quietly-read-abbrev-file'
  336.      Similar but do not display a message about what is going on.
  337. `M-x define-abbrevs'
  338.      Define abbrevs from buffer.
  339. `M-x insert-abbrevs'
  340.      Insert all abbrevs and their expansions into the buffer.
  341.    `M-x write-abbrev-file' reads a file name using the minibuffer and
  342. writes a description of all current abbrev definitions into that file. 
  343. The text stored in the file looks like the output of `M-x list-abbrevs'.
  344. This is used to save abbrev definitions for use in a later session.
  345.    `M-x read-abbrev-file' reads a file name using the minibuffer and
  346. reads the file, defining abbrevs according to the contents of the file.
  347. `M-x quietly-read-abbrev-file' is the same except that it does not
  348. display a message in the echo area saying that it is doing its work; it
  349. is actually useful primarily in the `.emacs' file.  If an empty
  350. argument is given to either of these functions, the file name used is
  351. the value of the variable `abbrev-file-name', which is by default
  352. `"~/.abbrev_defs"'.
  353.    Emacs will offer to save abbrevs automatically if you have changed
  354. any of them, whenever it offers to save all files (for `C-x s' or `C-x
  355. C-c').  This feature can be inhibited by setting the variable
  356. `save-abbrevs' to `nil'.
  357.    The commands `M-x insert-abbrevs' and `M-x define-abbrevs' are
  358. similar to the previous commands but work on text in an Emacs buffer.
  359. `M-x insert-abbrevs' inserts text into the current buffer before point,
  360. describing all current abbrev definitions; `M-x define-abbrevs' parses
  361. the entire current buffer and defines abbrevs accordingly.
  362. File: emacs,  Node: Dynamic Abbrevs,  Prev: Saving Abbrevs,  Up: Abbrevs
  363. Dynamic Abbrev Expansion
  364. ========================
  365.    The abbrev facility described above operates automatically as you
  366. insert text, but all abbrevs must be defined explicitly.  By contrast,
  367. "dynamic abbrevs" allow the meanings of abbrevs to be determined
  368. automatically from the contents of the buffer, but dynamic abbrev
  369. expansion happens only when you request it explicitly.
  370. `M-/'
  371.      Expand the word in the buffer before point as a "dynamic abbrev",
  372.      by searching in the buffer for words starting with that
  373.      abbreviation (`dabbrev-expand').
  374.    For example, if the buffer contains `does this follow ' and you type
  375. `f o M-/', the effect is to insert `follow' because that is the last
  376. word in the buffer that starts with `fo'.  A numeric argument to `M-/'
  377. says to take the second, third, etc. distinct expansion found looking
  378. backward from point.  Repeating `M-/' searches for an alternative
  379. expansion by looking farther back.  After the entire buffer before
  380. point has been considered, the buffer after point is searched.
  381.    Dynamic abbrev expansion is completely independent of Abbrev mode;
  382. the expansion of a word with `M-/' is completely independent of whether
  383. it has a definition as an ordinary abbrev.
  384. File: emacs,  Node: Picture,  Next: Sending Mail,  Prev: Abbrevs,  Up: Top
  385. Editing Pictures
  386. ****************
  387.    If you want to create a picture made out of text characters (for
  388. example, a picture of the division of a register into fields, as a
  389. comment in a program), use the command `edit-picture' to enter Picture
  390. mode.
  391.    In Picture mode, editing is based on the "quarter-plane" model of
  392. text, according to which the text characters lie studded on an area that
  393. stretches infinitely far to the right and downward.  The concept of the
  394. end of a line does not exist in this model; the most you can say is
  395. where the last nonblank character on the line is found.
  396.    Of course, Emacs really always considers text as a sequence of
  397. characters, and lines really do have ends.  But in Picture mode most
  398. frequently-used keys are rebound to commands that simulate the
  399. quarter-plane model of text.  They do this by inserting spaces or by
  400. converting tabs to spaces.
  401.    Most of the basic editing commands of Emacs are redefined by Picture
  402. mode to do essentially the same thing but in a quarter-plane way.  In
  403. addition, Picture mode defines various keys starting with the `C-c'
  404. prefix to run special picture editing commands.
  405.    One of these keys, `C-c C-c', is pretty important.  Often a picture
  406. is part of a larger file that is usually edited in some other major
  407. mode. `M-x edit-picture' records the name of the previous major mode,
  408. and then you can use the `C-c C-c' command (`picture-mode-exit') to
  409. restore that mode.  `C-c C-c' also deletes spaces from the ends of
  410. lines, unless given a numeric argument.
  411.    The commands used in Picture mode all work in other modes (provided
  412. the `picture' library is loaded), but are not bound to keys except in
  413. Picture mode.  Note that the descriptions below talk of moving "one
  414. column" and so on, but all the picture mode commands handle numeric
  415. arguments as their normal equivalents do.
  416.    Turning on Picture mode calls the value of the variable
  417. `picture-mode-hook' as a function, with no arguments, if that value
  418. exists and is non-`nil'.
  419. * Menu:
  420. * Basic Picture::         Basic concepts and simple commands of Picture Mode.
  421. * Insert in Picture::     Controlling direction of cursor motion
  422.                            after "self-inserting" characters.
  423. * Tabs in Picture::       Various features for tab stops and indentation.
  424. * Rectangles in Picture:: Clearing and superimposing rectangles.
  425. File: emacs,  Node: Basic Picture,  Next: Insert in Picture,  Prev: Picture,  Up: Picture
  426. Basic Editing in Picture Mode
  427. =============================
  428.    Most keys do the same thing in Picture mode that they usually do,
  429. but do it in a quarter-plane style.  For example, `C-f' is rebound to
  430. run `picture-forward-column', which is defined to move point one column
  431. to the right, by inserting a space if necessary, so that the actual end
  432. of the line makes no difference.  `C-b' is rebound to run
  433. `picture-backward-column', which always moves point left one column,
  434. converting a tab to multiple spaces if necessary.  `C-n' and `C-p' are
  435. rebound to run `picture-move-down' and `picture-move-up', which can
  436. either insert spaces or convert tabs as necessary to make sure that
  437. point stays in exactly the same column.  `C-e' runs
  438. `picture-end-of-line', which moves to after the last nonblank character
  439. on the line.  There is no need to change `C-a', as the choice of screen
  440. model does not affect beginnings of lines.
  441.    Insertion of text is adapted to the quarter-plane screen model
  442. through the use of Overwrite mode (*note Minor Modes::.). 
  443. Self-inserting characters replace existing text, column by column,
  444. rather than pushing existing text to the right.  RET runs
  445. `picture-newline', which just moves to the beginning of the following
  446. line so that new text will replace that line.
  447.    Deletion and killing of text are replaced with erasure.  DEL
  448. (`picture-backward-clear-column') replaces the preceding character with
  449. a space rather than removing it.  `C-d' (`picture-clear-column') does
  450. the same thing in a forward direction. `C-k' (`picture-clear-line')
  451. really kills the contents of lines, but does not ever remove the
  452. newlines from the buffer.
  453.    To do actual insertion, you must use special commands.  `C-o'
  454. (`picture-open-line') still creates a blank line, but does so after the
  455. current line; it never splits a line.  `C-M-o', `split-line', makes
  456. sense in Picture mode, so it is not changed.  LFD
  457. (`picture-duplicate-line') inserts below the current line another line
  458. with the same contents.
  459.    Real deletion can be done with `C-w', or with `C-c C-d' (which is
  460. defined as `delete-char', as `C-d' is in other modes), or with one of
  461. the picture rectangle commands (*note Rectangles in Picture::.).
  462. File: emacs,  Node: Insert in Picture,  Next: Tabs in Picture,  Prev: Basic Picture,  Up: Picture
  463. Controlling Motion after Insert
  464. ===============================
  465.    Since "self-inserting" characters in Picture mode just overwrite and
  466. move point, there is no essential restriction on how point should be
  467. moved. Normally point moves right, but you can specify any of the eight
  468. orthogonal or diagonal directions for motion after a "self-inserting"
  469. character. This is useful for drawing lines in the buffer.
  470. `C-c <'
  471.      Move left after insertion (`picture-movement-left').
  472. `C-c >'
  473.      Move right after insertion (`picture-movement-right').
  474. `C-c ^'
  475.      Move up after insertion (`picture-movement-up').
  476. `C-c .'
  477.      Move down after insertion (`picture-movement-down').
  478. `C-c `'
  479.      Move up and left ("northwest") after insertion
  480.      (`picture-movement-nw').
  481. `C-c ''
  482.      Move up and right ("northeast") after insertion
  483.      (`picture-movement-ne').
  484. `C-c /'
  485.      Move down and left ("southwest") after insertion
  486.      (`picture-movement-sw').
  487. `C-c \'
  488.      Move down and right ("southeast") after insertion
  489.      (`picture-movement-se').
  490.    Two motion commands move based on the current Picture insertion
  491. direction.  The command `C-c C-f' (`picture-motion') moves in the same
  492. direction as motion after "insertion" currently does, while `C-c C-b'
  493. (`picture-motion-reverse') moves in the opposite direction.
  494. File: emacs,  Node: Tabs in Picture,  Next: Rectangles in Picture,  Prev: Insert in Picture,  Up: Picture
  495. Picture Mode Tabs
  496. =================
  497.    Two kinds of tab-like action are provided in Picture mode.
  498. Context-based tabbing is done with `M-TAB' (`picture-tab-search'). 
  499. With no argument, it moves to a point underneath the next "interesting"
  500. character that follows whitespace in the previous nonblank line. 
  501. "Next" here means "appearing at a horizontal position greater than the
  502. one point starts out at".  With an argument, as in `C-u M-TAB', this
  503. command moves to the next such interesting character in the current
  504. line.  `M-TAB' does not change the text; it only moves point. 
  505. "Interesting" characters are defined by the variable
  506. `picture-tab-chars', which contains a string whose characters are all
  507. considered interesting.  Its default value is `"!-~"'.
  508.    TAB itself runs `picture-tab', which operates based on the current
  509. tab stop settings; it is the Picture mode equivalent of
  510. `tab-to-tab-stop'.  Normally it just moves point, but with a numeric
  511. argument it clears the text that it moves over.
  512.    The context-based and tab-stop-based forms of tabbing are brought
  513. together by the command `C-c TAB', `picture-set-tab-stops'. This
  514. command sets the tab stops to the positions which `M-TAB' would
  515. consider significant in the current line.  The use of this command,
  516. together with TAB, can get the effect of context-based tabbing.  But
  517. `M-TAB' is more convenient in the cases where it is sufficient.
  518. File: emacs,  Node: Rectangles in Picture,  Prev: Tabs in Picture,  Up: Picture
  519. Picture Mode Rectangle Commands
  520. ===============================
  521.    Picture mode defines commands for working on rectangular pieces of
  522. the text in ways that fit with the quarter-plane model.  The standard
  523. rectangle commands may also be useful (*note Rectangles::.).
  524. `C-c C-k'
  525.      Clear out the region-rectangle (`picture-clear-rectangle').  With
  526.      argument, kill it.
  527. `C-c C-w R'
  528.      Similar but save rectangle contents in register R first
  529.      (`picture-clear-rectangle-to-register').
  530. `C-c C-y'
  531.      Copy last killed rectangle into the buffer by overwriting, with
  532.      upper left corner at point (`picture-yank-rectangle').  With
  533.      argument, insert instead.
  534. `C-c C-x R'
  535.      Similar, but use the rectangle in register R
  536.      (`picture-yank-rectangle-from-register').
  537.    The picture rectangle commands `C-c C-k' (`picture-clear-rectangle')
  538. and `C-c C-w' (`picture-clear-rectangle-to-register') differ from the
  539. standard rectangle commands in that they normally clear the rectangle
  540. instead of deleting it; this is analogous with the way `C-d' is changed
  541. in Picture mode.
  542.    However, deletion of rectangles can be useful in Picture mode, so
  543. these commands delete the rectangle if given a numeric argument.
  544.    The Picture mode commands for yanking rectangles differ from the
  545. standard ones in overwriting instead of inserting.  This is the same
  546. way that Picture mode insertion of other text is different from other
  547. modes. `C-c C-y' (`picture-yank-rectangle') inserts (by overwriting) the
  548. rectangle that was most recently killed, while `C-c C-x'
  549. (`picture-yank-rectangle-from-register') does likewise for the
  550. rectangle found in a specified register.
  551. File: emacs,  Node: Sending Mail,  Next: Rmail,  Prev: Picture,  Up: Top
  552. Sending Mail
  553. ************
  554.    To send a message in Emacs, you start by typing a command (`C-x m')
  555. to select and initialize the `*mail*' buffer.  Then you edit the text
  556. and headers of the message in this buffer, and type another command
  557. (`C-c C-c') to send the message.
  558. `C-x m'
  559.      Begin composing a message to send (`mail').
  560. `C-x 4 m'
  561.      Likewise, but display the message in another window
  562.      (`mail-other-window').
  563. `C-c C-c'
  564.      In Mail mode, send the message and switch to another buffer
  565.      (`mail-send-and-exit').
  566.    The command `C-x m' (`mail') selects a buffer named `*mail*' and
  567. initializes it with the skeleton of an outgoing message. `C-x 4 m'
  568. (`mail-other-window') selects the `*mail*' buffer in a different
  569. window, leaving the previous current buffer visible.
  570.    Because the mail composition buffer is an ordinary Emacs buffer, you
  571. can switch to other buffers while in the middle of composing mail, and
  572. switch back later (or never).  If you use the `C-x m' command again
  573. when you have been composing another message but have not sent it, you
  574. are asked to confirm before the old message is erased.  If you answer
  575. `n', the `*mail*' buffer is left selected with its old contents, so you
  576. can finish the old message and send it.  `C-u C-x m' is another way to
  577. do this.  Sending the message marks the `*mail*' buffer "unmodified",
  578. which avoids the need for confirmation when `C-x m' is next used.
  579.    If you are composing a message in the `*mail*' buffer and want to
  580. send another message before finishing the first, rename the `*mail*'
  581. buffer using `M-x rename-buffer' (*note Misc Buffer::.).
  582. * Menu:
  583. * Format: Mail Format.    Format of the mail being composed.
  584. * Headers: Mail Headers.  Details of allowed mail header fields.
  585. * Mode: Mail Mode.        Special commands for editing mail being composed.
  586. File: emacs,  Node: Mail Format,  Next: Mail Headers,  Prev: Sending Mail,  Up: Sending Mail
  587. The Format of the Mail Buffer
  588. =============================
  589.    In addition to the "text" or contents, a message has "header fields"
  590. which say who sent it, when, to whom, why, and so on.  Some header
  591. fields such as the date and sender are created automatically after the
  592. message is sent.  Others, such as the recipient names, must be
  593. specified by you in order to send the message properly.
  594.    Mail mode provides a few commands to help you edit some header
  595. fields, and some are preinitialized in the buffer automatically at
  596. times.  You can insert or edit any header fields using ordinary editing
  597. commands.
  598.    The line in the buffer that says
  599.      --text follows this line--
  600. is a special delimiter that separates the headers you have specified
  601. from the text.  Whatever follows this line is the text of the message;
  602. the headers precede it.  The delimiter line itself does not appear in
  603. the message actually sent.  The text used for the delimiter line is
  604. controlled by the variable `mail-header-separator'.
  605.    Here is an example of what the headers and text in the `*mail*'
  606. buffer might look like.
  607.      To: rms@mc
  608.      CC: mly@mc, rg@oz
  609.      Subject: The Emacs Manual
  610.      --Text follows this line--
  611.      Please ignore this message.
  612. File: emacs,  Node: Mail Headers,  Next: Mail Mode,  Prev: Mail Format,  Up: Sending Mail
  613. Mail Header Fields
  614. ==================
  615.    There are several header fields you can use in the `*mail*' buffer.
  616. Each header field starts with a field name at the beginning of a line,
  617. terminated by a colon.  It does not matter whether you use upper or
  618. lower case in the field name.  After the colon and optional whitespace
  619. comes the contents of the field.
  620.      This field contains the mailing addresses to which the message is
  621.      addressed.
  622. `Subject'
  623.      The contents of the `Subject' field should be a piece of text that
  624.      says what the message is about.  The reason `Subject' fields are
  625.      useful is that most mail-reading programs can provide a summary of
  626.      messages, listing the subject of each message but not its text.
  627.      This field contains additional mailing addresses to send the
  628.      message to, but whose readers should not regard the message as
  629.      addressed to them.
  630. `BCC'
  631.      This field contains additional mailing addresses to send the
  632.      message to, but which should not appear in the header of the
  633.      message actually sent.
  634. `FCC'
  635.      This field contains the name of one file (in Unix mail file
  636.      format) to which a copy of the message should be appended when the
  637.      message is sent.
  638. `From'
  639.      Use the `From' field to say who you are, when the account you are
  640.      using to send the mail is not your own.  The contents of the
  641.      `From' field should be a valid mailing address, since replies will
  642.      normally go there.
  643. `Reply-To'
  644.      Use the `Reply-to' field to direct replies to a different address,
  645.      not your own.  There is no difference between `From' and
  646.      `Reply-to' in their effect on where replies go, but they convey a
  647.      different meaning to the human who reads the message.
  648. `In-Reply-To'
  649.      This field contains a piece of text describing a message you are
  650.      replying to.  Some mail systems can use this information to
  651.      correlate related pieces of mail.  Normally this field is filled
  652.      in by Rmail when you are replying to a message in Rmail, and you
  653.      never need to think about it (*note Rmail::.).
  654. The `To', `CC', `BCC' and `FCC' fields can appear any number of times,
  655. to specify many places to send the message.
  656. The `To', `CC', and `BCC' fields can have continuation lines.  All the
  657. lines starting with whitespace, following the line on which the field
  658. starts, are considered part of the field.  For example,
  659.      To: foo@here, this@there,
  660.        me@gnu.cambridge.mass.usa.earth.spiral3281
  661. If you have a `~/.mailrc' file, Emacs will scan it for mail aliases the
  662. first time you try to send mail in an Emacs session.  Aliases found in
  663. the `To', `CC', and `BCC' fields will be expanded where appropriate.
  664.    If the variable `mail-archive-file-name' is non-`nil', it should be a
  665. string naming a file; every time you start to edit a message to send,
  666. an `FCC' field will be put in for that file.  Unless you remove the
  667. `FCC' field, every message will be written into that file when it is
  668. sent.
  669. File: emacs,  Node: Mail Mode,  Prev: Mail Headers,  Up: Sending Mail
  670. Mail Mode
  671. =========
  672.    The major mode used in the `*mail*' buffer is Mail mode, which is
  673. much like Text mode except that various special commands are provided on
  674. the `C-c' prefix.  These commands all have to do specifically with
  675. editing or sending the message.
  676. `C-c C-s'
  677.      Send the message, and leave the `*mail*' buffer selected
  678.      (`mail-send').
  679. `C-c C-c'
  680.      Send the message, and select some other buffer
  681.      (`mail-send-and-exit').
  682. `C-c C-f C-t'
  683.      Move to the `To' header field, creating one if there is none
  684.      (`mail-to').
  685. `C-c C-f C-s'
  686.      Move to the `Subject' header field, creating one if there is none
  687.      (`mail-subject').
  688. `C-c C-f C-c'
  689.      Move to the `CC' header field, creating one if there is none
  690.      (`mail-cc').
  691. `C-c C-w'
  692.      Insert the file `~/.signature' at the end of the message text
  693.      (`mail-signature').
  694. `C-c C-y'
  695.      Yank the selected message from Rmail (`mail-yank-original'). This
  696.      command does nothing unless your command to start sending a
  697.      message was issued with Rmail.
  698. `C-c C-q'
  699.      Fill all paragraphs of yanked old messages, each individually
  700.      (`mail-fill-yanked-message').
  701.    There are two ways to send the message.  `C-c C-s' (`mail-send')
  702. sends the message and marks the `*mail*' buffer unmodified, but leaves
  703. that buffer selected so that you can modify the message (perhaps with
  704. new recipients) and send it again.  `C-c C-c' (`mail-send-and-exit')
  705. sends and then deletes the window (if there is another window) or
  706. switches to another buffer.  It puts the `*mail*' buffer at the lowest
  707. priority for automatic reselection, since you are finished with using
  708. it.  This is the usual way to send the message.
  709.    Mail mode provides some other special commands that are useful for
  710. editing the headers and text of the message before you send it.  There
  711. are three commands defined to move point to particular header fields,
  712. all based on the prefix `C-c C-f' (`C-f' is for "field").  They are
  713. `C-c C-f C-t' (`mail-to') to move to the `To' field, `C-c C-f C-s'
  714. (`mail-subject') for the `Subject' field, and `C-c C-f C-c' (`mail-cc')
  715. for the `CC' field.  These fields have special motion commands because
  716. they are the most common fields for the user to want to edit.
  717.    `C-c C-w' (`mail-signature') adds a standard piece text at the end
  718. of the message to say more about who you are.  The text comes from the
  719. file `.signature' in your home directory.
  720.    When mail sending is invoked from the Rmail mail reader using an
  721. Rmail command, `C-c C-y' can be used inside the `*mail*' buffer to
  722. insert the text of the message you are replying to.  Normally it
  723. indents each line of that message four spaces and eliminates most
  724. header fields.  A numeric argument specifies the number of spaces to
  725. indent.  An argument of just `C-u' says not to indent at all and not to
  726. eliminate anything. `C-c C-y' always uses the current message from the
  727. `RMAIL' buffer, so you can insert several old messages by selecting one
  728. in `RMAIL', switching to `*mail*' and yanking it, then switching back to
  729. `RMAIL' to select another.
  730.    After using `C-c C-y', the command `C-c C-q'
  731. (`mail-fill-yanked-message') can be used to fill the paragraphs of the
  732. yanked old message or messages.  One use of `C-c C-q' fills all such
  733. paragraphs, each one separately.
  734.    Turning on Mail mode (which `C-x m' does automatically) calls the
  735. value of `text-mode-hook', if it is not void or `nil', and then calls
  736. the value of `mail-mode-hook' if that is not void or `nil'.
  737. File: emacs,  Node: Rmail,  Next: Recursive Edit,  Prev: Sending Mail,  Up: Top
  738. Reading Mail with Rmail
  739. ***********************
  740.    Rmail is an Emacs subsystem for reading and disposing of mail that
  741. you receive.  Rmail stores mail messages in files called Rmail files. 
  742. Reading the message in an Rmail file is done in a special major mode,
  743. Rmail mode, which redefines most letters to run commands for managing
  744. mail.  To enter Rmail, type `M-x rmail'.  This reads your primary mail
  745. file, merges new mail in from your inboxes, displays the first new
  746. message, and lets you begin reading.
  747.    Using Rmail in the simplest fashion, you have one Rmail file
  748. `~/RMAIL' in which all of your mail is saved.  It is called your
  749. "primary mail file".  In more sophisticated usage, you can copy
  750. messages into other Rmail files and then edit those files with Rmail.
  751.    Rmail displays only one message at a time.  It is called the "current
  752. message".  Rmail mode's special commands can do such things as move to
  753. another message, delete the message, copy the message into another
  754. file, or send a reply.
  755.    Within the Rmail file, messages are arranged sequentially in order
  756. of receipt.  They are also assigned consecutive integers as their
  757. "message numbers".  The number of the current message is displayed in
  758. Rmail's mode line, followed by the total number of messages in the
  759. file.  You can move to a message by specifying its message number using
  760. the `j' key (*note Rmail Motion::.).
  761.    Following the usual conventions of Emacs, changes in an Rmail file
  762. become permanent only when the file is saved.  You can do this with `s'
  763. (`rmail-save'), which also expunges deleted messages from the file
  764. first (*note Rmail Deletion::.).  To save the file without expunging,
  765. use `C-x C-s'.  Rmail saves the Rmail file spontaneously when moving new
  766. mail from an inbox file (*note Rmail Inbox::.).
  767.    You can exit Rmail with `q' (`rmail-quit'); this expunges and saves
  768. the Rmail file and then switches to another buffer.  But there is no
  769. need to `exit' formally.  If you switch from Rmail to editing in other
  770. buffers, and never happen to switch back, you have exited.  Just make
  771. sure to save the Rmail file eventually (like any other file you have
  772. changed).  `C-x s' is a good enough way to do this (*note Saving::.).
  773. * Menu:
  774. * Scroll: Rmail Scrolling.   Scrolling through a message.
  775. * Motion: Rmail Motion.      Moving to another message.
  776. * Deletion: Rmail Deletion.  Deleting and expunging messages.
  777. * Inbox: Rmail Inbox.        How mail gets into the Rmail file.
  778. * Files: Rmail Files.        Using multiple Rmail files.
  779. * Output: Rmail Output.         Copying message out to files.
  780. * Labels: Rmail Labels.      Classifying messages by labeling them.
  781. * Summary: Rmail Summary.    Summaries show brief info on many messages.
  782. * Reply: Rmail Reply.        Sending replies to messages you are viewing.
  783. * Editing: Rmail Editing.    Editing message text and headers in Rmail.
  784. * Digest: Rmail Digest.      Extracting the messages from a digest message.
  785. File: emacs,  Node: Rmail Scrolling,  Next: Rmail Motion,  Prev: Rmail,  Up: Rmail
  786. Scrolling Within a Message
  787. ==========================
  788.    When Rmail displays a message that does not fit on the screen, it is
  789. necessary to scroll through it.  This could be done with `C-v', `M-v'
  790. and `M-<', but in Rmail scrolling is so frequent that it deserves to be
  791. easier to type.
  792. `SPC'
  793.      Scroll forward (`scroll-up').
  794. `DEL'
  795.      Scroll backward (`scroll-down').
  796.      Scroll to start of message (`rmail-beginning-of-message').
  797.    Since the most common thing to do while reading a message is to
  798. scroll through it by screenfuls, Rmail makes SPC and DEL synonyms of
  799. `C-v' (`scroll-up') and `M-v' (`scroll-down')
  800.    The command `.' (`rmail-beginning-of-message') scrolls back to the
  801. beginning of the selected message.  This is not quite the same as `M-<':
  802. for one thing, it does not set the mark; for another, it resets the
  803. buffer boundaries to the current message if you have changed them.
  804. File: emacs,  Node: Rmail Motion,  Next: Rmail Deletion,  Prev: Rmail Scrolling,  Up: Rmail
  805. Moving Among Messages
  806. =====================
  807.    The most basic thing to do with a message is to read it.  The way to
  808. do this in Rmail is to make the message current.  You can make any
  809. message current given its message number using the `j' command, but the
  810. usual thing to do is to move sequentially through the file, since this
  811. is the order of receipt of messages.  When you enter Rmail, you are
  812. positioned at the first new message (new messages are those received
  813. since the previous use of Rmail), or at the last message if there are
  814. no new messages this time.  Move forward to see the other new messages;
  815. move backward to reexamine old messages.
  816.      Move to the next nondeleted message, skipping any intervening
  817.      deleted
  818.      messages (`rmail-next-undeleted-message').
  819.      Move to the previous nondeleted message
  820.      (`rmail-previous-undeleted-message').
  821. `M-n'
  822.      Move to the next message, including deleted messages
  823.      (`rmail-next-message').
  824. `M-p'
  825.      Move to the previous message, including deleted messages
  826.      (`rmail-previous-message').
  827.      Move to the first message.  With argument N, move to message
  828.      number N (`rmail-show-message').
  829.      Move to the last message (`rmail-last-message').
  830. `M-s REGEXP RET'
  831.      Move to the next message containing a match for REGEXP
  832.      (`rmail-search').  If REGEXP is empty, the last regexp used is
  833.      used again.
  834. `- M-s REGEXP RET'
  835.      Move to the previous message containing a match for REGEXP. If
  836.      REGEXP is empty, the last regexp used is used again.
  837.    `n' and `p' are the usual way of moving among messages in Rmail. 
  838. They move through the messages sequentially, but skip over deleted
  839. messages, which is usually what you want to do.  Their command
  840. definitions are named `rmail-next-undeleted-message' and
  841. `rmail-previous-undeleted-message'.  If you do not want to skip deleted
  842. messages--for example, if you want to move to a message to undelete
  843. it--use the variants `M-n' and `M-p' (`rmail-next-message' and
  844. `rmail-previous-message').  A numeric argument to any of these commands
  845. serves as a repeat count.
  846.    In Rmail, you can specify a numeric argument by typing the digits.
  847. It is not necessary to type `C-u' first.
  848.    The `M-s' (`rmail-search') command is Rmail's version of search.  The
  849. usual incremental search command `C-s' works in Rmail, but it searches
  850. only within the current message.  The purpose of `M-s' is to search for
  851. another message.  It reads a regular expression (*note Regexps::.)
  852. nonincrementally, then searches starting at the beginning of the
  853. following message for a match.  The message containing the match is
  854. selected.
  855.    To search backward in the file for another message, give `M-s' a
  856. negative argument.  In Rmail this can be done with `- M-s'.
  857.    It is also possible to search for a message based on labels. *Note
  858. Rmail Labels::.
  859.    To move to a message specified by absolute message number, use `j'
  860. (`rmail-show-message') with the message number as argument.  With no
  861. argument, `j' selects the first message.  `>' (`rmail-last-message')
  862. selects the last message.
  863.