Next: The Body of
zap-to-char, Previous: The Complete
zap-to-char Implementation, Up:
The interactive expression in the
zap-to-char command looks like
(interactive "p\ncZap to char: ")
The part within quotation marks,
"p\ncZap to char: ", specifies
two different things. First, and most simply, is the ‘p’.
This part is separated from the next part by a newline, ‘\n’.
The ‘p’ means that the first argument to the function will be
passed the value of a processed prefix. The prefix argument is
passed by typing C-u and a number, or M- and a number. If
the function is called interactively without a prefix, 1 is passed to
The second part of
"p\ncZap to char: " is
‘cZap to char: ’. In this part, the lower case ‘c’
interactive expects a prompt and that the
argument will be a character. The prompt follows the ‘c’ and is
the string ‘Zap to char: ’ (with a space after the colon to
make it look good).
What all this does is prepare the arguments to
zap-to-char so they
are of the right type, and give the user a prompt.
In a read-only buffer, the
zap-to-char function copies the text
to the kill ring, but does not remove it. The echo area displays a
message saying that the buffer is read-only. Also, the terminal may
beep or blink at you.