Copyright (C) 2000-2012 |
GNU Info (emacs-lisp-intro.info)Understanding rotate-yk-ptr`rotate-yank-pointer' in Outline -------------------------------- The `rotate-yank-pointer' function looks complex, but as usual, it can be understood by taking it apart piece by piece. First look at it in skeletal form: (defun rotate-yank-pointer (arg) "Rotate the yanking point in the kill ring." (interactive "p") (let VARLIST BODY...) This function takes one argument, called `arg'. It has a brief documentation string; and it is interactive with a small `p', which means that the argument must be a processed prefix passed to the function as a number. The body of the function definition is a `let' expression, which itself has a body as well as a VARLIST. The `let' expression declares a variable that will be only usable within the bounds of this function. This variable is called `length' and is bound to a value that is equal to the number of items in the kill ring. This is done by using the function called `length'. (Note that this function has the same name as the variable called `length'; but one use of the word is to name the function and the other is to name the variable. The two are quite distinct. Similarly, an English speaker will distinguish between the meanings of the word `ship' when he says: "I must ship this package immediately." and "I must get aboard the ship immediately.") The function `length' tells the number of items there are in a list, so `(length kill-ring)' returns the number of items there are in the kill ring. automatically generated by info2www version 1.2.2.9 |