(defun foo (raw num)
(interactive "P\np")
(message "RAW: %S, Numeric: %S" raw num))
Now try M-x foo
with different prefix args. The message will tell you how interactive
handles P
and p
.
Your error is from function message
, which C-h f
will tell you expects a string as its first arg. Your first call to message
calls it with whatever you used as the raw prefix argument.
M-x set-variable RET debug-on-error RET t
enters the debugger when an error is raised, so you can see directly what your problem is.
Read about prefix arguments. In the Elisp manual (C-h i m elisp
), i prefix argument
takes you to node Prefix Command Arguments, which tells you all about it.
And if you're going to write Elisp code you owe it to yourself to read the manual An Introduction to Programming in Emacs Lisp, also available with C-h i
.