Emacs’ universal/prefix argument

Emacs
Author

Vinh Nguyen

Published

October 20, 2010

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 [[http://www.gnu.org/software/emacs/manual/html_ node/emacs/Arguments.html][this]] for a more thorough explanation. This shows how one can "overload" a function using the prefix argument.