GNU Info

Info Node: (emacs-lisp-intro.info)rotate-yk-ptr body

(emacs-lisp-intro.info)rotate-yk-ptr body


Prev: Understanding rotate-yk-ptr Up: rotate-yank-pointer
Enter node , (file) or (file)node

The Body of `rotate-yank-pointer'
---------------------------------

   The body of `rotate-yank-pointer' is a `let' expression and the body
of the `let' expression is an `if' expression.

   The purpose of the `if' expression is to find out whether there is
anything in the kill ring.  If the kill ring is empty, the `error'
function stops evaluation of the function and prints a message in the
echo area.  On the other hand, if the kill ring has something in it, the
work of the function is done.

   Here is the if-part and then-part of the `if' expression:

     (if (zerop length)                      ; if-part
         (error "Kill ring is empty")        ; then-part
       ...

If there is not anything in the kill ring, its length must be zero and
an error message sent to the user: `Kill ring is empty'.  The `if'
expression uses the function `zerop' which returns true if the value it
is testing is zero.  When `zerop' tests true, the then-part of the `if'
is evaluated.  The then-part is a list starting with the function
`error', which is a function that is similar to the `message' function
(Note: message), in that it prints a one-line message in the echo
area.  However, in addition to printing a message, `error' also stops
evaluation of the function within which it is embedded.  This means
that the rest of the function will not be evaluated if the length of
the kill ring is zero.

Digression concerning error
How to mislead humans, but not computers.
rotate-yk-ptr else-part
The else-part of the `if' expression.
Remainder Function
The remainder, `%', function.
rotate-yk-ptr remainder
Using `%' in `rotate-yank-pointer'.
kill-rng-yk-ptr last elt
Pointing to the last element.

automatically generated by info2www version 1.2.2.9