home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-User.iso / usr / lib / emacs / info / emacs-2 (.txt) < prev    next >
GNU Info File  |  1992-10-30  |  49KB  |  870 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.49 from the
  2. input file emacs.texi.
  3.    This file documents the GNU Emacs editor.
  4.    Copyright (C) 1985, 1986, 1988, 1992 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: Commands,  Next: Entering Emacs,  Prev: Keys,  Up: Top
  20. Keys and Commands
  21. =================
  22.    This manual is full of passages that tell you what particular keys
  23. do. But Emacs does not assign meanings to keys directly.  Instead, Emacs
  24. assigns meanings to "functions", and then gives keys their meanings by
  25. "binding" them to functions.
  26.    A function is a Lisp object that can be executed as a program. 
  27. Usually it is a Lisp symbol which has been given a function definition;
  28. every symbol has a name, usually made of a few English words separated
  29. by dashes, such as `next-line' or `forward-word'.  It also has a
  30. "definition" which is a Lisp program; this is what makes the function
  31. do what it does.  Only some functions can be the bindings of keys;
  32. these are functions whose definitions use `interactive' to specify how
  33. to call them interactively.  Such functions are called "commands", and
  34. their names are "command names". *Note Defining Commands:
  35. (elisp)Defining Commands, for more information.
  36.    The bindings between keys and functions are recorded in various
  37. tables called "keymaps".  *Note Keymaps::.
  38.    When we say that "`C-n' moves down vertically one line" we are
  39. glossing over a distinction that is irrelevant in ordinary use but is
  40. vital in understanding how to customize Emacs.  It is the function
  41. `next-line' that is programmed to move down vertically.  `C-n' has this
  42. effect because it is bound to that function.  If you rebind `C-n' to
  43. the function `forward-word' then `C-n' will move forward by words
  44. instead.  Rebinding keys is a common method of customization.
  45.    In the rest of this manual, we usually ignore this subtlety to keep
  46. things simple.  To give the customizer the information he needs, we
  47. state the name of the command which really does the work in parentheses
  48. after mentioning the key that runs it.  For example, we will say that
  49. "The command `C-n' (`next-line') moves point vertically down," meaning
  50. that `next-line' is a command that moves vertically down and `C-n' is a
  51. key that is standardly bound to it.
  52.    While we are on the subject of information for customization only,
  53. it's a good time to tell you about "variables".  Often the description
  54. of a command will say, "To change this, set the variable `mumble-foo'."
  55. A variable is a name used to remember a value.  Most of the variables
  56. documented in this manual exist just to facilitate customization: some
  57. command or other part of Emacs examines the variable and behaves
  58. differently accordingly.  Until you are interested in customizing, you
  59. can ignore the information about variables.  When you are ready to be
  60. interested, read the basic information on variables, and then the
  61. information on individual variables will make sense.  *Note Variables::.
  62. File: emacs,  Node: Entering Emacs,  Next: Exiting,  Prev: Commands,  Up: Top
  63. Entering and Exiting Emacs
  64. **************************
  65.    The usual way to invoke Emacs is just to type `emacs RET' at the
  66. shell.  Emacs clears the screen and then displays an initial advisor
  67. message and copyright notice.  You can begin typing Emacs commands
  68. immediately afterward.
  69.    Some operating systems insist on discarding all type-ahead when Emacs
  70. starts up; they give Emacs no way to prevent this.  Therefore, it is
  71. wise to wait until Emacs clears the screen before typing your first
  72. editing command.
  73.    Before Emacs reads the first command, you have not had a chance to
  74. give a command to specify a file to edit.  But Emacs must always have a
  75. current buffer for editing.  In an attempt to do something useful,
  76. Emacs presents a buffer named `*scratch*' which is in Lisp Interaction
  77. mode; you can use it to type Lisp expressions and evaluate them, or you
  78. can ignore that capability and simply doodle.  (You can specify a
  79. different major mode for this buffer by setting the variable
  80. `initial-major-mode' in your init file.  *Note Init File::.)
  81.    It is also possible to specify files to be visited, Lisp files to be
  82. loaded, and functions to be called, by giving Emacs arguments in the
  83. shell command line.  *Note Command Switches::.
  84. File: emacs,  Node: Exiting,  Next: Command Switches,  Prev: Entering Emacs,  Up: Top
  85. Exiting Emacs
  86. =============
  87.    There are two commands for exiting Emacs because there are two kinds
  88. of exiting: "suspending" Emacs and "killing" Emacs.  "Suspending" means
  89. stopping Emacs temporarily and returning control to its superior
  90. (usually the shell), allowing you to resume editing later in the same
  91. Emacs job, with the same files, same kill ring, same undo history, and
  92. so on.  This is the usual way to exit.  "Killing" Emacs means
  93. destroying the Emacs job. You can run Emacs again later, but you will
  94. get a fresh Emacs; there is no way to resume the same editing session
  95. after it has been killed.
  96. `C-z'
  97.      Suspend Emacs (`suspend-emacs').
  98. `C-x C-c'
  99.      Kill Emacs (`save-buffers-kill-emacs').
  100.    To suspend Emacs, type `C-z' (`suspend-emacs').  This takes you back
  101. to the shell from which you invoked Emacs.  You can resume Emacs with
  102. the command `%emacs' if you are using the C shell or the Bourne-Again
  103. shell.
  104.    On systems that do not permit programs to be suspended, `C-z' runs an
  105. inferior shell that communicates directly with the terminal, and Emacs
  106. waits until you exit the subshell.  The only way on these systems to get
  107. back to the shell from which Emacs was run (to log out, for example) is
  108. to kill Emacs.  `C-d' or `exit' are typical commands to exit a subshell.
  109.    To kill Emacs, type `C-x C-c' (`save-buffers-kill-emacs').  A
  110. two-character key is used for this to make it harder to type.  Unless a
  111. numeric argument is used, this command first offers to save any modified
  112. buffers.  If you do not save them all, it asks for reconfirmation with
  113. `yes' before killing Emacs, since any changes not saved before that
  114. will be lost forever.  Also, if any subprocesses are still running,
  115. `C-x C-c' asks for confirmation about them, since killing Emacs will
  116. kill the subprocesses immediately.
  117.    In most programs running on Unix, certain characters may instantly
  118. suspend or kill the program.  (In Berkeley Unix these characters are
  119. normally `C-z' and `C-c'.)  This Unix feature is turned off while you
  120. are in Emacs.  The meanings of `C-z' and `C-x C-c' as keys in Emacs
  121. were inspired by the standard Berkeley Unix meanings of `C-z' and
  122. `C-c', but that is their only relationship with Unix.  You could
  123. customize these keys to do anything (*note Keymaps::.).
  124. File: emacs,  Node: Command Switches,  Next: Basic,  Prev: Exiting,  Up: Top
  125. Command Line Switches and Arguments
  126. ===================================
  127.    GNU Emacs supports command line arguments to request various actions
  128. when invoking Emacs.  These are for compatibility with other editors and
  129. for sophisticated activities.  They are not needed for ordinary editing
  130. with Emacs, so new users can skip this section.
  131.    You may be used to using command line arguments with other editors
  132. to specify which file to edit.  That's because many other editors are
  133. designed to be started afresh each time you want to edit.  You edit one
  134. file and then exit the editor.  The next time you want to edit either
  135. another file or the same one, you must run the editor again. With these
  136. editors, it makes sense to use a command line argument to say which
  137. file to edit.
  138.    The recommended way to use GNU Emacs is to start it only once, just
  139. after you log in, and do all your editing in the same Emacs process. 
  140. Each time you want to edit a different file, you visit it with the
  141. existing Emacs, which eventually comes to have many files in it ready
  142. for editing.  Usually you do not kill the Emacs until you are about to
  143. log out.
  144.    In the usual style of Emacs use, files are nearly always read by
  145. typing commands to an editor that is already running.  So command line
  146. arguments for specifying a file when the editor is started are seldom
  147. used.
  148.    Emacs accepts command-line arguments that specify files to visit,
  149. functions to call, and other activities and operating modes.
  150.    The command arguments are processed in the order they appear in the
  151. command argument list; however, certain arguments (the ones in the
  152. second table) must be at the front of the list if they are used.
  153.    Here are the arguments allowed:
  154. `FILE'
  155.      Visit FILE using `find-file'.  *Note Visiting::.
  156. `+LINENUM FILE'
  157.      Visit FILE using `find-file', then go to line number LINENUM in it.
  158. `-l FILE'
  159. `-load FILE'
  160.      Load a file FILE of Lisp code with the function `load'. *Note Lisp
  161.      Libraries::.
  162. `-f FUNCTION'
  163. `-funcall FUNCTION'
  164.      Call Lisp function FUNCTION with no arguments.
  165. `-i FILE'
  166. `-insert FILE'
  167.      Insert the contents of FILE into the current buffer. This is like
  168.      what `M-x insert-buffer' does; see *Note Misc File Ops::.
  169. `-kill'
  170.      Exit from Emacs without asking for confirmation.
  171.    The following switches are recognized only at the beginning of the
  172. command line.  If more than one of them appears, they must appear in the
  173. order that they appear in this table.
  174. `-t DEVICE'
  175.      Use DEVICE as the device for terminal input and output.
  176. `-d DISPLAY'
  177.      When running with the X window system, use the display named
  178.      DISPLAY to make Emacs's X window.
  179. `-nw'
  180.      Don't use a window system; display text only, using an ordinary
  181.      terminal device.  Thus, if you run an X-capable Emacs in an Xterm
  182.      with `emacs -nw', it displays in the Xterm's own window instead of
  183.      making its own.
  184. `-batch'
  185.      Run Emacs in "batch mode", which means that the text being edited
  186.      is not displayed and the standard Unix interrupt characters such
  187.      as `C-z' and `C-c' continue to have their normal effect.  Emacs in
  188.      batch mode outputs to `stdout' only what would normally be printed
  189.      in the echo area under program control.
  190.      Batch mode is used for running programs written in Emacs Lisp from
  191.      shell scripts, makefiles, and so on.  Normally the `-l' switch or
  192.      `-f' switch will be used as well, to invoke a Lisp program to do
  193.      the batch processing.
  194.      `-batch' implies `-q' (do not load an init file).  It also causes
  195.      Emacs to exit after all command switches have been processed.  In
  196.      addition, auto-saving is not done except in buffers for which it
  197.      has been explicitly requested.
  198. `-no-init-file'
  199.      Do not load your Emacs init file `~/.emacs'.
  200. `-u USER'
  201. `-user USER'
  202.      Load USER's Emacs init file `~USER/.emacs' instead of your own.
  203.    With X Windows, you can use these additional options to specify how
  204. to display the window.  Each option has a corresponding resource name
  205. (used with `emacs' unless you specify another name with `-rn NAME'),
  206. listed with the option, which lets you specify the same parameter using
  207. the usual X Windows defaulting mechanism.  The corresponding generic
  208. resource name (used with `Emacs') is usually made by capitalizing the
  209. first letter of the individual resource name, but in some cases it is a
  210. completely different string (which is listed below).
  211. `-rn NAME'
  212.      Use NAME instead of `emacs' when looking for X resources.
  213. `-font FONTNAME'
  214. `-fn FONTNAME'
  215.      Use font FONTNAME.
  216.      (Resource `font'.)
  217. `-wn NAME'
  218.      Name the window NAME.
  219.      (Resource `title'.)
  220.      Use a bitmap icon (showing the kitchen sink) rather than a textual
  221.      icon.
  222.      (Resource `bitmapIcon'.)
  223. `-in NAME'
  224.      Name the icon NAME.  (Resource `iconName'; `Title').
  225. `-geometry COORDS'
  226. `-w COORDS'
  227.      Specify the shape and optionally the position of the Emacs window
  228.      in the usual X way.
  229.      (Resource `geometry'.)
  230. `-b WIDTH'
  231.      Specify that the window border is WIDTH pixels thick.
  232.      (Resource `borderWidth'.)
  233. `-ib WIDTH'
  234.      Leave WIDTH blank pixels between the border and the window
  235.      contents.
  236.      (Resource `internalBorder'; `BorderWidth'.)
  237.      Use reverse video.
  238.      (Resource `reverseVideo'.)
  239. `-fg COLOR'
  240.      Use color COLOR for text in the window.
  241.      (Resource `foreground'.)
  242. `-bg COLOR'
  243.      Use the color COLOR for the background of the window.
  244.      (Resource `background'.)
  245. `-bd COLOR'
  246.      Use color COLOR for the window border.
  247.      (Resource `borderColor'.)
  248. `-cr COLOR'
  249.      Specify the color, COLOR, to use for the cursor.
  250.      (Resource `cursorColor'; `Foreground'.)
  251. `-ms COLOR'
  252.      Use color COLOR for the mouse cursor.
  253.      (Resource `pointerColor'; `Foreground'.)
  254.    The init file can get access to the command line argument values as
  255. the elements of a list in the variable `command-line-args'.  (The
  256. arguments in the second table above will already have been processed and
  257. will not be in the list.)  The init file can override the normal
  258. processing of the other arguments by setting this variable.
  259.    One way to use command arguments is to visit many files
  260. automatically:
  261.      emacs *.c
  262. passes each `.c' file as a separate argument to Emacs, so that Emacs
  263. visits each file (*note Visiting::.).
  264.    Here is an advanced example that assumes you have a Lisp program
  265. file called `hack-c-program.el' which, when loaded, performs some
  266. useful operation on current buffer, expected to be a C program.
  267.      emacs -batch foo.c -l hack-c-program -f save-buffer -kill > log
  268. This says to visit `foo.c', load `hack-c-program.el' (which makes
  269. changes in the visited file), save `foo.c' (note that `save-buffer' is
  270. the function that `C-x C-s' is bound to), and then exit to the shell
  271. that this command was done with.  `-batch' guarantees there will be no
  272. problem redirecting output to `log', because Emacs will not assume that
  273. it has a display terminal to work with.
  274. File: emacs,  Node: Basic,  Next: Undo,  Prev: Command Switches,  Up: Top
  275. Basic Editing Commands
  276. **********************
  277.    We now give the basics of how to enter text, make corrections, and
  278. save the text in a file.  If this material is new to you, you might
  279. learn it more easily by running the Emacs learn-by-doing tutorial.  To
  280. do this, type `Control-h t' (`help-with-tutorial').
  281. Inserting Text
  282. ==============
  283.    To insert printing characters into the text you are editing, just
  284. type them.  This inserts the character into the buffer at the cursor
  285. (that is, at "point"; *note Point::.).  The cursor moves forward.  Any
  286. characters after the cursor move forward too.  If the text in the
  287. buffer is `FOOBAR', with the cursor before the `B', then if you type
  288. `XX', you get `FOOXXBAR', with the cursor still before the `B'.
  289.    To "delete" text you have just inserted, use DEL.  DEL deletes the
  290. character BEFORE the cursor (not the one that the cursor is on top of
  291. or under; that is the character AFTER the cursor).  The cursor and all
  292. characters after it move backwards.  Therefore, if you type a printing
  293. character and then type DEL, they cancel out.
  294.    To end a line and start typing a new one, type RET.  This inserts a
  295. newline character in the buffer.  If point is in the middle of a line,
  296. RET splits the line.  Typing DEL when the cursor is at the beginning of
  297. a line rubs out the newline before the line, thus joining the line with
  298. the preceding line.
  299.    Emacs will split lines automatically when they become too long, if
  300. you turn on a special mode called "Auto Fill" mode.  *Note Filling::,
  301. for how to use Auto Fill mode.
  302.    Customization information: DEL in most modes runs the command named
  303. `delete-backward-char'; RET runs the command `newline', and
  304. self-inserting printing characters run the command `self-insert', which
  305. inserts whatever character was typed to invoke it.  Some major modes
  306. rebind DEL to other commands.
  307.    Direct insertion works for printing characters and SPC, but other
  308. characters act as editing commands and do not insert themselves.  If you
  309. need to insert a control character or a character whose code is above
  310. 200 octal, you must "quote" it by typing the character `control-q'
  311. (`quoted-insert') first.  There are two ways to use `C-q':
  312.    * `Control-q' followed by any non-graphic character (even `C-g')
  313.      inserts that character.
  314.    * `Control-q' followed by three octal digits inserts the character
  315.      with the specified character code.
  316. A numeric argument to `C-q' specifies how many copies of the quoted
  317. character should be inserted (*note Arguments::.).
  318.    If you prefer to have text characters replace (overwrite) existing
  319. text rather than shove it to the right, you can enable Overwrite mode,
  320. a minor mode.  *Note Minor Modes::.
  321. Changing the Location of Point
  322. ==============================
  323.    To do more than insert characters, you have to know how to move
  324. point (*note Point::.).  Here are a few of the commands for doing that.
  325. `C-a'
  326.      Move to the beginning of the line (`beginning-of-line').
  327. `C-e'
  328.      Move to the end of the line (`end-of-line').
  329. `C-f'
  330.      Move forward one character (`forward-char').
  331. `C-b'
  332.      Move backward one character (`backward-char').
  333. `M-f'
  334.      Move forward one word (`forward-word').
  335. `M-b'
  336.      Move backward one word (`backward-word').
  337. `C-n'
  338.      Move down one line, vertically (`next-line').  This command
  339.      attempts to keep the horizontal position unchanged, so if you
  340.      start in the middle of one line, you end in the middle of the
  341.      next.  When on the last line of text, `C-n' creates a new line and
  342.      moves onto it.
  343. `C-p'
  344.      Move up one line, vertically (`previous-line').
  345. `C-l'
  346.      Clear the screen and reprint everything (`recenter').  Text moves
  347.      on the screen to bring point to the center of the window.
  348. `M-r'
  349.      Move point to left margin on the line halfway down the screen or
  350.      window (`move-to-window-line').  Text does not move on the screen.
  351.       A numeric argument says how many screen lines down from the top
  352.      of the window (zero for the top).  A negative argument counts from
  353.      the bottom (-1 for the bottom).
  354. `C-t'
  355.      Transpose two characters, the ones before and after the cursor
  356.      (`transpose-chars').
  357. `M-<'
  358.      Move to the top of the buffer (`beginning-of-buffer').  With
  359.      numeric argument N, move to N/10 of the way from the top. *Note
  360.      Arguments::, for more information on numeric arguments.
  361. `M->'
  362.      Move to the end of the buffer (`end-of-buffer').
  363. `M-x goto-char'
  364.      Read a number N and move cursor to character number N. Position 1
  365.      is the beginning of the buffer.
  366. `M-x goto-line'
  367.      Read a number N and move cursor to line number N.  Line 1 is the
  368.      beginning of the buffer.
  369. `C-x C-n'
  370.      Use the current column of point as the "semipermanent goal column"
  371.      for `C-n' and `C-p' (`set-goal-column').  Henceforth, those
  372.      commands always move to this column in each line moved into, or as
  373.      close as possible given the contents of the line.  This goal
  374.      column remains in effect until canceled.
  375. `C-u C-x C-n'
  376.      Cancel the goal column.  Henceforth, `C-n' and `C-p' once again
  377.      try to avoid changing the horizontal position, as usual.
  378.    If you set the variable `track-eol' to a non-`nil' value, then `C-n'
  379. and `C-p' when at the end of the starting line move to the end of the
  380. line.  Normally, `track-eol' is `nil'.
  381. Erasing Text
  382. ============
  383. `DEL'
  384.      Delete the character before the cursor (`delete-backward-char').
  385. `C-d'
  386.      Delete the character after the cursor (`delete-char').
  387. `C-k'
  388.      Kill to the end of the line (`kill-line').
  389. `M-d'
  390.      Kill forward to the end of the next word (`kill-word').
  391. `M-DEL'
  392.      Kill back to the beginning of the previous word
  393.      (`backward-kill-word').
  394.    You already know about the DEL key which deletes the character
  395. before the cursor.  Another key, `Control-d', deletes the character
  396. after the cursor, causing the rest of the text on the line to shift
  397. left. If `Control-d' is typed at the end of a line, that line and the
  398. next line are joined together.
  399.    To erase a larger amount of text, use the `Control-k' key, which
  400. kills a line at a time.  If `C-k' is done at the beginning or middle of
  401. a line, it kills all the text up to the end of the line.  If `C-k' is
  402. done at the end of a line, it joins that line and the next line.
  403.    *Note Killing::, for more flexible ways of killing text.
  404. Files
  405. =====
  406.    The commands above are sufficient for creating and altering text in
  407. an Emacs buffer; the more advanced Emacs commands just make things
  408. easier. But to keep any text permanently you must put it in a "file". 
  409. Files are named units of text which are stored by the operating system
  410. for you to retrieve later by name.  To look at or use the contents of a
  411. file in any way, including editing the file with Emacs, you must
  412. specify the file name.
  413.    Consider a file named `/usr/rms/foo.c'.  In Emacs, to begin editing
  414. this file, type
  415.      C-x C-f /usr/rms/foo.c RET
  416. Here the file name is given as an "argument" to the command `C-x C-f'
  417. (`find-file').  That command uses the "minibuffer" to read the
  418. argument, and you type RET to terminate the argument (*note
  419. Minibuffer::.).
  420.    Emacs obeys the command by "visiting" the file: creating a buffer,
  421. copying the contents of the file into the buffer, and then displaying
  422. the buffer for you to edit.  You can make changes in it, and then "save"
  423. the file by typing `C-x C-s' (`save-buffer').  This makes the changes
  424. permanent by copying the altered contents of the buffer back into the
  425. file `/usr/rms/foo.c'.  Until then, the changes are only inside your
  426. Emacs, and the file `foo.c' is not changed.
  427.    To create a file, just visit the file with `C-x C-f' as if it already
  428. existed.  Emacs will make an empty buffer in which you can insert the
  429. text you want to put in the file.  When you save your text with `C-x
  430. C-s', the file will be created.
  431.    Of course, there is a lot more to learn about using files.  *Note
  432. Files::.
  433.    If you forget what a key does, you can find out with the Help
  434. character, which is `C-h'.  Type `C-h k' followed by the key you want
  435. to know about; for example, `C-h k C-n' tells you all about what `C-n'
  436. does.  `C-h' is a prefix key; `C-h k' is just one of its subcommands
  437. (the command `describe-key').  The other subcommands of `C-h' provide
  438. different kinds of help.  Type `C-h' three times to get a description
  439. of all the help facilities.  *Note Help::.
  440. * Menu:
  441. * Blank Lines::        Commands to make or delete blank lines.
  442. * Continuation Lines:: Lines too wide for the screen.
  443. * Position Info::      What page, line, row, or column is point on?
  444. * Arguments::           Numeric arguments for repeating a command.
  445. File: emacs,  Node: Blank Lines,  Next: Continuation Lines,  Prev: Basic,  Up: Basic
  446. Blank Lines
  447. ===========
  448.    Here are special commands and techniques for putting in and taking
  449. out blank lines.
  450. `C-o'
  451.      Insert one or more blank lines after the cursor (`open-line').
  452. `C-x C-o'
  453.      Delete all but one of many consecutive blank lines
  454.      (`delete-blank-lines').
  455.    When you want to insert a new line of text before an existing line,
  456. you can do it by typing the new line of text, followed by RET.  However,
  457. it may be easier to see what you are doing if you first make a blank
  458. line and then insert the desired text into it.  This is easy to do
  459. using the key `C-o' (`open-line'), which inserts a newline after point
  460. but leaves point in front of the newline.  After `C-o', type the text
  461. for the new line.  `C-o F O O' has the same effect as `F O O RET',
  462. except for the final location of point.
  463.    You can make several blank lines by typing `C-o' several times, or by
  464. giving it an argument to tell it how many blank lines to make. *Note
  465. Arguments::, for how.
  466.    If you have many blank lines in a row and want to get rid of them,
  467. use `C-x C-o' (`delete-blank-lines').  When point is on a blank line
  468. which is adjacent to at least one other blank line, `C-x C-o' deletes
  469. all but one of the consecutive blank lines, leaving exactly one.  With
  470. point on a blank line with no other blank line adjacent to it, the sole
  471. blank line is deleted, leaving none.  When point is on a nonblank line,
  472. `C-x C-o' deletes any blank lines following that nonblank line.
  473. File: emacs,  Node: Continuation Lines,  Next: Position Info,  Prev: Blank Lines,  Up: Basic
  474. Continuation Lines
  475. ==================
  476.    If you add too many characters to one line, without breaking it with
  477. a RET, the line will grow to occupy two (or more) lines on the screen,
  478. with a `\' at the extreme right margin of all but the last of them. The
  479. `\' says that the following screen line is not really a distinct line
  480. in the text, but just the "continuation" of a line too long to fit the
  481. screen.  Sometimes it is nice to have Emacs insert newlines
  482. automatically when a line gets too long; for this, use Auto Fill mode
  483. (*note Filling::.).
  484.    Instead of continuation, long lines can be displayed by "truncation".
  485. This means that all the characters that do not fit in the width of the
  486. screen or window do not appear at all.  They remain in the buffer,
  487. temporarily invisible.  `$' is used in the last column instead of `\'
  488. to inform you that truncation is in effect.
  489.    Continuation can be turned off for a particular buffer by setting the
  490. variable `truncate-lines' to non-`nil' in that buffer. Truncation
  491. instead of continuation also happens whenever horizontal scrolling is
  492. in use, and optionally whenever side-by-side windows are in use (*note
  493. Windows::.).  Altering the value of `truncate-lines' makes it local to
  494. the current buffer; until that time, the default value is in effect. 
  495. The default is initially `nil'.  *Note Locals::.
  496. File: emacs,  Node: Position Info,  Next: Arguments,  Prev: Continuation Lines,  Up: Basic
  497. Cursor Position Information
  498. ===========================
  499.    If you are accustomed to other display editors, you may be surprised
  500. that Emacs does not always display the page number or line number of
  501. point in the mode line.  This is because the text is stored in a way
  502. that makes it difficult to compute this information.  Displaying them
  503. all the time would be intolerably slow.  They are not needed very often
  504. in Emacs anyway, but there are commands to compute them and print them.
  505. `M-x what-page'
  506.      Print page number of point, and line number within page.
  507. `M-x what-line'
  508.      Print line number of point in the buffer.
  509. `M-='
  510.      Print number of lines in the current region (`count-lines-region').
  511. `C-x ='
  512.      Print character code of character after point, character position
  513.      of point, and column of point (`what-cursor-position').
  514.    There are two commands for printing line numbers.  `M-x what-line'
  515. counts lines from the beginning of the file and prints the line number
  516. point is on.  The first line of the file is line number 1.  These
  517. numbers can be used as arguments to `M-x goto-line'.  By contrast, `M-x
  518. what-page' counts pages from the beginning of the file, and counts lines
  519. within the page, printing both of them.  *Note Pages::.
  520.    While on this subject, we might as well mention `M-='
  521. (`count-lines-region'), which prints the number of lines in the region
  522. (*note Mark::.). *Note Pages::, for the command `C-x l' which counts
  523. the lines in the current page.
  524.    The command `C-x =' (`what-cursor-position') can be used to find out
  525. the column that the cursor is in, and other miscellaneous information
  526. about point.  It prints a line in the echo area that looks like this:
  527.      Char: x (0170)  point=65986 of 563027(12%)  x=44
  528. (In fact, this is the output produced when point is before the `x=44'
  529. in the example.)
  530.    The two values after `Char:' describe the character following point,
  531. first by showing it and second by giving its octal character code.
  532.    `point=' is followed by the position of point expressed as a
  533. character count.  The front of the buffer counts as position 1, one
  534. character later as 2, and so on.  The next, larger number is the total
  535. number of characters in the buffer.  Afterward in parentheses comes the
  536. position expressed as a percentage of the total size.
  537.    `x=' is followed by the horizontal position of point, in columns
  538. from the left edge of the window.
  539.    If the buffer has been narrowed, making some of the text at the
  540. beginning and the end temporarily invisible, `C-x =' prints additional
  541. text describing the current visible range.  For example, it might say
  542.      Char: x (0170)  point=65986 of 563025(12%) <65102 - 68533>  x=44
  543. where the two extra numbers give the smallest and largest character
  544. position that point is allowed to assume.  The characters between those
  545. two positions are the visible ones.  *Note Narrowing::.
  546.    If point is at the end of the buffer (or the end of the visible
  547. part), `C-x =' omits any description of the character after point. The
  548. output looks like
  549.      point=563026 of 563025(100%)  x=0
  550. File: emacs,  Node: Arguments,  Prev: Position Info,  Up: Basic
  551. Numeric Arguments
  552. =================
  553.    Any Emacs command can be given a "numeric argument".  Some commands
  554. interpret the argument as a repetition count.  For example, giving an
  555. argument of ten to the key `C-f' (the command `forward-char', move
  556. forward one character) moves forward ten characters.  With these
  557. commands, no argument is equivalent to an argument of one.  Negative
  558. arguments are allowed.  Often they tell a command to move or act
  559. backwards.
  560.    If your terminal keyboard has a META key, the easiest way to specify
  561. a numeric argument is to type digits and/or a minus sign while holding
  562. down the META key.  For example,
  563.      M-5 C-n
  564. would move down five lines.  The characters `Meta-1', `Meta-2', and so
  565. on, as well as `Meta--', do this because they are keys bound to
  566. commands (`digit-argument' and `negative-argument') that are defined to
  567. contribute to an argument for the next command.
  568.    Another way of specifying an argument is to use the `C-u'
  569. (`universal-argument') command followed by the digits of the argument.
  570. With `C-u', you can type the argument digits without holding down shift
  571. keys.  To type a negative argument, start with a minus sign. Just a
  572. minus sign normally means -1.  `C-u' works on all terminals.
  573.    `C-u' followed by a character which is neither a digit nor a minus
  574. sign has the special meaning of "multiply by four".  It multiplies the
  575. argument for the next command by four.  `C-u' twice multiplies it by
  576. sixteen.  Thus, `C-u C-u C-f' moves forward sixteen characters.  This
  577. is a good way to move forward "fast", since it moves about 1/5 of a line
  578. in the usual size screen.  Other useful combinations are `C-u C-n',
  579. `C-u C-u C-n' (move down a good fraction of a screen), `C-u C-u C-o'
  580. (make "a lot" of blank lines), and `C-u C-k' (kill four lines).
  581.    Some commands care only about whether there is an argument, and not
  582. about its value.  For example, the command `M-q' (`fill-paragraph') with
  583. no argument fills text; with an argument, it justifies the text as well.
  584. (*Note Filling::, for more information on `M-q'.)  Just `C-u' is a
  585. handy way of providing an argument for such commands.
  586.    Some commands use the value of the argument as a repeat count, but do
  587. something peculiar when there is no argument.  For example, the command
  588. `C-k' (`kill-line') with argument N kills N lines, including their
  589. terminating newlines.  But `C-k' with no argument is special: it kills
  590. the text up to the next newline, or, if point is right at the end of
  591. the line, it kills the newline itself.  Thus, two `C-k' commands with
  592. no arguments can kill a nonblank line, just like `C-k' with an argument
  593. of one.  (*Note Killing::, for more information on `C-k'.)
  594.    A few commands treat a plain `C-u' differently from an ordinary
  595. argument.  A few others may treat an argument of just a minus sign
  596. differently from an argument of -1.  These unusual cases will be
  597. described when they come up; they are always for reasons of convenience
  598. of use of the individual command.
  599.    To insert multiple copies of a digit, you can type `C-u COUNT C-u
  600. DIGIT'.  The second `C-u' ends the numeric argument, so that the
  601. following character always acts a key sequence to be executed.
  602. File: emacs,  Node: Undo,  Next: Minibuffer,  Prev: Basic,  Up: Top
  603. Undoing Changes
  604. ***************
  605.    Emacs allows all changes made in the text of a buffer to be undone,
  606. up to a certain amount of change (8000 characters).  Each buffer records
  607. changes individually, and the undo command always applies to the
  608. current buffer.  Usually each editing command makes a separate entry in
  609. the undo records, but some commands such as `query-replace' make many
  610. entries, and very simple commands such as self-inserting characters are
  611. often grouped to make undoing less tedious.
  612. `C-x u'
  613.      Undo one batch of changes (usually, one command worth) (`undo').
  614. `C-_'
  615.      The same.
  616.    The command `C-x u' or `C-_' is how you undo.  The first time you
  617. give this command, it undoes the last change.  Point moves to the text
  618. affected by the undo, so you can see what was undone.
  619.    Consecutive repetitions of the `C-_' or `C-x u' commands undo earlier
  620. and earlier changes, back to the limit of what has been recorded.  If
  621. all recorded changes have already been undone, the undo command prints
  622. an error message and does nothing.
  623.    Any command other than an undo command breaks the sequence of undo
  624. commands.  Starting at this moment, the previous undo commands are
  625. considered ordinary changes that can themselves be undone.  Thus, to
  626. redo changes you have undone, type `C-f' or any other command that will
  627. have no important effect, and then give more undo commands.
  628.    If you notice that a buffer has been modified accidentally, the
  629. easiest way to recover is to type `C-_' repeatedly until the stars
  630. disappear from the front of the mode line.  At this time, all the
  631. modifications you made have been cancelled.  If you do not remember
  632. whether you changed the buffer deliberately, type `C-_' once, and when
  633. you see the last change you made undone, you will remember why you made
  634. it.  If it was an accident, leave it undone.  If it was deliberate,
  635. redo the change as described in the preceding paragraph.
  636.    Whenever an undo command makes the stars disappear from the mode
  637. line, it means that the buffer contents are the same as they were when
  638. the file was last read in or saved.
  639.    Not all buffers record undo information.  Buffers whose names start
  640. with spaces don't; these buffers are used internally by Emacs and its
  641. extensions to hold text that users don't normally look at or edit. 
  642. Also, minibuffers, help buffers and documentation buffers don't record
  643. undo information. Use the command `buffer-enable-undo' to enable
  644. recording undo information in the current buffer.
  645.    As editing continues, undo lists get longer and longer.  To prevent
  646. them from using up all available memory space, garbage collection trims
  647. back their sizes to thresholds you can set.  (For this purpose, the
  648. "size" of an undo list measures the cons cells that make up the list,
  649. plus the strings of deleted text.)
  650.    Two variables control the range of acceptable sizes: `undo-limit'
  651. and `undo-strong-limit'.  Normally, the most recent changes are kept
  652. until their size exceeds `undo-limit'; all older changes are discarded.
  653.  But if a change pushes the size above `undo-strong-limit', it is
  654. discarded as well as all older changes. One exception: the most recent
  655. set of changes is sacred; garbage collection never discards that.  (In
  656. Emacs versions 18.57 and 18.58, these variables are called
  657. `undo-threshold' and `undo-high-threshold'.)
  658.    The reason the `undo' command has two keys, `C-x u' and `C-_', set
  659. up to run it is that it is worthy of a single-character key, but the
  660. way to type `C-_' on some keyboards is not obvious. `C-x u' is an
  661. alternative you can type in the same fashion on any terminal.
  662. File: emacs,  Node: Minibuffer,  Next: M-x,  Prev: Undo,  Up: Top
  663. The Minibuffer
  664. **************
  665.    The "minibuffer" is the facility used by Emacs commands to read
  666. arguments more complicated than a single number.  Minibuffer arguments
  667. can be file names, buffer names, Lisp function names, Emacs command
  668. names, Lisp expressions, and many other things, depending on the
  669. command reading the argument.  The usual Emacs editing commands can be
  670. used in the minibuffer to edit the argument.
  671.    When the minibuffer is in use, it appears in the echo area, and the
  672. terminal's cursor moves there.  The beginning of the minibuffer line
  673. displays a "prompt" which says what kind of input you should supply and
  674. how it will be used.  Often this prompt is derived from the name of the
  675. command that the argument is for.  The prompt normally ends with a
  676. colon.
  677.    Sometimes a "default argument" appears in parentheses after the
  678. colon; it too is part of the prompt.  The default will be used as the
  679. argument value if you enter an empty argument (e.g., just type RET).
  680. For example, commands that read buffer names always show a default,
  681. which is the name of the buffer that will be used if you type just RET.
  682.    The simplest way to give a minibuffer argument is to type the text
  683. you want, terminated by RET which exits the minibuffer.  You can get out
  684. of the minibuffer, canceling the command that it was for, by typing
  685. `C-g'.
  686.    Since the minibuffer uses the screen space of the echo area, it can
  687. conflict with other ways Emacs customarily uses the echo area.  Here is
  688. how Emacs handles such conflicts:
  689.    * If a command gets an error while you are in the minibuffer, this
  690.      does not cancel the minibuffer.  However, the echo area is needed
  691.      for the error message and therefore the minibuffer itself is
  692.      hidden for a while.  It comes back after a few seconds, or as soon
  693.      as you type anything.
  694.    * If in the minibuffer you use a command whose purpose is to print a
  695.      message in the echo area, such as `C-x =', the message is printed
  696.      normally, and the minibuffer is hidden for a while.  It comes back
  697.      after a few seconds, or as soon as you type anything.
  698.    * Echoing of keystrokes does not take place while the minibuffer is
  699.      in use.
  700. * Menu:
  701. * File: Minibuffer File.  Entering file names with the minibuffer.
  702. * Edit: Minibuffer Edit.  How to edit in the minibuffer.
  703. * Completion::          An abbreviation facility for minibuffer input.
  704. * Repetition::          Re-executing commands that used the minibuffer.
  705. File: emacs,  Node: Minibuffer File,  Next: Minibuffer Edit,  Prev: Minibuffer,  Up: Minibuffer
  706. Minibuffers for File Names
  707. ==========================
  708.    Sometimes the minibuffer starts out with text in it.  For example,
  709. when you are supposed to give a file name, the minibuffer starts out
  710. containing the "default directory", which ends with a slash.  This is
  711. to inform you which directory the file will be found in if you do not
  712. specify a directory.  For example, the minibuffer might start out with
  713.      Find File: /u2/emacs/src/
  714. where `Find File: ' is the prompt.  Typing `buffer.c' specifies the
  715. file `/u2/emacs/src/buffer.c'.  To find files in nearby directories,
  716. use `..'; thus, if you type `../lisp/simple.el', the file that you
  717. visit will be the one named `/u2/emacs/lisp/simple.el'. Alternatively,
  718. you can kill with `M-DEL' the directory names you don't want (*note
  719. Words::.).
  720.    You can also type an absolute file name, one starting with a slash
  721. or a tilde, ignoring the default directory.  For example, to find the
  722. file `/etc/termcap', just type the name, giving
  723.      Find File: /u2/emacs/src//etc/termcap
  724. Two slashes in a row are not normally meaningful in Unix file names, but
  725. they are allowed in GNU Emacs.  They mean, "ignore everything before the
  726. second slash in the pair."  Thus, `/u2/emacs/src/' is ignored, and you
  727. get the file `/etc/termcap'.
  728.    If you set `insert-default-directory' to `nil', the default directory
  729. is not inserted in the minibuffer.  This way, the minibuffer starts out
  730. empty.  But the name you type, if relative, is still interpreted with
  731. respect to the same default directory.
  732. File: emacs,  Node: Minibuffer Edit,  Next: Completion,  Prev: Minibuffer File,  Up: Minibuffer
  733. Editing in the Minibuffer
  734. =========================
  735.    The minibuffer is an Emacs buffer (albeit a peculiar one), and the
  736. usual Emacs commands are available for editing the text of an argument
  737. you are entering.
  738.    Since RET in the minibuffer is defined to exit the minibuffer,
  739. inserting a newline into the minibuffer must be done with `C-o' or with
  740. `C-q LFD'.  (Recall that a newline is really the LFD character.)
  741.    The minibuffer has its own window which always has space on the
  742. screen but acts as if it were not there when the minibuffer is not in
  743. use.  When the minibuffer is in use, its window is just like the
  744. others; you can switch to another window with `C-x o', edit text in
  745. other windows and perhaps even visit more files, before returning to
  746. the minibuffer to submit the argument.  You can kill text in another
  747. window, return to the minibuffer window, and then yank the text to use
  748. it in the argument. *Note Windows::.
  749.    There are some restrictions on the use of the minibuffer window,
  750. however. You cannot switch buffers in it--the minibuffer and its window
  751. are permanently attached.  Also, you cannot split or kill the minibuffer
  752. window.  But you can make it taller in the normal fashion with `C-x ^'
  753. (*note Change Window::.).
  754.    If while in the minibuffer you issue a command that displays help
  755. text of any sort in another window, then that window is identified as
  756. the one to scroll if you type `C-M-v' while in the minibuffer.  This
  757. lasts until you exit the minibuffer.  This feature comes into play if a
  758. completing minibuffer gives you a list of possible completions.
  759.    Recursive use of the minibuffer is supported by Emacs.  However, it
  760. is easy to do this by accident (because of autorepeating keyboards, for
  761. example) and get confused.  Therefore, most Emacs commands that use the
  762. minibuffer refuse to operate if the minibuffer window is selected.  If
  763. the minibuffer is active but you have switched to a different window,
  764. recursive use of the minibuffer is allowed--if you know enough to try
  765. to do this, you probably will not get confused.
  766.    If you set the variable `enable-recursive-minibuffers' to be
  767. non-`nil', recursive use of the minibuffer is always allowed.
  768. File: emacs,  Node: Completion,  Next: Repetition,  Prev: Minibuffer Edit,  Up: Minibuffer
  769. Completion
  770. ==========
  771.    When appropriate, the minibuffer provides a "completion" facility.
  772. This means that you type enough of the argument to determine the rest,
  773. based on Emacs's knowledge of which arguments make sense, and Emacs
  774. visibly fills in the rest, or as much as can be determined from the
  775. part you have typed.
  776.    When completion is available, certain keys--TAB, RET, and SPC--are
  777. redefined to complete an abbreviation present in the minibuffer into a
  778. longer string that it stands for, by matching it against a set of
  779. "completion alternatives" provided by the command reading the argument.
  780. `?' is defined to display a list of possible completions of what you
  781. have inserted.
  782.    For example, when the minibuffer is being used by `Meta-x' to read
  783. the name of a command, it is given a list of all available Emacs command
  784. names to complete against.  The completion keys match the text in the
  785. minibuffer against all the command names, find any additional
  786. characters of the name that are implied by the ones already present in
  787. the minibuffer, and add those characters to the ones you have given.
  788.    Case is normally significant in completion, because it is
  789. significant in most of the names that you can complete (buffer names,
  790. file names and command names).  Thus, `fo' will not complete to `Foo'. 
  791. When you are completing a name in which case does not matter, case may
  792. be ignored for completion's sake if the program said to do so.
  793. Completion Example
  794. ------------------
  795.    A concrete example may help here.  If you type `Meta-x au TAB', the
  796. TAB looks for alternatives (in this case, command names) that start
  797. with `au'.  There are only two: `auto-fill-mode' and `auto-save-mode'. 
  798. These are the same as far as `auto-', so the `au' in the minibuffer
  799. changes to `auto-'.
  800.    If you type TAB again immediately, there are multiple possibilities
  801. for the very next character--it could be `s' or `f'--so no more
  802. characters are added; but a list of all possible completions is
  803. displayed in another window.
  804.    If you go on to type `f TAB', this TAB sees `auto-f'.  The only
  805. command name starting this way is `auto-fill-mode', so completion
  806. inserts the rest of that.  You now have `auto-fill-mode' in the
  807. minibuffer after typing just `au TAB f TAB'.  Note that TAB has this
  808. effect because in the minibuffer it is bound to the function
  809. `minibuffer-complete' when completion is supposed to be done.
  810. Completion Commands
  811. -------------------
  812.    Here is a list of all the completion commands, defined in the
  813. minibuffer when completion is available.
  814. `TAB'
  815.      Complete the text in the minibuffer as much as possible
  816.      (`minibuffer-complete').
  817. `SPC'
  818.      Complete the text in the minibuffer but don't add or fill out more
  819.      than one word (`minibuffer-complete-word').
  820. `RET'
  821.      Submit the text in the minibuffer as the argument, possibly
  822.      completing first as described below
  823.      (`minibuffer-complete-and-exit').
  824.      Print a list of all possible completions of the text in the
  825.      minibuffer (`minibuffer-list-completions').
  826.    SPC completes much like TAB, but never goes beyond the next hyphen
  827. or space.  If you have `auto-f' in the minibuffer and type SPC, it
  828. finds that the completion is `auto-fill-mode', but it stops completing
  829. after `fill-'.  This gives `auto-fill-'. Another SPC at this point
  830. completes all the way to `auto-fill-mode'.  SPC in the minibuffer runs
  831. the function `minibuffer-complete-word' when completion is available.
  832.    There are three different ways that RET can work in completing
  833. minibuffers, depending on how the argument will be used.
  834.    * "Strict" completion is used when it is meaningless to give any
  835.      argument except one of the known alternatives.  For example, when
  836.      `C-x k' reads the name of a buffer to kill, it is meaningless to
  837.      give anything but the name of an existing buffer.  In strict
  838.      completion, RET refuses to exit if the text in the minibuffer does
  839.      not complete to an exact match.
  840.    * "Cautious" completion is similar to strict completion, except that
  841.      RET exits only if the text was an exact match already, not needing
  842.      completion.  If the text is not an exact match, RET does not exit,
  843.      but it does complete the text.  If it completes to an exact match,
  844.      a second RET will exit.
  845.      Cautious completion is used for reading file names for files that
  846.      must already exist.
  847.    * "Permissive" completion is used when any string whatever is
  848.      meaningful, and the list of completion alternatives is just a
  849.      guide. For example, when `C-x C-f' reads the name of a file to
  850.      visit, any file name is allowed, in case you want to create a
  851.      file.  In permissive completion, RET takes the text in the
  852.      minibuffer exactly as given, without completing it.
  853.    The completion commands display a list of all possible completions
  854. in a window whenever there is more than one possibility for the very
  855. next character.  Also, typing `?' explicitly requests such a list.  The
  856. list of completions counts as help text, so `C-M-v' typed in the
  857. minibuffer scrolls the list.
  858.    When completion is done on file names, certain file names are usually
  859. ignored.  The variable `completion-ignored-extensions' contains a list
  860. of strings; a file whose name ends in any of those strings is ignored
  861. as a possible completion.  The standard value of this variable has
  862. several elements including `".o"', `".elc"', `".dvi"' and `"~"'. The
  863. effect is that, for example, `foo' can complete to `foo.c' even though
  864. `foo.o' exists as well.  If the only possible completions are files
  865. that end in "ignored" strings, then they are not ignored.
  866.    Normally, a completion command that finds the next character is
  867. undetermined automatically displays a list of all possible completions.
  868.  If the variable `completion-auto-help' is set to `nil', this does not
  869. happen, and you must type `?' to display the possible completions.
  870.