In the terminology of mathematics and computing, argument means “data provided to a function or operation”. You can give any Emacs command a numeric argument (also called a prefix argument). Some commands interpret the argument as a repetition count. For example, giving C-f an argument of ten causes it to move point forward by ten characters instead of one. With these commands, no argument is equivalent to an argument of one, and negative arguments cause them to move or act in the opposite direction.
The easiest way to specify a numeric argument is to type a digit and/or a minus sign while holding down the META key. For example,
moves down five lines. The keys M-1, M-2, and so on, as
well as M--, are bound to commands (
negative-argument) that set up an argument for the next
command. M-- without digits normally means -1.
If you enter more than one digit, you need not hold down the META key for the second and subsequent digits. Thus, to move down fifty lines, type
M-5 0 C-n
Note that this does not insert five copies of ‘0’ and move down one line, as you might expect—the ‘0’ is treated as part of the prefix argument.
(What if you do want to insert five copies of ‘0’? Type M-5 C-u 0. Here, C-u terminates the prefix argument, so that the next keystroke begins the command that you want to execute. Note that this meaning of C-u applies only to this case. For the usual role of C-u, see below.)
Instead of typing M-1, M-2, and so on, another way to
specify a numeric argument is to type C-u
universal-argument) followed by some digits, or (for a
negative argument) a minus sign followed by digits. A minus sign
without digits normally means -1.
C-u alone has the special meaning of “four times”: it multiplies the argument for the next command by four. C-u C-u multiplies it by sixteen. Thus, C-u C-u C-f moves forward sixteen characters. 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 sixteen blank lines), and C-u C-k (kill four lines).
You can use a numeric argument before a self-inserting character to insert multiple copies of it. This is straightforward when the character is not a digit; for example, C-u 6 4 a inserts 64 copies of the character ‘a’. But this does not work for inserting digits; C-u 6 4 1 specifies an argument of 641. You can separate the argument from the digit to insert with another C-u; for example, C-u 6 4 C-u 1 does insert 64 copies of the character ‘1’.
Some commands care whether there is an argument, but ignore its
value. For example, the command M-q (
fills text; with an argument, it justifies the text as well.
(See Filling, for more information on M-q.) For these
commands, it is enough to specify the argument with a single
Some commands use the value of the argument as a repeat count, but
do something special 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.
(See 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 are 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 to emphasize that you type such arguments before the command, and to distinguish them from minibuffer arguments (see Minibuffer), which are entered after invoking the command.