Addendum: Raw Prefix Argument

The variable current-prefix-arg always contains the latest "raw" prefix argument, which is the same thing you get from

(interactive "P")

The function prefix-numeric-value can be applied to a "raw" prefix argument to get its numeric value, which is the same thing you get from

(interactive "p")

What does a raw prefix argument look like? Table 2-1 shows possible raw values along with their corresponding numeric values.

Table 2-1. Prefix arguments

If the User Types

Raw Value

Numeric Value

C-u followed by a (possibly negative) number

The number itself

The number itself

C-u - (with no following number)

The symbol -

-1

C-u n times in a row (with no following number or minus sign)

A list containing the number 4n

4n itself

No prefix argument

nil

1

Get Writing GNU Emacs Extensions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.