Next: Lossage Prev: Customization Up: Top

Quitting and Aborting

     Quit.  Cancel running or partially typed command.

     Abort innermost recursive editing level and cancel the command
     which invoked it (`abort-recursive-edit').

`M-x top-level'
     Abort all recursive editing levels that are currently executing.

`C-x u'
     Cancel an already-executed command, usually (`undo').

   There are two ways of cancelling commands which are not finished
executing: "quitting" with `C-g', and "aborting" with `C-]' or `M-x
top-level'.  Quitting cancels a partially typed command or one which is
already running.  Aborting exits a recursive editing level and cancels
the command that invoked the recursive edit.  (Note: Recursive Edit.)

   Quitting with `C-g' is used for getting rid of a partially typed
command, or a numeric argument that you don't want.  It also stops a
running command in the middle in a relatively safe way, so you can use
it if you accidentally give a command which takes a long time.  In
particular, it is safe to quit out of killing; either your text will
*all* still be in the buffer, or it will *all* be in the kill ring (or
maybe both).  Quitting an incremental search does special things
documented under searching; in general, it may take two successive
`C-g' characters to get out of a search.

   `C-g' works by setting the variable `quit-flag' to `t' the instant
`C-g' is typed; Emacs Lisp checks this variable frequently and quits if
it is non-`nil'.  `C-g' is only actually executed as a command if you
type it while Emacs is waiting for input.

   If you quit with `C-g' a second time before the first `C-g' is
recognized, you activate the "emergency escape" feature and return to
the shell.  Note: Emergency Escape.

   There may be times when you cannot quit.  When Emacs is waiting for
the operating system to do something, quitting is impossible unless
special pains are taken for the particular system call within Emacs
where the waiting occurs.  We have done this for the system calls that
users are likely to want to quit from, but it's possible you will find
another.  In one very common case--waiting for file input or output
using NFS--Emacs itself knows how to quit, but most NFS implementations
simply do not allow user programs to stop waiting for NFS when the NFS
server is hung.

   Aborting with `C-]' (`abort-recursive-edit') is used to get out of a
recursive editing level and cancel the command which invoked it.
Quitting with `C-g' does not do this, and could not do this, because it
is used to cancel a partially typed command *within* the recursive
editing level.  Both operations are useful.  For example, if you are in
a recursive edit and type `C-u 8' to enter a numeric argument, you can
cancel that argument with `C-g' and remain in the recursive edit.

   The command `M-x top-level' is equivalent to "enough" `C-]' commands
to get you out of all the levels of recursive edits that you are in.
`C-]' gets you out one level at a time, but `M-x top-level' goes out
all levels at once.  Both `C-]' and `M-x top-level' are like all other
commands, and unlike `C-g', in that they are effective only when Emacs
is ready for a command.  `C-]' is an ordinary key and has its meaning
only because of its binding in the keymap.  Note: Recursive Edit.

   `C-x u' (`undo') is not strictly speaking a way of cancelling a
command, but you can think of it as cancelling a command already
finished executing.  Note: Undo.

automatically generated by info2www