]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/basic.texi
; Merge from origin/emacs-25
[gnu-emacs] / doc / emacs / basic.texi
index 16ccdba086635d215af006c3ea008d68d37742f8..68581d03a85d9b62089f57e0c506bda94ba0cc18 100644 (file)
@@ -1,6 +1,7 @@
+@c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2012
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2016 Free Software
+@c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Basic
 @chapter Basic Editing Commands
@@ -40,14 +41,20 @@ forward, so that point remains just after the inserted text.
 @xref{Point}.
 
 @kindex RET
+@kindex C-j
 @cindex newline
+@c @findex electric-indent-just-newline
   To end a line and start a new one, type @key{RET} (@code{newline}).
 (The @key{RET} key may be labeled @key{Return} or @key{Enter} on your
 keyboard, but we refer to it as @key{RET} in this manual.)  This
-command inserts a newline character into the buffer.  If point is at
-the end of the line, the effect is to create a new blank line after
-it; if point is in the middle of a line, the line is split at that
-position.
+command inserts a newline character into the buffer, then indents
+(@pxref{Indentation}) according to the major mode.  If point is at the end
+of the line, the effect is to create a new blank line after it and
+indent the new line; if point is in the middle of a line, the line is
+split at that position.  To turn off the auto-indentation, you can
+either disable Electric Indent mode (@pxref{Indent Convenience}) or
+type @kbd{C-j}, which inserts just a newline, without any
+auto-indentation.
 
   As we explain later in this manual, you can change the way Emacs
 handles text insertion by turning on @dfn{minor modes}.  For instance,
@@ -61,7 +68,7 @@ instead of shoving it to the right.  @xref{Minor Modes}.
 @findex quoted-insert
   Only graphic characters can be inserted by typing the associated
 key; other keys act as editing commands and do not insert themselves.
-For instance, @kbd{DEL} runs the command @code{delete-backward-char}
+For instance, @key{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).
@@ -98,27 +105,50 @@ the letters @kbd{a} to @kbd{f} serve as part of a character code,
 just like digits.  Case is ignored.
 
 @findex insert-char
-@kindex C-x 8 RET
+@kindex C-x 8
 @cindex Unicode characters, inserting
 @cindex insert Unicode character
 @cindex characters, inserting by name or code-point
+@cindex curly quotes
+@cindex curved quotes
+  A few common Unicode characters can be inserted via a command
+starting with @kbd{C-x 8}.  For example, @kbd{C-x 8 [} inserts @t{‘}
+which is Unicode code-point @code{U+2018} LEFT SINGLE QUOTATION MARK,
+sometimes called a left single ``curved quote'' or ``curly quote''.
+Similarly, @kbd{C-x 8 ]}, @kbd{C-x 8 @{} and @kbd{C-x 8 @}} insert the
+curved quotes @t{’}, @t{“} and @t{”}, respectively.  Also, a working
+Alt key acts like @kbd{C-x 8}; e.g., @kbd{A-[} acts like @kbd{C-x 8 [}
+and inserts @t{‘}.  To see which characters have @kbd{C-x 8}
+shorthands, type @kbd{C-x 8 C-h}.
+
   Alternatively, you can use the command @kbd{C-x 8 @key{RET}}
 (@code{insert-char}).  This prompts for the Unicode name or code-point
 of a character, using the minibuffer.  If you enter a name, the
 command provides completion (@pxref{Completion}).  If you enter a
 code-point, it should be as a hexadecimal number (the convention for
-Unicode), or a number with a specified radix, e.g.@: @code{#o23072}
+Unicode), or a number with a specified radix, e.g., @code{#o23072}
 (octal); @xref{Integer Basics,,, elisp, The Emacs Lisp Reference
 Manual}.  The command then inserts the corresponding character into
-the buffer.  For example, both of the following insert the infinity
-sign (Unicode code-point @code{U+221E}):
+the buffer.
+
+  In some contexts, if you type a quotation using grave accent and
+apostrophe @t{`like this'}, it is converted to a form @t{‘like this’}
+using single quotation marks.  Similarly, typing a quotation @t{``like
+this''} using double grave accent and apostrophe converts it to a form
+@t{“like this”} using double quotation marks.  @xref{Quotation Marks}.
+
+  For example, the following all insert the same character:
 
 @example
-@kbd{C-x 8 @key{RET} infinity @key{RET}}
-@kbd{C-x 8 @key{RET} 221e @key{RET}}
+@kbd{C-x 8 @key{RET} left single quotation mark @key{RET}}
+@kbd{C-x 8 @key{RET} left sin @key{TAB} @key{RET}}
+@kbd{C-x 8 @key{RET} 2018 @key{RET}}
+@kbd{C-x 8 [}
+@kbd{A-[}  @r{(if the Alt key works)}
+@kbd{`}    @r{(in Electric Quote mode)}
 @end example
 
-  A numeric argument to @kbd{C-q} or @kbd{C-x 8 @key{RET}} specifies
+  A numeric argument to @kbd{C-q} or @kbd{C-x 8 ...} specifies
 how many copies of the character to insert (@pxref{Arguments}).
 
 @node Moving Point
@@ -133,8 +163,8 @@ how many copies of the character to insert (@pxref{Arguments}).
 point (@pxref{Point}).  The keyboard commands @kbd{C-f}, @kbd{C-b},
 @kbd{C-n}, and @kbd{C-p} move point to the right, left, down, and up,
 respectively.  You can also move point using the @dfn{arrow keys}
-present on most keyboards: @kbd{@key{right}}, @kbd{@key{left}},
-@kbd{@key{down}}, and @kbd{@key{up}}; however, many Emacs users find
+present on most keyboards: @key{RIGHT}, @key{LEFT},
+@key{DOWN}, and @key{UP}; however, many Emacs users find
 that it is slower to use the arrow keys than the control keys, because
 you need to move your hand to the area of the keyboard where those
 keys are located.
@@ -150,28 +180,38 @@ keyboard commands that move point in more sophisticated ways.
 @findex forward-char
 Move forward one character (@code{forward-char}).
 
-@item @key{right}
+@item @key{RIGHT}
 @kindex RIGHT
 @findex right-char
+@vindex visual-order-cursor-movement
+@cindex cursor, visual-order motion
 This command (@code{right-char}) behaves like @kbd{C-f}, with one
 exception: when editing right-to-left scripts such as Arabic, it
 instead moves @emph{backward} if the current paragraph is a
-right-to-left paragraph.  @xref{Bidirectional Editing}.
+right-to-left paragraph.  @xref{Bidirectional Editing}.  If
+@code{visual-order-cursor-movement} is non-@code{nil}, this command
+moves to the character that is to the right of the current screen
+position, moving to the next or previous screen line as appropriate.
+Note that this might potentially move point many buffer positions
+away, depending on the surrounding bidirectional context.
 
 @item C-b
 @kindex C-b
 @findex backward-char
 Move backward one character (@code{backward-char}).
 
-@item @key{left}
+@item @key{LEFT}
 @kindex LEFT
 @findex left-char
 This command (@code{left-char}) behaves like @kbd{C-b}, except it
 moves @emph{forward} if the current paragraph is right-to-left.
-@xref{Bidirectional Editing}.
+@xref{Bidirectional Editing}.  If @code{visual-order-cursor-movement}
+is non-@code{nil}, this command moves to the character that is to the
+left of the current screen position, moving to the previous or next
+screen line as appropriate.
 
 @item C-n
-@itemx @key{down}
+@itemx @key{DOWN}
 @kindex C-n
 @kindex DOWN
 @findex next-line
@@ -180,7 +220,7 @@ to keep the horizontal position unchanged, so if you start in the
 middle of one line, you move to the middle of the next.
 
 @item C-p
-@itemx @key{up}
+@itemx @key{UP}
 @kindex C-p
 @kindex UP
 @findex previous-line
@@ -190,14 +230,14 @@ preserves position within the line, like @kbd{C-n}.
 @item C-a
 @itemx @key{Home}
 @kindex C-a
-@kindex HOME
+@kindex HOME key
 @findex move-beginning-of-line
 Move to the beginning of the line (@code{move-beginning-of-line}).
 
 @item C-e
 @itemx @key{End}
 @kindex C-e
-@kindex END
+@kindex END key
 @findex move-end-of-line
 Move to the end of the line (@code{move-end-of-line}).
 
@@ -206,8 +246,8 @@ Move to the end of the line (@code{move-end-of-line}).
 @findex forward-word
 Move forward one word (@code{forward-word}).
 
-@item C-@key{right}
-@itemx M-@key{right}
+@item C-@key{RIGHT}
+@itemx M-@key{RIGHT}
 @kindex C-RIGHT
 @kindex M-RIGHT
 @findex right-word
@@ -220,12 +260,12 @@ right-to-left.  @xref{Bidirectional Editing}.
 @findex backward-word
 Move backward one word (@code{backward-word}).
 
-@item C-@key{left}
-@itemx M-@key{left}
+@item C-@key{LEFT}
+@itemx M-@key{LEFT}
 @kindex C-LEFT
 @kindex M-LEFT
 @findex left-word
-This command (@code{left-word}) behaves like @kbd{M-f}, except it
+This command (@code{left-word}) behaves like @kbd{M-b}, except it
 moves @emph{forward} by one word if the current paragraph is
 right-to-left.  @xref{Bidirectional Editing}.
 
@@ -267,7 +307,8 @@ necessary (@code{scroll-up-command}).  @xref{Scrolling}.
 Scroll one screen backward, and move point onscreen if necessary
 (@code{scroll-down-command}).  @xref{Scrolling}.
 
-@item M-x goto-char
+@item M-g c
+@kindex M-g c
 @findex goto-char
 Read a number @var{n} and move point to buffer position @var{n}.
 Position 1 is the beginning of the buffer.
@@ -285,6 +326,13 @@ 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 M-g @key{TAB}
+@kindex M-g TAB
+@findex move-to-column
+Read a number @var{n} and move to column @var{n} in the current line.
+Column 0 is the leftmost column.  If called with a prefix argument,
+move to the column number specified by the argument's numeric value.
+
 @item C-x C-n
 @kindex C-x C-n
 @findex set-goal-column
@@ -342,7 +390,7 @@ moves down into it.
 
 @table @kbd
 @item @key{DEL}
-@itemx @key{Backspace}
+@itemx @key{BACKSPACE}
 Delete the character before point, or the region if it is active
 (@code{delete-backward-char}).
 
@@ -370,20 +418,20 @@ the preceding newline, joining this line to the previous one.
   If, however, the region is active, @kbd{@key{DEL}} instead deletes
 the text in the region.  @xref{Mark}, for a description of the region.
 
-  On most keyboards, @key{DEL} is labeled @key{Backspace}, but we
+  On most keyboards, @key{DEL} is labeled @key{BACKSPACE}, but we
 refer to it as @key{DEL} in this manual.  (Do not confuse @key{DEL}
 with the @key{Delete} key; we will discuss @key{Delete} momentarily.)
 On some text terminals, Emacs may not recognize the @key{DEL} key
 properly.  @xref{DEL Does Not Delete}, if you encounter this problem.
 
-  The @key{delete} (@code{delete-forward-char}) command deletes in the
-``opposite direction'': it deletes the character after point, i.e. the
+  The @key{Delete} (@code{delete-forward-char}) command deletes in the
+opposite direction: it deletes the character after point, i.e., the
 character under the cursor.  If point was at the end of a line, this
 joins the following line onto this one.  Like @kbd{@key{DEL}}, it
 deletes the text in the region if the region is active (@pxref{Mark}).
 
   @kbd{C-d} (@code{delete-char}) deletes the character after point,
-similar to @key{delete}, but regardless of whether the region is
+similar to @key{Delete}, but regardless of whether the region is
 active.
 
   @xref{Deletion}, for more detailed information about the above
@@ -619,12 +667,16 @@ narrowed region and the line number relative to the whole buffer.
 
 @kindex M-=
 @findex count-words-region
-@findex count-words
   @kbd{M-=} (@code{count-words-region}) displays a message reporting
-the number of lines, words, and characters in the region.  @kbd{M-x
-count-words} displays a similar message for the entire buffer, or for
-the region if the region is @dfn{active}.  @xref{Mark}, for an
-explanation of the region.
+the number of lines, words, and characters in the region
+(@pxref{Mark}, for an explanation of the region).  With a prefix
+argument, @kbd{C-u M-=}, the command displays a count for the entire
+buffer.
+
+@findex count-words
+  The command @kbd{M-x count-words} does the same job, but with a
+different calling convention.  It displays a count for the region if
+the region is active, and for the buffer otherwise.
 
 @kindex C-x =
 @findex what-cursor-position
@@ -695,7 +747,7 @@ M-5 C-n
 moves down five lines.  The keys @kbd{M-1}, @kbd{M-2}, and so on, as
 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.
+command.  @kbd{M--} 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
@@ -711,7 +763,7 @@ 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
+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.)
@@ -729,7 +781,7 @@ multiplies the argument for the next command by four.  @kbd{C-u C-u}
 multiplies it by sixteen.  Thus, @kbd{C-u C-u C-f} moves forward
 sixteen characters.  Other useful combinations are @kbd{C-u C-n},
 @kbd{C-u C-u C-n} (move down a good fraction of a screen), @kbd{C-u
-C-u C-o} (make ``a lot'' of blank lines), and @kbd{C-u C-k} (kill four
+C-u C-o} (make sixteen blank lines), and @kbd{C-u C-k} (kill four
 lines).
 
   You can use a numeric argument before a self-inserting character to
@@ -745,7 +797,8 @@ the character @samp{1}.
 value.  For example, the command @kbd{M-q} (@code{fill-paragraph})
 fills text; with an argument, it justifies the text as well.
 (@xref{Filling}, for more information on @kbd{M-q}.)  For these
-commands, it is enough to the argument with a single @kbd{C-u}.
+commands, it is enough to specify the argument with a single
+@kbd{C-u}.
 
   Some commands use the value of the argument as a repeat count, but
 do something special when there is no argument.  For example, the
@@ -764,10 +817,10 @@ described when they come up; they exist to make an individual command
 more convenient, and they are documented in that command's
 documentation string.
 
-  We use the term ``prefix argument'' as well as ``numeric argument'',
-to emphasize that you type these argument before the command, and to
-distinguish them from minibuffer arguments that come after the
-command.
+  We use the term @dfn{prefix argument} to emphasize that you type
+such arguments before the command, and to distinguish them from
+minibuffer arguments (@pxref{Minibuffer}), which are entered after
+invoking the command.
 
 @node Repeating
 @section Repeating a Command