interactive
Expression
The interactive expression in the zap-to-char
command looks like
this:
(interactive "*p\ncZap to char: ")
The part within quotation marks, "*p\ncZap to char: "
, specifies
three different things. First, and most simply, the asterisk, `*',
causes an error to be signalled if the buffer is read-only. This means that
if you try zap-to-char
in a read-only buffer you will not be able to
remove text, and you will receive a message that says "Buffer is
read-only"; your terminal may beep at you as well.
The second part of "*p\ncZap to char: "
is the `p'. This
part is ended 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 this argument.
The third part of "*p\ncZap to char: "
is `cZap to char:
'. In this part, the lower case `c' indicates that
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.
Go to the first, previous, next, last section, table of contents.