www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_258.html   search  
 
Buy the book!


Programming in Emacs Lisp

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

B.1 The rotate-yank-pointer Function

The rotate-yank-pointer function changes the element in the kill ring to which kill-ring-yank-pointer points. For example, it can change kill-ring-yank-pointer from pointing to the second element to point to the third element.

Here is the code for rotate-yank-pointer:

 
(defun rotate-yank-pointer (arg)
  "Rotate the yanking point in the kill ring."
  (interactive "p")
  (let ((length (length kill-ring)))
    (if (zerop length)
        ;; then-part
        (error "Kill ring is empty")
      ;; else-part
      (setq kill-ring-yank-pointer
            (nthcdr (% (+ arg
                          (- length
                             (length
                              kill-ring-yank-pointer)))
                       length)
                    kill-ring)))))

rotate-yank-pointer in Outline  
B.1.1 The Body of rotate-yank-pointer  The body of rotate-yank-pointer.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003