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

  1. Info file emacs, produced by texinfo-format-buffer   -*-Text-*-
  2. from file emacs.tex
  3.  
  4. This file documents the GNU Emacs editor.
  5.  
  6. Copyright (C) 1985, 1986 Richard M. Stallman.
  7.  
  8. Permission is granted to make and distribute verbatim copies of
  9. this manual provided the copyright notice and this permission notice
  10. are preserved on all copies.
  11.  
  12. Permission is granted to copy and distribute modified versions of this
  13. manual under the conditions for verbatim copying, provided also that the
  14. sections entitled "The GNU Manifesto", "Distribution" and "GNU Emacs
  15. General Public License" are included exactly as in the original, and
  16. provided that the entire resulting derived work is distributed under the
  17. terms of a permission notice identical to this one.
  18.  
  19. Permission is granted to copy and distribute translations of this manual
  20. into another language, under the above conditions for modified versions,
  21. except that the sections entitled "The GNU Manifesto", "Distribution"
  22. and "GNU Emacs General Public License" may be included in a translation
  23. approved by the author instead of in the original English.
  24.  
  25. 
  26. File: emacs  Node: Top, Up: (DIR), Next: Distrib
  27.  
  28. The Emacs Editor
  29. ****************
  30.  
  31. Emacs is the extensible, customizable, self-documenting real-time
  32. display editor.  This Info file describes how to edit with Emacs
  33. and some of how to customize it, but not how to extend it.
  34.  
  35. * Menu:
  36.  
  37. * Distrib::     How to get the latest Emacs distribution.
  38. * License::     The GNU Emacs General Public License gives you permission
  39.         to redistribute GNU Emacs on certain terms; and also
  40.         explains that there is no warranty.
  41. * Intro::       An introduction to Emacs concepts.
  42. * Glossary::    The glossary.
  43. * Manifesto::   What's GNU?  Gnu's Not Unix!
  44.  
  45. Indexes, nodes containing large menus
  46. * Key Index::      An item for each standard Emacs key sequence.
  47. * Command Index::  An item for each command name.
  48. * Variable Index:: An item for each documented variable.
  49. * Concept Index::  An item for each concept.
  50.  
  51. Important General Concepts
  52. * Screen::      How to interpret what you see on the screen.
  53. * Characters::  Emacs's character sets for file contents and for keyboard.
  54. * Keys::        Key sequences: what you type to request one editing action.
  55. * Commands::    Commands: named functions run by key sequences to do editing.
  56. * Entering Emacs::    Starting Emacs from the shell.
  57. * Command Switches::  Hairy startup options.
  58. * Exiting::     Stopping or killing Emacs.
  59. * Basic::       The most basic editing commands.
  60. * Undo::        Undoing recently made changes in the text.
  61. * Minibuffer::  Entering arguments that are prompted for.
  62. * M-x::         Invoking commands by their names.
  63. * Help::        Commands for asking Emacs about its commands.
  64.  
  65. Important Text-Changing Commands
  66. * Mark::        The mark: how to delimit a "region" of text.
  67. * Killing::     Killing text.
  68. * Yanking::     Recovering killed text.  Moving text.
  69. * Accumulating Text::
  70.                 Other ways of copying text.
  71. * Rectangles::  Operating on the text inside a rectangle on the screen.
  72. * Registers::   Saving a text string or a location in the buffer.
  73. * Display::     Controlling what text is displayed.
  74. * Search::      Finding or replacing occurrences of a string.
  75. * Fixit::       Commands especially useful for fixing typos.
  76.  
  77. Larger Units of Text
  78. * Files::       All about handling files.
  79. * Buffers::     Multiple buffers; editing several files at once.
  80. * Windows::     Viewing two pieces of text at once.
  81.  
  82. Advanced Features
  83. * Major Modes:: Text mode vs. Lisp mode vs. C mode ...
  84. * Indentation:: Editing the white space at the beginnings of lines.
  85. * Text::        Commands and modes for editing English.
  86. * Programs::    Commands and modes for editing programs.
  87. * Running::     Compiling, running and debugging programs.
  88. * Abbrevs::     How to define text abbreviations to reduce
  89.                  the number of characters you must type.
  90. * Picture::     Editing pictures made up of characters
  91.                  using the quarter-plane screen model.
  92. * Sending Mail::Sending mail in Emacs.
  93. * Rmail::       Reading mail in Emacs.
  94. * Recursive Edit::
  95.                 A command can allow you to do editing
  96.                  "within the command".  This is called a
  97.                  `recursive editing level'.
  98. * Narrowing::   Restricting display and editing to a portion
  99.                  of the buffer.
  100. * Sorting::    Sorting lines, paragraphs or pages within Emacs.
  101. * Shell::       Executing shell commands from Emacs.
  102. * Hardcopy::    Printing buffers or regions.
  103. * Dissociated Press::  Dissociating text for fun.
  104. * Amusements::         Various games and hacks.
  105. * Emulation::           Emulating some other editors with Emacs.
  106. * Customization::      Modifying the behavior of Emacs.
  107.  
  108. Recovery from Problems.
  109. * Quitting::    Quitting and aborting.
  110. * Lossage::     What to do if Emacs is hung or malfunctioning.
  111. * Bugs::        How and when to report a bug.
  112.  
  113. Here are some other nodes which are really inferiors of the ones
  114. already listed, mentioned here so you can get to them in one step:
  115.  
  116. Subnodes of Screen
  117. * Point::    The place in the text where editing commands operate.
  118. * Echo Area::   Short messages appear at the bottom of the screen.
  119. * Mode Line::    Interpreting the mode line.
  120.  
  121. Subnodes of Basic
  122. * Blank Lines:: Commands to make or delete blank lines.
  123. * Continuation Lines:: Lines too wide for the screen.
  124. * Position Info::      What page, line, row, or column is point on?
  125. * Arguments::          Giving numeric arguments to commands.
  126.  
  127. Subnodes of Minibuffer
  128. * Minibuffer File::    Entering file names with the minibuffer.
  129. * Minibuffer Edit::    How to edit in the minibuffer.
  130. * Completion::  An abbreviation facility for minibuffer input.
  131. * Repetition::  Re-executing previous commands that used the minibuffer.
  132.  
  133. Subnodes of Mark
  134. * Setting Mark::       Commands to set the mark.
  135. * Using Region::       Summary of ways to operate on contents of the region.
  136. * Marking Objects::    Commands to put region around textual units.
  137. * Mark Ring::          Previous mark positions saved so you can go back there.
  138.  
  139. Subnodes of Yanking
  140. * Kill Ring::          Where killed text is stored.  Basic yanking.
  141. * Appending Kills::    Several kills in a row all yank together.
  142. * Earlier Kills::      Yanking something killed some time ago.
  143.  
  144. Subnodes of Registers
  145. * RegPos::             Saving positions in registers.
  146. * RegText::            Saving text in registers.
  147. * RegRect::            Saving rectangles in registers.
  148.  
  149. Subnodes of Display
  150. * Scrolling::               Moving text up and down in a window.
  151. * Horizontal Scrolling::   Moving text left and right in a window.
  152. * Selective Display::      Hiding lines with lots of indentation.
  153. * Display Vars::           Information on variables for customizing display.
  154.  
  155. Subnodes of Search
  156. * Incremental Search::     Search happens as you type the string.
  157. * Nonincremental Search::  Specify entire string and then search.
  158. * Word Search::        Search for sequence of words.
  159. * Regexp Search::       Search for match for a regexp.
  160. * Regexps::            Syntax of regular expressions.
  161. * Search Case::           To ignore case while searching, or not.
  162. * Replace::            Search, and replace some or all matches.
  163. * Unconditional Replace::  Everything about replacement except for querying.
  164. * Query Replace::          How to use querying.
  165. * Other Repeating Search:: Operating on all matches for some regexp.
  166.  
  167. Subnodes of Fixit
  168. * Kill Errors:: Commands to kill a batch of recently entered text.
  169. * Transpose::   Exchanging two characters, words, lines, lists...
  170. * Fixing Case:: Correcting case of last word entered.
  171. * Spelling::    Apply spelling checker to a word, or a whole file.
  172.  
  173. Subnodes of Files
  174. * File Names::  How to type and edit file name arguments.
  175. * Visiting::    Visiting a file prepares Emacs to edit the file.
  176. * Saving::      Saving makes your changes permanent.
  177. * Backup::      How Emacs saves the old version of your file.
  178. * Interlocking::How Emacs protects against simultaneous editing
  179.                  of one file by two users.
  180. * Reverting::   Reverting cancels all the changes not saved.
  181. * Auto Save::   Auto Save periodically protects against loss of data.
  182. * ListDir::     Listing the contents of a file directory.
  183. * Dired::       "Editing" a directory to delete, rename, etc.
  184.                  the files in it.
  185. * Misc File Ops:: Other things you can do on files.
  186.  
  187. Subnodes of Buffers
  188. * Select Buffer::   Creating a new buffer or reselecting an old one.
  189. * List Buffers::    Getting a list of buffers that exist.
  190. * Misc Buffer::     Renaming; changing read-only status.
  191. * Kill Buffer::     Killing buffers you no longer need.
  192. * Several Buffers:: How to go through the list of all buffers
  193.                      and operate variously on several of them.
  194.  
  195. Subnodes of Windows
  196. * Basic Window::    Introduction to Emacs windows.
  197. * Split Window::    New windows are made by splitting existing windows.
  198. * Other Window::    Moving to another window or doing something to it.
  199. * Pop Up Window::   Finding a file or buffer in another window.
  200. * Change Window::   Deleting windows and changing their sizes.
  201.  
  202. Subnodes of Indentation
  203. * Indentation Commands:: Various commands and techniques for indentation.
  204. * Tab Stops::   You can set arbitrary "tab stops" and then
  205.                  indent to the next tab stop when you want to.
  206. * Just Spaces:: You can request indentation using just spaces.
  207.  
  208. Subnodes of Text
  209. * Text Mode::   The major mode for editing text files.
  210. * Nroff Mode::  The major mode for editing input to the formatter nroff.
  211. * TeX Mode::    The major mode for editing input to the formatter TeX.
  212. * Outline Mode::The major mode for editing outlines.
  213. * Words::       Moving over and killing words.
  214. * Sentences::   Moving over and killing sentences.
  215. * Paragraphs::    Moving over paragraphs.
  216. * Pages::    Moving over pages.
  217. * Filling::     Filling or justifying text
  218. * Case::        Changing the case of text
  219.  
  220. Subnodes of Programs
  221. * Program Modes::       Major modes for editing programs.
  222. * Lists::       Expressions with balanced parentheses.
  223.                  There are editing commands to operate on them.
  224. * Defuns::      Each program is made up of separate functions.
  225.                  There are editing commands to operate on them.
  226. * Grinding::    Adjusting indentation to show the nesting.
  227. * Matching::    Insertion of a close-delimiter flashes matching open.
  228. * Comments::    Inserting, illing and aligning comments.
  229. * Balanced Editing::    Inserting two matching parentheses at once, etc.
  230. * Lisp Completion::     Completion on symbol names in Lisp code.
  231. * Documentation::       Getting documentation of functions you plan to call.
  232. * Change Log::  Maintaining a change history for your program.
  233. * Tags::        Go direct to any function in your program in one
  234.                  command.  Tags remembers which file it is in.
  235. * Fortran::    Fortran mode and its special features.
  236.  
  237. Subnodes of Running
  238. * Compilation::       Compiling programs in languages other than Lisp
  239.                        (C, Pascal, etc.)
  240. * Lisp Modes::        Various modes for editing Lisp programs, with
  241.                        different facilities for running the Lisp programs.
  242. * Lisp Libraries::    Creating Lisp programs to run in Emacs.
  243. * Lisp Interaction::  Executing Lisp in an Emacs buffer.
  244. * Lisp Eval::         Executing a single Lisp expression in Emacs.
  245. * Lisp Debug::        Debugging Lisp programs running in Emacs.
  246. * External Lisp::     Communicating through Emacs with a separate Lisp.
  247.  
  248. Subnodes of Abbrevs
  249. * Defining Abbrevs::  Defining an abbrev, so it will expand when typed.
  250. * Expanding Abbrevs:: Controlling expansion: prefixes, canceling expansion.
  251. * Editing Abbrevs::   Viewing or editing the entire list of defined abbrevs.
  252. * Saving Abbrevs::    Saving the entire list of abbrevs for another session.
  253. * Dynamic Abbrevs::   Abbreviations for words already in the buffer.
  254.  
  255. Subnodes of Picture
  256. * Basic Picture::     Basic concepts and simple commands of Picture Mode.
  257. * Insert in Picture:: Controlling direction of cursor motion
  258.                        after "self-inserting" characters.
  259. * Tabs in Picture::   Various features for tab stops and indentation.
  260. * Rectangles in Picture:: Clearing and superimposing rectangles.
  261.  
  262. Subnodes of Sending Mail
  263. * Mail Format::       Format of the mail being composed.
  264. * Mail Headers::      Details of allowed mail header fields.
  265. * Mail Mode::         Special commands for editing mail being composed.
  266.  
  267. Subnodes of Rmail
  268. * Rmail Scrolling::   Scrolling through a message.
  269. * Rmail Motion::      Moving to another message.
  270. * Rmail Deletion::    Deleting and expunging messages.
  271. * Rmail Inbox::       How mail gets into the Rmail file.
  272. * Rmail Files::       Using multiple Rmail files.
  273. * Rmail Output::      Copying message out to files.
  274. * Rmail Labels::      Classifying messages by labeling them.
  275. * Rmail Summary::     Summaries show brief info on many messages.
  276. * Rmail Reply::       Sending replies to messages you are viewing.
  277. * Rmail Editing::     Editing message text and headers in Rmail.
  278. * Rmail Digest::      Extracting the messages from a digest message.
  279.  
  280. Subnodes of Shell
  281. * Single Shell::      Commands to run one shell command and return.
  282. * Interactive Shell:: Permanent shell taking input via Emacs.
  283. * Shell Mode::        Special Emacs commands used with permanent shell.
  284.  
  285. Subnodes of Customization
  286. * Minor Modes::       Each minor mode is one feature you can turn on
  287.                        independently of any others.
  288. * Variables::         Many Emacs commands examine Emacs variables
  289.                        to decide what to do; by setting variables,
  290.                        you can control their functioning.
  291. * Examining::         Examining or setting one variable's value.
  292. * Edit Options::      Examining or editing list of all variables' values.
  293. * Locals::            Per-buffer values of variables.
  294. * File Variables::    How files can specify variable values.
  295. * Keyboard Macros::   A keyboard macro records a sequence of keystrokes
  296.                        to be replayed with a single command.
  297. * Key Bindings::      The keymaps say what command each key runs.
  298.                        By changing them, you can "redefine keys".
  299. * Keymaps::           Definition of the keymap data structure.
  300. * Rebinding::         How to redefine one key's meaning conveniently.
  301. * Disabling::         Disabling a command means confirmation is required
  302.                        before it can be executed.  This is done to protect
  303.                        beginners from surprises.
  304. * Syntax::            The syntax table controls how words and expressions
  305.                        are parsed.
  306. * Init File::         How to write common customizations in the `.emacs' file.
  307.  
  308. Subnodes of Lossage (and recovery)
  309. * Stuck Recursive::   `[...]' in mode line around the parentheses.
  310. * Screen Garbled::    Garbage on the screen.
  311. * Text Garbled::      Garbage in the text.
  312. * Unasked-for Search::Spontaneous entry to incremental search.
  313. * Emergency Escape::  Emergency escape---
  314.                        What to do if Emacs stops responding.
  315. * Total Frustration:: When you are at your wits' end.
  316.  
  317.  
  318. 
  319. File: emacs  Node: Distrib, Prev: Top, Up: Top, Next: License
  320.  
  321. Distribution
  322. ************
  323.  
  324. GNU Emacs is "free"; this means that everyone is free to use it and
  325. free to redistribute it on a free basis.  GNU Emacs is not in the public
  326. domain; it is copyrighted and there are restrictions on its distribution,
  327. but these restrictions are designed to permit everything that a good
  328. cooperating citizen would want to do.  What is not allowed is to try to
  329. prevent others from further sharing any version of GNU Emacs that they
  330. might get from you.  The precise conditions are found in the GNU Emacs
  331. General Public License that comes with Emacs and also appears following
  332. this section.
  333.  
  334. The easiest way to get a copy of GNU Emacs is from someone else who has it.
  335. You need not ask for permission to do so, or tell any one else; just copy
  336. it.
  337.  
  338. If you have access to the Internet, you can get the latest distribution
  339. version of GNU Emacs from host `prep.ai.mit.edu' using anonymous
  340. login.  See the file `/u2/emacs/GETTING.GNU.SOFTWARE' on that host
  341. to find out about your options for copying and which files to use.
  342.  
  343. You may also receive GNU Emacs when you buy a computer.  Computer
  344. manufacturers are free to distribute copies on the same terms that apply to
  345. everyone else.  These terms require them to give you the full sources,
  346. including whatever changes they may have made, and to permit you to
  347. redistribute the GNU Emacs received from them under the usual terms of the
  348. General Public License.  In other words, the program must be free for you
  349. when you get it, not just free for the manufacturer.
  350.  
  351. If you cannot get a copy in any of those ways, you can order one from the
  352. Free Software Foundation.  Though Emacs itself is free, our distribution
  353. service is not.  An order form is included at the end of manuals printed by
  354. the Foundation.  It is also included in the file `etc/DISTRIB' in the
  355. Emacs distribution.  For further information, write to
  356.  
  357.      Free Software Foundation
  358.      675 Mass Ave
  359.      Cambridge, MA 02139
  360.      USA
  361.  
  362. The income from distribution fees goes to support the foundation's
  363. purpose: the development of more free software to distribute just like
  364. GNU Emacs.
  365.  
  366. If you find GNU Emacs useful, please send a donation to the Free
  367. Software Foundation.  This will help support development of the rest of the
  368. GNU system, and other useful software beyond that.  Your donation is tax
  369. deductible.
  370.  
  371. 
  372. File: emacs  Node: License, Prev: Distrib, Up: Top, Next: Intro
  373.  
  374. GNU Emacs General Public License
  375. ********************************
  376.                           (Clarified 11 Feb 1988)
  377.  
  378.   The license agreements of most software companies keep you at the
  379. mercy of those companies.  By contrast, our general public license is
  380. intended to give everyone the right to share GNU Emacs.  To make
  381. sure that you get the rights we want you to have, we need to make
  382. restrictions that forbid anyone to deny you these rights or to ask you
  383. to surrender the rights.  Hence this license agreement.
  384.  
  385.   Specifically, we want to make sure that you have the right to give
  386. away copies of Emacs, that you receive source code or else can get it
  387. if you want it, that you can change Emacs or use pieces of it in new
  388. free programs, and that you know you can do these things.
  389.  
  390.   To make sure that everyone has such rights, we have to forbid you to
  391. deprive anyone else of these rights.  For example, if you distribute
  392. copies of Emacs, you must give the recipients all the rights that you
  393. have.  You must make sure that they, too, receive or can get the
  394. source code.  And you must tell them their rights.
  395.  
  396.   Also, for our own protection, we must make certain that everyone
  397. finds out that there is no warranty for GNU Emacs.  If Emacs is
  398. modified by someone else and passed on, we want its recipients to know
  399. that what they have is not what we distributed, so that any problems
  400. introduced by others will not reflect on our reputation.
  401.  
  402.   Therefore we (Richard Stallman and the Free Software Foundation, Inc.)
  403. make the following terms which say what you must do to be allowed to
  404. distribute or change GNU Emacs.
  405.  
  406.  
  407. Copying Policies
  408. ================
  409.  
  410.   1. You may copy and distribute verbatim copies of GNU Emacs source code as you
  411.      receive it, in any medium, provided that you conspicuously and
  412.      appropriately publish on each file a valid copyright notice "Copyright
  413.      (C) 1988 Free Software Foundation, Inc." (or with whatever year
  414.      is appropriate); keep intact the notices on all files that
  415.      refer to this License Agreement and to the absence of any warranty; and
  416.      give any other recipients of the GNU Emacs program a copy of this License
  417.      Agreement along with the program.  You may charge a distribution fee
  418.      for the physical act of transferring a copy.
  419.      
  420.   2. You may modify your copy or copies of GNU Emacs source code or
  421.      any portion of it, and copy and distribute such modifications under
  422.      the terms of Paragraph 1 above, provided that you also do the following:
  423.      
  424.         * cause the modified files to carry prominent notices stating
  425.           who last changed such files and the date of any change; and
  426.           
  427.         * cause the whole of any work that you distribute or publish, that
  428.           in whole or in part contains or is a derivative of GNU Emacs or any
  429.           part thereof, to be licensed at no charge to all third parties on
  430.           terms identical to those contained in this License Agreement
  431.           (except that you may choose to grant more extensive warranty
  432.           protection to some or all third parties, at your option).
  433.           
  434.         * if the modified program serves as a debugger, cause it, when
  435.           started running in the simplest and usual way, to print an
  436.           announcement including a valid copyright notice "Copyright
  437.           (C) 1988 Free Software Foundation, Inc." (or with the
  438.           year that is appropriate), saying that there is no warranty (or
  439.           else, saying that you provide a warranty) and that users may
  440.           redistribute the program under these conditions, and telling the
  441.           user how to view a copy of this License Agreement.
  442.           
  443.         * You may charge a distribution fee for the physical act of
  444.           transferring a copy, and you may at your option offer warranty
  445.           protection in exchange for a fee.
  446.      
  447.      Mere aggregation of another unrelated program with this program (or its
  448.      derivative) on a volume of a storage or distribution medium does not bring
  449.      the other program under the scope of these terms.
  450.      
  451.   3. You may copy and distribute GNU Emacs (or a portion or derivative of it,
  452.      under Paragraph 2) in object code or executable form under the terms
  453.      of Paragraphs 1 and 2 above provided that you also do one of the
  454.      following:
  455.      
  456.         * accompany it with the complete corresponding machine-readable
  457.           source code, which must be distributed under the terms of
  458.           Paragraphs 1 and 2 above; or,
  459.           
  460.         * accompany it with a written offer, valid for at least three
  461.           years, to give any third party free (except for a nominal
  462.           shipping charge) a complete machine-readable copy of the
  463.           corresponding source code, to be distributed under the terms of
  464.           Paragraphs 1 and 2 above; or,
  465.           
  466.         * accompany it with the information you received as to where the
  467.           corresponding source code may be obtained.  (This alternative is
  468.           allowed only for noncommercial distribution and only if you
  469.           received the program in object code or executable form alone.)
  470.      
  471.      For an executable file, complete source code means all the source code
  472.      for all modules it contains; but, as a special exception, it need not
  473.      include source code for modules which are standard libraries that
  474.      accompany the operating system on which the executable file runs.
  475.      
  476.   4. You may not copy, sublicense, distribute or transfer GNU Emacs except
  477.      as expressly provided under this License Agreement.  Any attempt
  478.      otherwise to copy, sublicense, distribute or transfer GNU Emacs is
  479.      void and your rights to use GNU Emacs under this License agreement
  480.      shall be automatically terminated.  However, parties who have received
  481.      computer software programs from you with this License Agreement will
  482.      not have their licenses terminated so long as such parties remain in
  483.      full compliance.
  484.      
  485.   5. If you wish to incorporate parts of GNU Emacs into other free programs
  486.      whose distribution conditions are different, write to the Free Software
  487.      Foundation.  We have not yet worked out a simple rule that can be stated
  488.      here, but we will often permit this.  We will be guided by the two goals of
  489.      preserving the free status of all derivatives of our free software and of
  490.      promoting the sharing and reuse of software.
  491.  
  492. Your comments and suggestions about our licensing policies and our
  493. software are welcome!  Please contact the Free Software Foundation, Inc.,
  494. 675 Mass Ave, Cambridge, MA 02139.
  495.  
  496.  
  497. NO WARRANTY
  498. ===========
  499.  
  500.   BECAUSE GNU EMACS IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
  501. NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW.  EXCEPT
  502. WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
  503. RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE GNU EMACS "AS IS"
  504. WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
  505. BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  506. FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY
  507. AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE GNU EMACS
  508. PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  509. SERVICING, REPAIR OR CORRECTION.
  510.  
  511.  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL FREE SOFTWARE
  512. FOUNDATION, INC., RICHARD M. STALLMAN, AND/OR ANY OTHER PARTY WHO MAY
  513. MODIFY AND REDISTRIBUTE GNU EMACS AS PERMITTED ABOVE, BE LIABLE TO YOU
  514. FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR OTHER
  515. SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  516. INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
  517. BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR A
  518. FAILURE OF THE PROGRAM TO OPERATE WITH PROGRAMS NOT DISTRIBUTED BY
  519. FREE SOFTWARE FOUNDATION, INC.) THE PROGRAM, EVEN IF YOU HAVE BEEN
  520. ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY
  521. OTHER PARTY.
  522.  
  523. 
  524. File: emacs  Node: Intro, Prev: License, Up: Top, Next: Glossary
  525.  
  526. Introduction
  527. ************
  528.  
  529.   You are reading about GNU Emacs, the GNU incarnation of the advanced,
  530. self-documenting, customizable, extensible real-time display editor Emacs.
  531. (The `G' in `GNU' is not silent.)
  532.  
  533.   We say that Emacs is a "display" editor because normally the text
  534. being edited is visible on the screen and is updated automatically as you
  535. type your commands.  *Note Display: Screen.
  536.  
  537.   We call it a "real-time" editor because the display is updated very
  538. frequently, usually after each character or pair of characters you
  539. type.  This minimizes the amount of information you must keep in your
  540. head as you edit.  *Note Real-time: Basic.
  541.  
  542.   We call Emacs advanced because it provides facilities that go beyond
  543. simple insertion and deletion: filling of text; automatic indentation of
  544. programs; viewing two or more files at once; and dealing in terms of
  545. characters, words, lines, sentences, paragraphs, and pages, as well as
  546. expressions and comments in several different programming languages.  It is
  547. much easier to type one command meaning "go to the end of the paragraph"
  548. than to find that spot with simple cursor keys.
  549.  
  550.   "Self-documenting" means that at any time you can type a special
  551. character, `Control-h', to find out what your options are.  You can
  552. also use it to find out what any command does, or to find all the commands
  553. that pertain to a topic.  *Note Help::.
  554.  
  555.   "Customizable" means that you can change the definitions of Emacs
  556. commands in little ways.  For example, if you use a programming language in
  557. which comments start with `<**' and end with `**>', you can tell
  558. the Emacs comment manipulation commands to use those strings
  559. (*Note Comments::).  Another sort of customization is rearrangement of the
  560. command set.  For example, if you prefer the four basic cursor motion
  561. commands (up, down, left and right) on keys in a diamond pattern on the
  562. keyboard, you can have it.  *Note Customization::.
  563.  
  564.   "Extensible" means that you can go beyond simple customization and
  565. write entirely new commands, programs in the Lisp language to be run by
  566. Emacs's own Lisp interpreter.  Emacs is an "on-line extensible" system,
  567. which means that it is divided into many functions that call each other,
  568. any of which can be redefined in the middle of an editing session.  Any
  569. part of Emacs can be replaced without making a separate copy of all of
  570. Emacs.  Most of the editing commands of Emacs are written in Lisp already;
  571. the few exceptions could have been written in Lisp but are written in C for
  572. efficiency.  Although only a programmer can write an extension, anybody can
  573. use it afterward.
  574.  
  575. 
  576. File: emacs  Node: Screen, Prev: Concept Index, Up: Top, Next: Characters
  577.  
  578.  
  579. The Organization of the Screen
  580. ******************************
  581.  
  582.   Emacs divides the screen into several areas, each of which contains
  583. its own sorts of information.  The biggest area, of course, is the one
  584. in which you usually see the text you are editing.
  585.  
  586.   When you are using Emacs, the screen is divided into a number of
  587. "windows".  Initially there is one text window occupying all but the
  588. last line, plus the special "echo area" or "minibuffer window" in
  589. the last line.  The text window can be subdivided horizontally or
  590. vertically into multiple text windows, each of which can be used for a
  591. different file (*Note Windows::).  The window that the cursor is in is the
  592. "selected window", in which editing takes place.  The other windows are
  593. just for reference unless you select one of them.
  594.  
  595.   Each text window's last line is a "mode line" which describes what is
  596. going on in that window.  It is in inverse video if the terminal supports
  597. that, and contains text that starts like `-----Emacs: SOMETHING'.  Its
  598. purpose is to indicate what buffer is being displayed above it in the
  599. window; what major and minor modes are in use; and whether the buffer's
  600. text has been changed.
  601.  
  602. * Menu:
  603.  
  604. * Point::    The place in the text where editing commands operate.
  605. * Echo Area::   Short messages appear at the bottom of the screen.
  606. * Mode Line::    Interpreting the mode line.
  607.  
  608. 
  609. File: emacs  Node: Point, Prev: Screen, Up: Screen, Next: Echo Area
  610.  
  611. Point
  612. =====
  613.  
  614.   When Emacs is running, the terminal's cursor shows the location at
  615. which editing commands will take effect.  This location is called
  616. "point".  Other commands move point through the text, so that you
  617. can edit at different places in it.
  618.  
  619.   While the cursor appears to point AT a character, point should be
  620. thought of as BETWEEN two characters; it points BEFORE the character
  621. that the cursor appears on top of.  Sometimes people speak of "the
  622. cursor" when they mean "point", or speak of commands that move point as
  623. "cursor motion" commands.
  624.  
  625.   Terminals have only one cursor, and when output is in progress it must
  626. appear where the typing is being done.  This does not mean that point is
  627. moving.  It is only that Emacs has no way to show you the location of point
  628. except when the terminal is idle.
  629.  
  630.   If you are editing several files in Emacs, each file has its own point
  631. location.  A file that is not being displayed remembers where point is so
  632. that it can be seen when you look at that file again.
  633.  
  634.   When there are multiple text windows, each window has its own point
  635. location.  The cursor shows the location of point in the selected window.
  636. This also is how you can tell which window is selected.  If the same buffer
  637. appears in more than one window, point can be moved in each window
  638. independently.
  639.  
  640.   The term `point' comes from the character `.', which was the
  641. command in TECO (the language in which the original Emacs was written)
  642. for accessing the value now called `point'.
  643.  
  644. 
  645. File: emacs  Node: Echo Area, Prev: Point, Up: Screen, Next: Mode Line
  646.  
  647. The Echo Area
  648. =============
  649.  
  650.   The line at the bottom of the screen (below the mode line) is the
  651. "echo area".  It is used to display small amounts of text for several
  652. purposes.
  653.  
  654.   "Echoing" means printing out the characters that you type.  Emacs
  655. never echoes single-character commands, and multi-character commands are
  656. echoed only if you pause while typing them.  As soon as you pause for more
  657. than a second in the middle of a command, all the characters of the command
  658. so far are echoed.  This is intended to "prompt" you for the rest of
  659. the command.  Once echoing has started, the rest of the command is echoed
  660. immediately when you type it.  This behavior is designed to give confident
  661. users fast response, while giving hesitant users maximum feedback.  You
  662. can change this behavior by setting a variable (*Note Display Vars::).
  663.  
  664.   If a command cannot be executed, it may print an "error message" in
  665. the echo area.  Error messages are accompanied by a beep or by flashing the
  666. screen.  Also, any input you have typed ahead is thrown away when an error
  667. happens.
  668.  
  669.   Some commands print informative messages in the echo area.  These
  670. messages look much like error messages, but they are not announced with a
  671. beep and do not throw away input.  Sometimes the message tells you what the
  672. command has done, when this is not obvious from looking at the text being
  673. edited.  Sometimes the sole purpose of a command is to print a message
  674. giving you specific information.  For example, the command `C-x =' is
  675. used to print a message describing the character position of point in the
  676. text and its current column in the window.  Commands that take a long time
  677. often display messages ending in `...' while they are working, and
  678. add `done' at the end when they are finished.
  679.  
  680.   The echo area is also used to display the "minibuffer", a window that
  681. is used for reading arguments to commands, such as the name of a file to be
  682. edited.  When the minibuffer is in use, the echo area begins with a prompt
  683. string that usually ends with a colon; also, the cursor appears in that line
  684. because it is the selected window.  You can always get out of the
  685. minibuffer by typing `C-g'.  *Note Minibuffer::.
  686.  
  687. 
  688. File: emacs  Node: Mode Line, Prev: Echo Area, Up: Screen
  689.  
  690. The Mode Line
  691. =============
  692.  
  693.   Each text window's last line is a "mode line" which describes what is
  694. going on in that window.  When there is only one text window, the mode line
  695. appears right above the echo area.  The mode line is in inverse video if
  696. the terminal supports that, starts and ends with dashes, and contains text
  697. like `Emacs: SOMETHING'.
  698.  
  699.   If a mode line has something else in place of `Emacs: SOMETHING',
  700. then the window above it is in a special subsystem such as Dired.  The mode
  701. line then indicates the status of the subsystem.
  702.  
  703.   Normally, the mode line has the following appearance:
  704.  
  705.      --CH-Emacs: BUF      (MAJOR MINOR)----POS------
  706.  
  707. This gives information about the buffer being displayed in the window: the
  708. buffer's name, what major and minor modes are in use, whether the buffer's
  709. text has been changed, and how far down the buffer you are currently
  710. looking.
  711.  
  712.   CH contains two stars `**' if the text in the buffer has been
  713. edited (the buffer is "modified"), or `--' if the buffer has not been
  714. edited.  Exception: for a read-only buffer, it is `%%'.
  715.  
  716.   BUF is the name of the window's chosen "buffer".  The chosen buffer
  717. in the selected window (the window that the cursor is in) is also Emacs's
  718. selected buffer, the one that editing takes place in.  When we speak of
  719. what some command does to "the buffer", we are talking about the
  720. currently selected buffer.  *Note Buffers::.
  721.  
  722.   POS tells you whether there is additional text above the top of the
  723. screen, or below the bottom.  If your file is small and it is all on the
  724. screen, POS is `All'.  Otherwise, it is `Top' if you are looking at the
  725. beginning of the file, `Bot' if you are looking at the end of the file, or
  726. `NN%', where NN is the percentage of the file above the top of the screen.
  727.  
  728.   MAJOR is the name of the "major mode" in effect in the buffer.  At any
  729. time, each buffer is in one and only one of the possible major modes.  The
  730. major modes available include Fundamental mode (the least specialized),
  731. Text mode, Lisp mode, and C mode.  *Note Major Modes::, for details of how
  732. the modes differ and how to select one.
  733.  
  734.   MINOR is a list of some of the "minor modes" that are turned on
  735. at the moment in the window's chosen buffer.  `Fill' means that Auto
  736. Fill mode is on.  `Abbrev' means that Word Abbrev mode is on.
  737. `Ovwrt' means that Overwrite mode is on.  *Note Minor Modes::, for more
  738. information.  `Narrow' means that the buffer being displayed has
  739. editing restricted to only a portion of its text.  This is not really a
  740. minor mode, but is like one.  *Note Narrowing::.  `Def' means that a
  741. keyboard macro is being defined.  *Note Keyboard Macros::.
  742.  
  743.   Some buffers display additional information after the minor modes.  For
  744. example, Rmail buffers display the current message number and the total
  745. number of messages.  Compilation buffers and Shell mode display the status
  746. of the subprocess.
  747.  
  748.   In addition, if Emacs is currently inside a recursive editing level,
  749. square brackets (`[...]') appear around the parentheses that surround the
  750. modes.  If Emacs is in one recursive editing level within another, double
  751. square brackets appear, and so on.  Since this information pertains to
  752. Emacs in general and not to any one buffer, the square brackets appear in
  753. every mode line on the screen or not in any of them.  *Note Recursive
  754. Edit::.
  755.  
  756.   Emacs can optionally display the time and system load in all mode lines.
  757. To enable this feature, type `M-x display-time'.  The information added
  758. to the mode line usually appears after the file name, before the mode names
  759. and their parentheses.  It looks like this:
  760.  
  761.      HH:MMpm L.LL [D]
  762.  
  763. (Some fields may be missing if your operating system cannot support them.)
  764. HH and MM are the hour and minute, followed always by `am'
  765. or `pm'.  L.LL is the average number of running processes in the
  766. whole system recently.  D is an approximate index of the ratio of
  767. disk activity to cpu activity for all users.
  768.  
  769. The word `Mail' appears after the load level if there is mail for
  770. you that you have not read yet.
  771.  
  772.   Customization note: the variable `mode-line-inverse-video' controls
  773. whether the mode line is displayed in inverse video (assuming the terminal
  774. supports it); `nil' means no inverse video.  The default is `t'.
  775.  
  776.  
  777. 
  778. File: emacs  Node: Characters, Prev: Screen, Up: Top, Next: Keys
  779.  
  780. The Emacs Character Set
  781. =======================
  782.  
  783.   GNU Emacs uses the ASCII character set, which defines 128 different
  784. character codes.  Some of these codes are assigned graphic symbols such as
  785. `a' and `='; the rest are control characters, such as `Control-a' (also
  786. called `C-a' for short).  `C-a' gets its name from the fact that you type
  787. it by holding down the CTRL key and then pressing `a'.  There is no
  788. distinction between `C-a' and `C-A'; they are the same character.
  789.  
  790.   Some control characters have special names, and special keys you can type
  791. them with: RET, TAB, LFD, DEL and ESC.  The space character is usually
  792. referred to below as SPC, even though strictly speaking it is a graphic
  793. character whose graphic happens to be blank.
  794.  
  795.   Emacs extends the 7-bit ASCII code to an 8-bit code by adding an extra
  796. bit to each character.  This makes 256 possible command characters.  The
  797. additional bit is called Meta.  Any ASCII character can be made Meta;
  798. examples of Meta characters include `Meta-a' (`M-a', for short), `M-A' (not
  799. the same character as `M-a', but those two characters normally have the
  800. same meaning in Emacs), `M-RET', and `M-C-a'.  For traditional reasons,
  801. `M-C-a' is usually called `C-M-a'; logically speaking, the order in which
  802. the modifier keys CTRL and META are mentioned does not matter.
  803.  
  804.   Some terminals have a META key, and allow you to type Meta characters by
  805. holding this key down.  Thus, `Meta-a' is typed by holding down META and
  806. pressing `a'.  The META key works much like the SHIFT key.  Such a key is
  807. not always labeled META, however, as this function is often a special
  808. option for a key with some other primary purpose.
  809.  
  810.   If there is no META key, you can still type Meta characters using
  811. two-character sequences starting with ESC.  Thus, to enter `M-a', you could
  812. type `ESC a'.  To enter `C-M-a', you would type `ESC C-a'.  ESC is allowed
  813. on terminals with Meta keys, too, in case you have formed a habit of using
  814. it.
  815.  
  816.   Emacs believes the terminal has a META key if the variable
  817. `meta-flag' is non-`nil'.  Normally this is set automatically
  818. according to the termcap entry for your terminal type.  However, sometimes
  819. the termcap entry is wrong, and then it is useful to set this variable
  820. yourself.  *Note Variables::, for how to do this.
  821.  
  822.   Emacs buffers also use an 8-bit character set, because bytes have 8 bits,
  823. but only the ASCII characters are considered meaningful.  ASCII graphic
  824. characters in Emacs buffers are displayed with their graphics.  LFD
  825. is the same as a newline character; it is displayed by starting a new line.
  826. TAB is displayed by moving to the next tab stop column (usually every
  827. 8 columns).  Other control characters are displayed as a caret (`^')
  828. followed by the non-control version of the character; thus, `C-a' is
  829. displayed as `^A'.  Non-ASCII characters 128 and up are displayed with
  830. octal escape sequences; thus, character code 243 (octal), also called
  831. `M-#' when used as an input character, is displayed as `\243'.
  832.  
  833. 
  834. File: emacs  Node: Keys, Prev: Characters, Up: Top, Next: Commands
  835.  
  836. Keys
  837. ====
  838.  
  839.   A "complete key"---where `key' is short for "key sequence"---is a
  840. sequence of keystrokes that are understood by Emacs as a unit, as a single
  841. command (possibly undefined).  Most single characters constitute complete
  842. keys in the standard Emacs command set; there are also some multi-character
  843. keys.  Examples of complete keys are `C-a', `X', RET, `C-x C-f' and `C-x 4
  844. C-f'.
  845.  
  846.   A "prefix key" is a sequence of keystrokes that are the beginning of
  847. a complete key, but not a whole one.  Prefix keys and complete keys are
  848. collectively called "keys".
  849.  
  850.   A prefix key is the beginning of a series of longer sequences that are
  851. valid keys; adding any single character to the end of the prefix gives a
  852. valid key, which could be defined as an Emacs command, or could be a prefix
  853. itself.  For example, `C-x' is standardly defined as a prefix, so
  854. `C-x' and the next input character combine to make a two-character key.
  855. There are 256 different two-character keys starting with `C-x', one for
  856. each possible second character.  Many of these two-character keys starting
  857. with `C-x' are standardly defined as Emacs commands.  Notable examples
  858. include `C-x C-f' and `C-x s' (*Note Files::).
  859.  
  860.   Adding one character to a prefix key does not have to form a complete
  861. key.  It could make another, longer prefix.  For example, `C-x 4' is itself
  862. a prefix that leads to 256 different three-character keys, including `C-x 4
  863. f', `C-x 4 b' and so on.  It would be possible to define one of those
  864. three-character sequences as a prefix, creating a series of four-character
  865. keys, but we did not define any of them this way.
  866.  
  867.   By contrast, the two-character sequence `C-f C-k' is not a key, because
  868. the `C-f' is a complete key in itself.  It's impossible to give `C-f C-k'
  869. an independent meaning as a command as long as `C-f' retains its meaning.
  870. `C-f C-k' is two commands.
  871.  
  872.   All told, the prefix keys in Emacs are `C-c', `C-x', `C-h', `C-x 4', and
  873. ESC.  But this is not built in; it is just a matter of Emacs's standard key
  874. bindings.  In customizing Emacs, you could make new prefix keys, or
  875. eliminate these.  *Note Key Bindings::.
  876.  
  877.   Whether a sequence is a key can be changed by customization.  For
  878. example, if you redefine `C-f' as a prefix, `C-f C-k' automatically
  879. becomes a key (complete, unless you define it too as a prefix).
  880. Conversely, if you remove the prefix definition of `C-x 4', then
  881. `C-x 4 f' (or `C-x 4 ANYTHING') is no longer a key.
  882.  
  883. 
  884. File: emacs  Node: Commands, Prev: Keys, Up: Top, Next: Entering Emacs
  885.  
  886. Keys and Commands
  887. =================
  888.  
  889.   This manual is full of passages that tell you what particular keys do.
  890. But Emacs does not assign meanings to keys directly.  Instead, Emacs
  891. assigns meanings to "functions", and then gives keys their meanings by
  892. "binding" them to functions. 
  893.  
  894.   A function is a Lisp object that can be executed as a program.  Usually
  895. it is a Lisp symbol which has been given a function definition; every
  896. symbol has a name, usually made of a few English words separated by dashes,
  897. such as `next-line' or `forward-word'.  It also has a
  898. "definition" which is a Lisp program; this is what makes the function
  899. do what it does.  Only some functions can be the bindings of keys; these
  900. are functions whose definitions use `interactive' to specify how to
  901. call them interactively.  Such functions are called "commands", and
  902. their names are "command names".  More information on this subject will
  903. appear in the GNU Emacs Lisp Manual (which is not yet written).
  904.  
  905.   The bindings between keys and functions are recorded in various tables
  906. called "keymaps".  *Note Keymaps::.
  907.  
  908.   When we say that "`C-n' moves down vertically one line" we are glossing
  909. over a distinction that is irrelevant in ordinary use but is vital in
  910. understanding how to customize Emacs.  It is the function `next-line' that
  911. is programmed to move down vertically.  `C-n' has this effect because it is
  912. bound to that function.  If you rebind `C-n' to the function `forward-word'
  913. then `C-n' will move forward by words instead.  Rebinding keys is a common
  914. method of customization.
  915.  
  916.   In the rest of this manual, we usually ignore this subtlety to keep
  917. things simple.  To give the customizer the information he needs, we
  918. state the name of the command which really does the work in parentheses
  919. after mentioning the key that runs it.  For example, we will say that
  920. "The command `C-n' (`next-line') moves point vertically down,"
  921. meaning that `next-line' is a command that moves vertically down
  922. and `C-n' is a key that is standardly bound to it.
  923.  
  924.   While we are on the subject of information for customization only, it's a
  925. good time to tell you about "variables".  Often the description of a
  926. command will say, "To change this, set the variable `mumble-foo'."
  927. A variable is a name used to remember a value.  Most of the variables
  928. documented in this manual exist just to facilitate customization: some
  929. command or other part of Emacs examines the variable and behaves
  930. differently accordingly.  Until you are interested in customizing, you can
  931. ignore the information about variables.  When you are ready to be
  932. interested, read the basic information on variables, and then the
  933. information on individual variables will make sense.  *Note Variables::.
  934.  
  935. 
  936. File: emacs  Node: Entering Emacs, Prev: Commands, Up: Top, Next: Exiting
  937.  
  938. Entering and Exiting Emacs
  939. **************************
  940.  
  941.   The usual way to invoke Emacs is just to type `emacs RET' at
  942. the shell.  Emacs clears the screen and then displays an initial advisor
  943. message and copyright notice.  You can begin typing Emacs commands
  944. immediately afterward.
  945.  
  946.   Some operating systems insist on discarding all type-ahead when Emacs
  947. starts up; they give Emacs no way to prevent this.  Therefore, it is
  948. wise to wait until Emacs clears the screen before typing your first
  949. editing command.
  950.  
  951.   Before Emacs reads the first command, you have not had a chance to give a
  952. command to specify a file to edit.  But Emacs must always have a current
  953. buffer for editing.  In an attempt to do something useful, Emacs presents a
  954. buffer named `*scratch*' which is in Lisp Interaction mode; you can
  955. use it to type Lisp expressions and evaluate them, or you can ignore that
  956. capability and simply doodle.  (You can specify a different major mode for
  957. this buffer by setting the variable `initial-major-mode' in your init
  958. file.  *Note Init File::.)
  959.  
  960.   It is also possible to specify files to be visited, Lisp files to be
  961. loaded, and functions to be called, by giving Emacs arguments in the
  962. shell command line.  *Note Command Switches::.
  963.  
  964. 
  965. File: emacs  Node: Exiting, Prev: Entering Emacs, Up: Top, Next: Command Switches
  966.  
  967. Exiting Emacs
  968. =============
  969.  
  970.   There are two commands for exiting Emacs because there are two kinds of
  971. exiting: "suspending" Emacs and "killing" Emacs.  "Suspending" means
  972. stopping Emacs temporarily and returning control to its superior (usually
  973. the shell), allowing you to resume editing later in the same Emacs job,
  974. with the same files, same kill ring, same undo history, and so on.  This is
  975. the usual way to exit.  "Killing" Emacs means destroying the Emacs job.
  976. You can run Emacs again later, but you will get a fresh Emacs; there is no
  977. way to resume the same editing session after it has been killed.
  978.  
  979. `C-z'     
  980.      Suspend Emacs (`suspend-emacs').
  981. `C-x C-c'     
  982.      Kill Emacs (`save-buffers-kill-emacs').
  983.  
  984.   To suspend Emacs, type `C-z' (`suspend-emacs').  This takes
  985. you back to the shell from which you invoked Emacs.  You can resume
  986. Emacs with the command `%emacs' if you are using the C shell.
  987.  
  988.   On systems that do not permit programs to be suspended, `C-z' runs an
  989. inferior shell that communicates directly with the terminal, and Emacs
  990. waits until you exit the subshell.  The only way on these systems to get
  991. back to the shell from which Emacs was run (to log out, for example) is to
  992. kill Emacs.  `C-d' or `exit' are typical commands to exit a
  993. subshell.
  994.  
  995.   To kill Emacs, type `C-x C-c' (`save-buffers-kill-emacs').  A
  996. two-character key is used for this to make it harder to type.  Unless a
  997. numeric argument is used, this command first offers to save any modified
  998. buffers.  If you do not save them all, it asks for reconfirmation with
  999. `yes' before killing Emacs, since any changes not saved before that will be
  1000. lost forever.  Also, if any subprocesses are still running, `C-x C-c'
  1001. asks for confirmation about them, since killing Emacs will kill the
  1002. subprocesses immediately.
  1003.  
  1004.   In most programs running on Unix, certain characters may instantly
  1005. suspend or kill the program.  (In Berkeley Unix these characters are
  1006. normally `C-z' and `C-c'.)  This Unix feature is turned off
  1007. while you are in Emacs.  The meanings of `C-z' and `C-x C-c' as
  1008. keys in Emacs were inspired by the standard Berkeley Unix meanings of
  1009. `C-z' and `C-c', but that is their only relationship with
  1010. Unix.  You could customize these keys to do anything (*Note Keymaps::).
  1011.  
  1012.  
  1013. 
  1014. File: emacs  Node: Command Switches, Prev: Exiting, Up: Top, Next: Basic
  1015.  
  1016. Command Line Switches and Arguments
  1017. ===================================
  1018.  
  1019.   
  1020.   GNU Emacs supports command line arguments to request various actions
  1021. when invoking Emacs.  These are for compatibility with other editors and
  1022. for sophisticated activities.  They are not needed for ordinary editing
  1023. with Emacs, so new users can skip this section.
  1024.  
  1025.   You may be used to using command line arguments with other editors
  1026. to specify which file to edit.  That's because many other editors are
  1027. designed to be started afresh each time you want to edit.  You
  1028. edit one file and then exit the editor.  The next time you want to edit
  1029. either another file or the same one, you must run the editor again.
  1030. With these editors, it makes sense to use a command line argument
  1031. to say which file to edit.
  1032.  
  1033.   The recommended way to use GNU Emacs is to start it only once, just after
  1034. you log in, and do all your editing in the same Emacs process.  Each time
  1035. you want to edit a different file, you visit it with the existing Emacs,
  1036. which eventually comes to have many files in it ready for editing.  Usually
  1037. you do not kill the Emacs until you are about to log out.
  1038.  
  1039.   When files are nearly always read by typing commands to an editor that is
  1040. already running, command line arguments for specifying a file when the
  1041. editor is started are seldom needed.
  1042.  
  1043.   Emacs accepts command-line arguments that specify files to visit,
  1044. functions to call, and other activities and operating modes.
  1045.  
  1046.   The command arguments are processed in the order they appear in the
  1047. command argument list; however, certain arguments (the ones in the second
  1048. table) must be at the front of the list if they are used.
  1049.  
  1050.   Here are the arguments allowed:
  1051.  
  1052. `FILE'     
  1053.      Visit FILE using `find-file'.  *Note Visiting::.
  1054.      
  1055. `+LINENUM FILE'     
  1056.      Visit FILE using `find-file', then go to line number
  1057.      LINENUM in it.
  1058.      
  1059. `-l FILE'     
  1060. `-load FILE'     
  1061.      Load a file FILE of Lisp code with the function `load'.
  1062.      *Note Lisp Libraries::.
  1063.      
  1064. `-f FUNCTION'     
  1065. `-funcall FUNCTION'     
  1066.      Call Lisp function FUNCTION with no arguments.
  1067.      
  1068. `-i FILE'     
  1069. `-insert FILE'     
  1070.      Insert the contents of FILE into the current buffer.
  1071.      This is like what `M-x insert-buffer' does; *Note Misc File Ops::.
  1072.      
  1073. `-kill'     
  1074.      Exit from Emacs without asking for confirmation.
  1075.  
  1076.   The remaining switches are recognized only at the beginning of the
  1077. command line.  If more than one of them appears, they must appear in the
  1078. order that they appear in this table.
  1079.  
  1080. `-t DEVICE'     
  1081.      Use DEVICE as the device for terminal input and output.
  1082.      
  1083. `-d DISPLAY'     
  1084.      When running with the X window system, use the display named DISPLAY
  1085.      to make the window that serves as Emacs's terminal.
  1086.      
  1087. `-batch'     
  1088.      Run Emacs in "batch mode", which means that the text being edited is
  1089.      not displayed and the standard Unix interrupt characters such as `C-z'
  1090.      and `C-c' continue to have their normal effect.  Emacs in batch mode
  1091.      outputs to `stdout' only what would normally be printed in the echo
  1092.      area under program control.
  1093.      
  1094.      Batch mode is used for running programs written in Emacs Lisp from
  1095.      shell scripts, makefiles, and so on.  Normally the `-l' switch
  1096.      or `-f' switch will be used as well, to invoke a Lisp program
  1097.      to do the batch processing.
  1098.      
  1099.      `-batch' implies `-q' (do not load an init file).  It also causes
  1100.      Emacs to kill itself after all command switches have been processed.  In
  1101.      addition, auto-saving is not done except in buffers for which it has been
  1102.      explicitly requested.
  1103.      
  1104. `-q'     
  1105. `-no-init-file'     
  1106.      Do not load your Emacs init file `~/.emacs'.
  1107.      
  1108. `-u USER'     
  1109. `-user USER'     
  1110.      Load USER's Emacs init file `~USER/.emacs' instead of
  1111.      your own.
  1112.  
  1113.   Note that the init file can get access to the command line argument
  1114. values as the elements of a list in the variable `command-line-args'.
  1115. (The arguments in the second table above will already have been processed
  1116. and will not be in the list.)  The init file can override the normal
  1117. processing of the other arguments by setting this variable.
  1118.  
  1119.   One way to use command switches is to visit many files automatically:
  1120.  
  1121.      emacs *.c
  1122.  
  1123. passes each `.c' file as a separate argument to Emacs, so that Emacs
  1124. visits each file (*Note Visiting::).
  1125.   
  1126.   Here is an advanced example that assumes you have a Lisp program
  1127. file called `hack-c-program.el' which, when loaded, performs some
  1128. useful operation on current buffer, expected to be a C program.
  1129.  
  1130.      emacs -batch foo.c -l hack-c-program -f save-buffer -kill > log
  1131.  
  1132. Here Emacs is told to visit `foo.c', load `hack-c-program.el'
  1133. (which makes changes in the visited file), save `foo.c' (note that
  1134. `save-buffer' is the function that `C-x C-s' is bound to), and
  1135. then exit to the shell that this command was done with.  `-batch'
  1136. guarantees there will be no problem redirecting output to `log',
  1137. because Emacs will not assume that it has a display terminal to work with.
  1138.  
  1139. 
  1140.