]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/basic.texi
Updates for compiling with Gtk+ 3.0 (--with-x-toolkit=gtk3).
[gnu-emacs] / doc / emacs / basic.texi
index b59831115717a63b7fde9901cc217db31773287b..edf07859e52b458261e50566d087f9828824f5e0 100644 (file)
@@ -1,6 +1,6 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
-@c   2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2011
+@c   Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Basic, Minibuffer, Exiting, Top
 @chapter Basic Editing Commands
@@ -16,15 +16,15 @@ suggest you first run the Emacs learn-by-doing tutorial, by typing
 
 * Inserting Text::      Inserting text by simply typing it.
 * Moving Point::        Moving the cursor to the place where you want to
-                         change something.
-* Erasing::            Deleting and killing text.
-* Basic Undo::         Undoing recent changes in the text.
+                          change something.
+* Erasing::             Deleting and killing text.
+* Basic Undo::          Undoing recent changes in the text.
 * Files: Basic Files.   Visiting, creating, and saving files.
 * Help: Basic Help.     Asking what a character does.
-* Blank Lines::                Making and deleting blank lines.
+* Blank Lines::         Making and deleting blank lines.
 * Continuation Lines::  How Emacs displays lines too wide for the screen.
 * Position Info::       What page, line, row, or column is point on?
-* Arguments::          Numeric arguments for repeating a command N times.
+* Arguments::           Numeric arguments for repeating a command N times.
 * Repeating::           Repeating the previous command quickly.
 @end menu
 
@@ -64,9 +64,11 @@ key; other keys act as editing commands and do not insert themselves.
 For instance, @kbd{DEL} runs the command @code{delete-backward-char}
 by default (some modes bind it to a different command); it does not
 insert a literal @samp{DEL} character (@acronym{ASCII} character code
-127).  To insert a non-graphic character, first @dfn{quote} it by
-typing @kbd{C-q} (@code{quoted-insert}).  There are two ways to use
-@kbd{C-q}:
+127).
+
+  To insert a non-graphic character, or a character that your keyboard
+does not support, first @dfn{quote} it by typing @kbd{C-q}
+(@code{quoted-insert}).  There are two ways to use @kbd{C-q}:
 
 @itemize @bullet
 @item
@@ -87,32 +89,26 @@ Overwrite mode, to give you a convenient way to insert a digit instead
 of overwriting with it.
 @end itemize
 
-@cindex 8-bit character codes
-@noindent
-If you specify a code in the octal range 0200 through 0377, @kbd{C-q}
-assumes that you intend to use some ISO 8859-@var{n} character set,
-and converts the specified code to the corresponding Emacs character
-code.  Your choice of language environment determines which of the ISO
-8859 character sets to use (@pxref{Language Environments}).  This
-feature is disabled if multibyte characters are disabled
-(@pxref{Enabling Multibyte}).
-
 @vindex read-quoted-char-radix
+@noindent
 To use decimal or hexadecimal instead of octal, set the variable
-@code{read-quoted-char-radix} to 10 or 16.  If the radix is greater than
-10, some letters starting with @kbd{a} serve as part of a character
-code, just like digits.
+@code{read-quoted-char-radix} to 10 or 16.  If the radix is 16,
+the letters @kbd{a} to @kbd{f} serve as part of a character code,
+just like digits.  Case is ignored.
 
-A numeric argument tells @kbd{C-q} how many copies of the quoted
+  A numeric argument tells @kbd{C-q} how many copies of the quoted
 character to insert (@pxref{Arguments}).
 
-@findex newline
-@findex self-insert
-  Customization information: @key{DEL} in most modes runs the command
-@code{delete-backward-char}; @key{RET} runs the command
-@code{newline}, and self-inserting printing characters run the command
-@code{self-insert}, which inserts whatever character you typed.  Some
-major modes rebind @key{DEL} to other commands.
+@findex ucs-insert
+@kindex C-x 8 RET
+@cindex Unicode
+  Instead of @kbd{C-q}, you can use @kbd{C-x 8 @key{RET}}
+(@code{ucs-insert}) to insert a character based on its Unicode name or
+code-point.  This command prompts for a character to insert, using
+the minibuffer; you can specify the character using either (i) the
+character's name in the Unicode standard, or (ii) the character's
+code-point in the Unicode standard.  If you specify the character's
+name, the command provides completion.
 
 @node Moving Point
 @section Changing the Location of Point
@@ -150,6 +146,8 @@ keyboard commands that move point in more sophisticated ways.
 @findex move-end-of-line
 @findex forward-char
 @findex backward-char
+@findex right-char
+@findex left-char
 @findex next-line
 @findex previous-line
 @findex beginning-of-buffer
@@ -165,19 +163,33 @@ Move to the beginning of the line (@code{move-beginning-of-line}).
 @itemx @key{End}
 Move to the end of the line (@code{move-end-of-line}).
 @item C-f
-@itemx @key{right}
 Move forward one character (@code{forward-char}).
+@item @key{right}
+Move one character to the right (@code{right-char}).  This
+moves one character forward in text that is read in the usual
+left-to-right direction, but one character @emph{backward} if the text
+is read right-to-left, as needed for right-to-left scripts such as
+Arabic.  @xref{Bidirectional Editing}.
 @item C-b
-@itemx @key{left}
 Move backward one character (@code{backward-char}).
+@item @key{left}
+Move one character to the left (@code{left-char}).  This
+moves one character backward in left-to-right text and one character
+forward in right-to-left text.
 @item M-f
 @itemx M-@key{right}
-@itemx C-@key{right}
 Move forward one word (@code{forward-word}).
+@item C-@key{right}
+Move one word to the right (@code{right-word}).  This moves one word
+forward in left-to-right text and one word backward in right-to-left
+text.
 @item M-b
 @itemx M-@key{left}
-@itemx C-@key{left}
 Move backward one word (@code{backward-word}).
+@item C-@key{left}
+Move one word to the left (@code{left-word}).  This moves one word
+backward in left-to-right text and one word forward in right-to-left
+text.
 @item C-n
 @itemx @key{down}
 Move down one screen line (@code{next-line}).  This command attempts
@@ -188,12 +200,17 @@ middle of one line, you move to the middle of the next.
 Move up one screen line (@code{previous-line}).  This command
 preserves position within the line, like @kbd{C-n}.
 @item M-r
-Move point to left margin, vertically centered in the window
-(@code{move-to-window-line}).  Text does not move on the screen.
+Without moving the text on the screen, reposition point on the left
+margin of the center-most text line of the window; on subsequent
+consecutive invocations, move point to the left margin of the top-most
+line, the bottom-most line, and so forth, in cyclic order
+(@code{move-to-window-line-top-bottom}).
+
 A numeric argument says which screen line to place point on, counting
 downward from the top of the window (zero means the top line).  A
 negative argument counts lines up from the bottom (@minus{}1 means the
 bottom line).
+
 @item M-<
 Move to the top of the buffer (@code{beginning-of-buffer}).  With
 numeric argument @var{n}, move to @var{n}/10 of the way from the top.
@@ -202,28 +219,31 @@ numeric argument @var{n}, move to @var{n}/10 of the way from the top.
 Move to the end of the buffer (@code{end-of-buffer}).
 @item C-v
 @itemx @key{PageDown}
-@itemx @key{PRIOR}
+@itemx @key{next}
 Scroll the display one screen forward, and move point if necessary to
 put it on the screen (@code{scroll-up}).  If your keyboard has a
-@key{PageDown} key (sometimes labelled @key{PRIOR}), it does the same
-thing as as @key{C-v}.  Scrolling commands are described further in
+@key{PageDown} key (sometimes labelled @key{next}), it does the same
+thing as @key{C-v}.  Scrolling commands are described further in
 @ref{Scrolling}.
 @item M-v
 @itemx @key{PageUp}
-@itemx @key{NEXT}
+@itemx @key{prior}
 Scroll one screen backward, and move point if necessary to put it on
 the screen (@code{scroll-down}).  If your keyboard has a @key{PageUp}
-key (sometimes labelled @key{NEXT}), it does the same thing as
-@key{M-v}.
+key (sometimes labelled @key{prior}), it does the same thing as
+@kbd{M-v}.
 @item M-x goto-char
 Read a number @var{n} and move point to buffer position @var{n}.
 Position 1 is the beginning of the buffer.
 @item M-g M-g
 @itemx M-g g
 Read a number @var{n} and move point to the beginning of line number
-@var{n} (@code{goto-line}).  Line 1 is the beginning of the buffer.
-If point is on or just after a number in the buffer, and you type
-@key{RET} with the minibuffer empty, that number is used for @var{n}.
+@var{n} (@code{goto-line}).  Line 1 is the beginning of the buffer.  If
+point is on or just after a number in the buffer, that is the default
+for @var{n}.  Just type @key{RET} in the minibuffer to use it.  You can
+also specify @var{n} by giving @kbd{M-g M-g} a numeric prefix argument.
+@xref{Select Buffer}, for the behavior of @kbd{M-g M-g} when you give it
+a plain prefix argument.
 @item C-x C-n
 @findex set-goal-column
 @kindex C-x C-n
@@ -512,9 +532,12 @@ Display the line number of point in the whole buffer.
 @itemx M-x column-number-mode
 Toggle automatic display of the current line number or column number.
 @xref{Optional Mode Line}.
-@item M-=
-Display the number of lines in the current region (@code{count-lines-region}).
-@xref{Mark}, for information about the region.
+@item M-x count-lines-region
+Display the number of lines in the current region.  Normally bound to
+@kbd{M-=}, except in a few specialist modes.  @xref{Mark}, for
+information about the region.
+@item M-x count-words-region
+Display the number of words in the current region.
 @item C-x =
 Display the character code of character after point, character position of
 point, and column of point (@code{what-cursor-position}).
@@ -535,7 +558,7 @@ Toggle automatic display of the size of the buffer.
   @kbd{M-x what-line} displays the current line number in the echo
 area.  This command is usually redundant, because the current line
 number is shown in the mode line (@pxref{Mode Line}).  However, if you
-narrow the buffer, the mode line shows the the line number relative to
+narrow the buffer, the mode line shows the line number relative to
 the accessible portion (@pxref{Narrowing}).  By contrast,
 @code{what-line} displays both the line number relative to the
 narrowed region and the line number relative to the whole buffer.
@@ -546,9 +569,9 @@ counts lines within the page, showing both numbers in the echo area.
 
 @kindex M-=
 @findex count-lines-region
-  Use @kbd{M-=} (@code{count-lines-region}) to display the number of
-lines in the region (@pxref{Mark}).  @xref{Pages}, for the command
-@kbd{C-x l} which counts the lines in the current page.
+  Use @kbd{M-x count-lines-region} (normally bound to @kbd{M-=}) to
+display the number of lines in the region (@pxref{Mark}).  @xref{Pages},
+for the command @kbd{C-x l} which counts the lines in the current page.
 
 @kindex C-x =
 @findex what-cursor-position
@@ -607,7 +630,7 @@ direction.
 @kindex M-@t{-}
 @findex digit-argument
 @findex negative-argument
-  The easiest way to specify a numeric argument is to type digits
+  The easiest way to specify a numeric argument is to type a digit
 and/or a minus sign while holding down the @key{META} key.  For
 example,
 
@@ -621,13 +644,32 @@ well as @kbd{M--}, are bound to commands (@code{digit-argument} and
 @code{negative-argument}) that set up an argument for the next
 command.  @kbd{Meta--} without digits normally means @minus{}1.
 
+If you enter more than one digit, you need not hold down the
+@key{META} key for the second and subsequent digits.  Thus, to move
+down fifty lines, type
+
+@example
+M-5 0 C-n
+@end example
+
+@noindent
+Note that this @emph{does not} insert five copies of @samp{0} and move
+down one line, as you might expect---the @samp{0} is treated as part
+of the prefix argument.
+
+(What if you do want to insert five copies of @samp{0}?  Type @kbd{M-5
+C-u 0}.  Here, @kbd{C-u} ``terminates'' the prefix argument, so that
+the next keystroke begins the command that you want to execute.  Note
+that this meaning of @kbd{C-u} applies only to this case.  For the
+usual role of @kbd{C-u}, see below.)
+
 @kindex C-u
 @findex universal-argument
-  You can also specify a numeric argument by typing @kbd{C-u}
-(@code{universal-argument}) followed by the digits.  The advantage of
-@kbd{C-u} is that you can type the digits without holding down the
-@key{META} key.  For a negative argument, type a minus sign after
-@kbd{C-u}.  A minus sign without digits normally means @minus{}1.
+  Instead of typing @kbd{M-1}, @kbd{M-2}, and so on, another way to
+specify a numeric argument is to type @kbd{C-u}
+(@code{universal-argument}) followed by some digits, or (for a
+negative argument) a minus sign followed by digits.  A minus sign
+without digits normally means @minus{}1.
 
   @kbd{C-u} alone has the special meaning of ``four times'': it
 multiplies the argument for the next command by four.  @kbd{C-u C-u}
@@ -701,7 +743,3 @@ characters.  You can repeat that command (including its argument) three
 additional times, to delete a total of 80 characters, by typing @kbd{C-x
 z z z}.  The first @kbd{C-x z} repeats the command once, and each
 subsequent @kbd{z} repeats it once again.
-
-@ignore
-   arch-tag: cda8952a-c439-41c1-aecf-4bc0d6482956
-@end ignore