9

Suppose I want to type '222222' in emacs, how do I use the numeric prefix idiom to achieve this? A naive guess would be 'C-u 6 2' but emacs interprets this as a numeric prefix of 62 and waits for the next command.

15

C-u 6 C-u 2

Documentation for universal-argument (emphasis mine):

Begin a numeric argument for the following command.
Digits or minus sign following C-u make up the numeric argument.
C-u following the digits or minus sign ends the argument.
C-u without digits or minus sign provides 4 as argument.
Repeating C-u without digits or minus sign
multiplies the argument by 4 each time.
For some commands, just C-u by itself serves as a flag
which is different in effect from any particular numeric argument.
These commands include C-SPC and M-x start-kbd-macro.

You can find this documentation by typing C-h k C-u or M-x describe-function RET universal-argument RET.

3

Your question title doesn't match the body text?

If you want to "repeat a number" (singular), nanny's answer has you covered.

If (as per the title) you want to "repeat a list of numbers", I would use a keyboard macro. e.g.:

<f3> 12345 C-u6<f4>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.