zap-to-char
Now that we have seen how search-forward
and progn
work,
we can see how the zap-to-char
function works as a whole.
The first argument to kill-region
is the position of the cursor
when the zap-to-char
command is given--the value of point at
that time. Within the progn
, the search function then moves
point to just after the zapped-to-character and point
returns the
value of this location. The kill-region
function puts together
these two values of point, the first one as the beginning of the region
and the second one as the end of the region, and removes the region.
The progn
function is necessary because the kill-region
command takes two arguments; and it would fail if search-forward
and point
expressions were written in sequence as two
additional arguments. The progn
expression is a single argument
to kill-region
and returns the one value that kill-region
needs for its second argument.
Go to the first, previous, next, last section, table of contents.