]> code.delx.au - gnu-emacs/blobdiff - doc/emacs/commands.texi
Update copyright year to 2016
[gnu-emacs] / doc / emacs / commands.texi
index 5f44e7cd07664456e898d9a2a6aa1ba4e62f122f..cf5ce1459c070c07e502403c4750937a52067201 100644 (file)
@@ -1,6 +1,6 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2011
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2016 Free Software
+@c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
 @chapter Characters, Keys and Commands
@@ -15,7 +15,7 @@ input.
 @raisesections
 @end ifnottex
 
-@node User Input, Keys, Screen, Top
+@node User Input
 @section Kinds of User Input
 @cindex input with the keyboard
 @cindex keyboard input
@@ -23,78 +23,70 @@ input.
 @cindex @acronym{ASCII}
 @cindex C-
 @cindex Control
-@cindex control characters
 
   GNU Emacs is primarily designed for use with the keyboard.  While it
 is possible to use the mouse to issue editing commands through the
 menu bar and tool bar, that is not as efficient as using the keyboard.
 Therefore, this manual mainly documents how to edit with the keyboard.
 
+@cindex control character
   Keyboard input into Emacs is based on a heavily-extended version of
-@acronym{ASCII}.  The simplest characters that you can input into
-Emacs correspond to graphic symbols such as @samp{a}, @samp{B},
-@samp{3}, @samp{=}, the space character (conventionally denoted as
-@key{SPC}), and so on.  Entering these using the keyboard is
-straightforward.  Certain characters found on non-English keyboards
-also fall into this category (@pxref{International}).
-
-  In addition to these simple characters, Emacs recognizes
-@dfn{control characters} such as @key{RET}, @key{TAB}, @key{DEL},
-@key{ESC}, @key{F1}, @key{Home}, @key{left}, etc.  Most keyboards have
-special keys for entering these.
+@acronym{ASCII}.  Simple characters, like @samp{a}, @samp{B},
+@samp{3}, @samp{=}, and the space character (denoted as @key{SPC}),
+are entered by typing the corresponding key.  @dfn{Control
+characters}, such as @key{RET}, @key{TAB}, @key{DEL}, @key{ESC},
+@key{F1}, @key{Home}, and @key{LEFT}, are also entered this way, as
+are certain characters found on non-English keyboards
+(@pxref{International}).
 
 @cindex modifier keys
 @cindex Control
 @cindex C-
-@cindex Meta
+@cindex META
 @cindex M-
   Emacs also recognizes control characters that are entered using
 @dfn{modifier keys}.  Two commonly-used modifier keys are
-@key{Control} (which is usually labelled as @key{Ctrl}), and
-@key{Meta} (which is usually labeled as @key{Alt})@footnote{We refer
-to @key{Alt} as @key{Meta} for historical reasons.}.  For example,
-@kbd{Control-a} is entered by holding down the @key{Ctrl} key while
-pressing @kbd{a}; we will refer to this as @kbd{C-a} for short.
-Similarly @kbd{Meta-a}, or @kbd{M-a} for short, is entered by holding
-down the @key{Alt} key and pressing @kbd{a}.
-
-@cindex @key{ESC} replacing @key{Meta} key
+@key{Control} (usually labeled @key{Ctrl}), and @key{META} (usually
+labeled @key{Alt})@footnote{We refer to @key{Alt} as @key{META} for
+historical reasons.}.  For example, @kbd{Control-a} is entered by
+holding down the @key{Ctrl} key while pressing @kbd{a}; we will refer
+to this as @kbd{C-a} for short.  Similarly @kbd{@key{META}-a}, or @kbd{M-a}
+for short, is entered by holding down the @key{Alt} key and pressing
+@kbd{a}.  Modifier keys can also be applied to non-alphanumerical
+characters, e.g., @kbd{C-@key{F1}} or @kbd{M-@key{LEFT}}.
+
+@cindex @key{ESC} replacing @key{META} key
   You can also type Meta characters using two-character sequences
 starting with @key{ESC}.  Thus, you can enter @kbd{M-a} by typing
 @kbd{@key{ESC} a}.  You can enter @kbd{C-M-a} by typing @kbd{@key{ESC}
-C-a}.  Unlike @key{Meta}, @key{ESC} is entered as a separate
+C-a}.  Unlike @key{META}, @key{ESC} is entered as a separate
 character.  You don't hold down @key{ESC} while typing the next
 character; instead, press @key{ESC} and release it, then enter the
-next character.  This feature is useful on certain text-only terminals
-where the @key{Meta} key does not function reliably.
+next character.  This feature is useful on certain text terminals
+where the @key{META} key does not function reliably.
 
-  Modifier keys can apply not only to alphanumerical characters, but
-also to special input characters, such as the arrow keys and mouse
-buttons.
+@cindex keys stolen by window manager
+@cindex window manager, keys stolen by
+  On graphical displays, the window manager might block some keyboard
+inputs, including @kbd{M-@key{TAB}}, @kbd{M-@key{SPC}}, @kbd{C-M-d}
+and @kbd{C-M-l}.  If you have this problem, you can either customize
+your window manager to not block those keys, or rebind the
+affected Emacs commands (@pxref{Customization}).
 
 @cindex input event
-  @xref{Input Events,,, elisp, The Emacs Lisp Reference Manual}, for
-the full Lisp-level details about keyboard and mouse input, which are
-collectively referred to as @dfn{input events}.  If you are not doing
-Lisp programming, but simply want to redefine the meaning of some
-characters or non-character events, see @ref{Customization}.
+  Simple characters and control characters, as well as certain
+non-keyboard inputs such as mouse clicks, are collectively referred to
+as @dfn{input events}.  For details about how Emacs internally handles
+input events, see @ref{Input Events,,, elisp, The Emacs Lisp Reference
+Manual}.
 
-@cindex keys stolen by window manager
-@cindex window manager, keys stolen by
-  On graphical displays, the window manager is likely to block the
-character @kbd{M-@key{TAB}} before Emacs can see it.  It may also
-block @kbd{M-@key{SPC}}, @kbd{C-M-d} and @kbd{C-M-l}.  If you have
-these problems, we recommend that you customize your window manager to
-turn off those commands, or put them on key combinations that Emacs
-does not use.
-
-@node Keys, Commands, User Input, Top
+@node Keys
 @section Keys
 
   Some Emacs commands are invoked by just one input event; for
-example, @kbd{C-f} moves forward one character in the buffer.  But
-Emacs also has commands that take two or more input events to invoke,
-such as @kbd{C-x C-f} and @kbd{C-x 4 C-f}.
+example, @kbd{C-f} moves forward one character in the buffer.  Other
+commands take two or more input events to invoke, such as @kbd{C-x
+C-f} and @kbd{C-x 4 C-f}.
 
 @cindex key
 @cindex key sequence
@@ -106,23 +98,23 @@ invokes a command, we call it a @dfn{complete key}; for example,
 @kbd{C-f}, @kbd{C-x C-f} and @kbd{C-x 4 C-f} are all complete keys.
 If a key sequence isn't long enough to invoke a command, we call it a
 @dfn{prefix key}; from the preceding example, we see that @kbd{C-x}
-and @kbd{C-x 4} are prefix keys.  Every key is either a complete key
-or a prefix key.
+and @kbd{C-x 4} are prefix keys.  Every key sequence is either a
+complete key or a prefix key.
 
   A prefix key combines with the following input event to make a
-longer key sequence, which may itself be complete or a prefix.  For
-example, @kbd{C-x} is a prefix key, so @kbd{C-x} and the next input
-event combine to make a two-event key sequence.  This two-event key
-sequence could itself be a prefix key (such as @kbd{C-x 4}), or a
-complete key (such as @kbd{C-x C-f}).  There is no limit to the length
-of a key sequence, but in practice people rarely use sequences longer
-than three or four input events.
-
-  You can't add input events onto a complete key.  For example, the
-two-event sequence @kbd{C-f C-k} is not a key, because the @kbd{C-f}
-is a complete key in itself, so @kbd{C-f C-k} cannot have an
-independent meaning as a command.  @kbd{C-f C-k} is two key sequences,
-not one.@refill
+longer key sequence.  For example, @kbd{C-x} is a prefix key, so
+typing @kbd{C-x} alone does not invoke a command; instead, Emacs waits
+for further input (if you pause for longer than a second, it echoes
+the @kbd{C-x} key to prompt for that input; @pxref{Echo Area}).
+@kbd{C-x} combines with the next input event to make a two-event key
+sequence, which could itself be a prefix key (such as @kbd{C-x 4}), or
+a complete key (such as @kbd{C-x C-f}).  There is no limit to the
+length of key sequences, but in practice they are seldom longer than
+three or four input events.
+
+  You can't add input events onto a complete key.  For example,
+because @kbd{C-f} is a complete key, the two-event sequence @kbd{C-f
+C-k} is two key sequences, not one.
 
   By default, the prefix keys in Emacs are @kbd{C-c}, @kbd{C-h},
 @kbd{C-x}, @kbd{C-x @key{RET}}, @kbd{C-x @@}, @kbd{C-x a}, @kbd{C-x
@@ -132,22 +124,20 @@ aliases for @kbd{C-h} and @kbd{C-x 6}.)  This list is not cast in
 stone; if you customize Emacs, you can make new prefix keys.  You
 could even eliminate some of the standard ones, though this is not
 recommended for most users; for example, if you remove the prefix
-definition of @kbd{C-x 4}, then @kbd{C-x 4 @var{anything}} would
-become an invalid key sequence.  @xref{Key Bindings}.
+definition of @kbd{C-x 4}, then @kbd{C-x 4 C-f} becomes an invalid key
+sequence.  @xref{Key Bindings}.
 
   Typing the help character (@kbd{C-h} or @key{F1}) after a prefix key
 displays a list of the commands starting with that prefix.  The sole
-exception to this rule is @key{ESC}: @kbd{@key{ESC}C-h} is equivalent
+exception to this rule is @key{ESC}: @kbd{@key{ESC} C-h} is equivalent
 to @kbd{C-M-h}, which does something else entirely.  You can, however,
-use @key{F1} to displays a list of the commands starting with
-@key{ESC}.
+use @key{F1} to display a list of commands starting with @key{ESC}.
 
-@node Commands, Entering Emacs, Keys, Top
+@node Commands
 @section Keys and Commands
 
 @cindex binding
 @cindex command
-@cindex function definition
   This manual is full of passages that tell you what particular keys
 do.  But Emacs does not assign meanings to keys directly.  Instead,
 Emacs assigns meanings to named @dfn{commands}, and then gives keys
@@ -155,11 +145,9 @@ their meanings by @dfn{binding} them to commands.
 
   Every command has a name chosen by a programmer.  The name is
 usually made of a few English words separated by dashes; for example,
-@code{next-line} or @code{forward-word}.  A command also has a
-@dfn{function definition} which is a Lisp program; this is how the
-command does its work.  In Emacs Lisp, a command is a Lisp function
-with special properties that make it suitable for interactive use.
-For more information on commands and functions, see @ref{What Is a
+@code{next-line} or @code{forward-word}.  Internally, each command is
+a special type of Lisp @dfn{function}, and the actions associated with
+the command are performed by running the function.  @xref{What Is a
 Function,, What Is a Function, elisp, The Emacs Lisp Reference
 Manual}.
 
@@ -178,7 +166,7 @@ commands, even though strictly speaking the key is bound to a command.
 Usually we state the name of the command which really does the work in
 parentheses after mentioning the key that runs it.  For example, we
 will say that ``The command @kbd{C-n} (@code{next-line}) moves point
-vertically down,'' meaning that the command @code{next-line} moves
+vertically down'', meaning that the command @code{next-line} moves
 vertically down, and the key @kbd{C-n} is normally bound to it.
 
   Since we are discussing customization, we should tell you about