Prev: Position Info Up: Basic

Numeric Arguments

   Any Emacs command can be given a "numeric argument" (also called a
"prefix argument").  Some commands interpret the argument as a
repetition count.  For example, giving an argument of ten to the key
`C-f' moves forward ten characters instead of one.  With these
commands, no argument is equivalent to an argument of one.  Negative
arguments tell most such commands to move or act in the opposite

   If your terminal keyboard has a META key, the easiest way to specify
a numeric argument is to type digits and/or a minus sign while holding
down the the META key.  For example,
     M-5 C-n

would move down five lines.  The characters `Meta-1', `Meta-2', and so
on, as well as `Meta--', do this because they are keys bound to
commands (`digit-argument' and `negative-argument') that are defined to
contribute to an argument for the next command.

   Another way of specifying an argument is to use the `C-u'
(`universal-argument') command followed by the digits of the argument.
With `C-u', you can type the argument digits without holding down shift
keys.  To type a negative argument, start with a minus sign.  Just a
minus sign normally means -1.  `C-u' works on all terminals.

   `C-u' followed by a character which is neither a digit nor a minus
sign has the special meaning of "multiply by four".  It multiplies the
argument for the next command by four.  `C-u' twice multiplies it by
sixteen.  Thus, `C-u C-u C-f' moves forward sixteen characters.  This
is a good way to move forward "fast", since it moves about 1/5 of a line
in the usual size screen.  Other useful combinations are `C-u C-n',
`C-u C-u C-n' (move down a good fraction of a screen), `C-u C-u C-o'
(make "a lot" of blank lines), and `C-u C-k' (kill four lines).

   Some commands care only about whether there is an argument, and not
about its value.  For example, the command `M-q' (`fill-paragraph') with
no argument fills text; with an argument, it justifies the text as well.
(Note: Filling, for more information on `M-q'.)  Just `C-u' is a
handy way of providing an argument for such commands.

   Some commands use the value of the argument as a repeat count, but do
something peculiar when there is no argument.  For example, the command
`C-k' (`kill-line') with argument N kills N lines, including their
terminating newlines.  But `C-k' with no argument is special: it kills
the text up to the next newline, or, if point is right at the end of
the line, it kills the newline itself.  Thus, two `C-k' commands with
no arguments can kill a nonblank line, just like `C-k' with an argument
of one.  (Note: Killing, for more information on `C-k'.)

   A few commands treat a plain `C-u' differently from an ordinary
argument.  A few others may treat an argument of just a minus sign
differently from an argument of -1.  These unusual cases will be
described when they come up; they are always for reasons of convenience
of use of the individual command.

   You can use a numeric argument to insert multiple copies of a
character.  This is straightforward unless the character is a digit.  To
prevent the digit from becoming part of the argument, type another
`C-u'.  That terminates the argument.  If you then type another digit,
then the digit acts as a self-inserting character and uses the argument
as a repeat count.

   We use the term "prefix argument" as well as "numeric argument" to
emphasize that you type the argument before the command, and to
distinguish these arguments from minibuffer arguments that come after
the command.

automatically generated by info2www