When I press C-h k C-SPC, Emacs shows me:

C-SPC runs the command set-mark-command (found in global-map), which is an interactive compiled Lisp function.

It is bound to C-@, C-SPC.

(set-mark-command ARG)

Set the mark where point is, and activate it; or jump to the mark. Setting the mark also alters the region, which is the text between point and mark; this is the closest equivalent in Emacs to what some editors call the "selection".

With no prefix argument, set the mark at point, and push the old mark position on local mark ring. Also push the new mark on global mark ring, if the previous mark was set in another buffer.

When Transient Mark Mode is off, immediately repeating this command activates ‘transient-mark-mode’ temporarily.

With prefix argument (e.g., C-u C-SPC), jump to the mark, and set the mark from position popped off the local mark ring (this does not affect the global mark ring). Use C-x C-@ to jump to a mark popped off the global mark ring (see ‘pop-global-mark’).

If ‘set-mark-command-repeat-pop’ is non-nil, repeating the C-SPC command with no prefix argument pops the next position off the local (or global) mark ring and jumps there.

With C-u C-u as prefix argument, unconditionally set mark where point is, even if ‘set-mark-command-repeat-pop’ is non-nil.

Novice Emacs Lisp programmers often try to use the mark for the wrong purposes. See the documentation of ‘set-mark’ for more information.


I don't see where it says what it chooses for ARG. Apparently, set-mark-command needs an argument because evaluating (set-mark-command) results in an error.

How do I find out about the argument passed to set-mark-command when I hit C-SPC?

1 Answer 1


set-mark-command (as the name suggests) is meant to be used as a command and not called as a function. For that reason, the docstring talks about the interactive uses rather than the case where you call it from Elisp code.

Once you're familiar with the "universal prefix argument" in Elisp, you can mostly decode the above docstring and guess that ARG will be nil if there's "no prefix argument" and will be (16) when the user pressed "C-u C-u as prefix argument".

To find out in detail you'd have to look at the definition of the set-mark-command function, more specifically at its interactive spec:

(interactive "P")

which says that the first argument of the function (i.e. ARG) will take the value of the variable current-prefix-arg (which holds the previous value of prefix-arg, that variable being set by the prefix commands universal-argument and digit-argument), as documented (not quite precisely enough) in the docstring of interactive:

P -- Prefix arg in raw form.  Does not do I/O.
  • So do key bindings never pass anything except the prefix argument to the function they're bound to? And then you only need to check what the interactive line passes to the function?
    – UTF-8
    May 14, 2018 at 20:23
  • Of course not: the docstring of interactive lists all kinds of other things you can pass to commands this way, E.g. C-x C-f (aka find-file) passes the file name (after prompting for it in the minibuffer).
    – Stefan
    May 15, 2018 at 1:48
  • Ah, so the interactive line is evaluated when the function is called via a key binding or via M-x? Emacs runs find-file-read-args from find-file's interactive line and the result is passed to find-file when it is called right afterwards?
    – UTF-8
    May 15, 2018 at 12:09
  • @UTF-8: Exactly: the interactive spec is used to build the list of arguments that are then passed to the function.
    – Stefan
    May 15, 2018 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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