Node:rotate-yank-pointer, Next:yank, Previous:Kill Ring, Up:Kill Ring
rotate-yank-pointer function changes the element in the kill
ring to which
kill-ring-yank-pointer points. For example, it can
kill-ring-yank-pointer from pointing to the second
element to point to the third element.
Here is the code for
(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)))))