Numeric arguments in emacs

I’m starting a ’emacs trick of the day’ sequence with :

Function name : universal-argument
Typical Key sequence : C-u
How to get help : C-h f universal-argument
Usage : C-u receive a numeric argument that is given to the next called function, when no numeric argument is typed, the value defaults to 4.

So today you can try :
C-u 9 C-n # that move cursor vertically down 9 lines
C-u C-k # that kills 4 lines
C-u C-u C-k # that kills 4 * 4 = 16 lines
C-u 10 n # that enters nnnnnnnnnn
You may ask, what about if I want to input 25 ‘6’ ? C-u 256 can’t work … so you just have to separate with another C-u :
C-u 25 C-u 1 # enters 6666666666666666666666666

Some functions does not have the simple ‘repeating’ effect of receiving a numeric parameter, for example, running C-u C-l does not recenter 4 times your screen ! but the help page of recenter-top-bottom states that :
> A prefix argument is handled like `recenter':
> With numeric prefix ARG, move current line to window-line ARG.
> With plain `C-u’, move current line to window center.

A negative argument to C-l move the current line to the line ARG from the bottom of the screen.

This entry was posted in emacs. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>