Emacs’ universal/prefix argument

I’ve used C-u as a prefix to many key presses in emacs and conkeror before. I never really knew what it did. Recently, I read this that show you how to repeat commands by typing M-#, where # is a number such as 5 or 100, before a command, such as C-n or 0. I’ve also read function definitions in different .el files or emacs’ documentation that speaks of function arguments. I knew that emacs commands correspond to functions, but I never knew how to pass in arguments.

Basically, C-u # and M-# (substitute # with a number) passes numeric arguments to the function called. C-u without # is equivalent to M-4. Read this for a more thorough explanation. This shows how one can “overload” a function using the prefix argument.

About Vinh Nguyen

Statistician

1 comment

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=""> <strike> <strong>