I know that C-u sends the prefix 4
. Is there any way to make C-u <key> a special case of a command, while still allowing C-u 4 <key>?
4
8
Sure. Use the raw prefix argument instead:
(defun my-prefix-test (arg)
(interactive "P")
(cond
((consp arg) (message "Prefix argument"))
((numberp arg) (message "Numeric argument"))
((eq '- arg) (message "Negative argument"))
((not arg) (message "No argument"))))
As you can see, current-prefix-arg
can be a list, a number, -
or nil
.