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


Programming in Emacs Lisp

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

10.1 Kill Ring Overview

The kill ring is a list of textual strings. This is what it looks like:

 
("some text" "a different piece of text" "yet more text")

If this were the contents of my kill ring and I pressed C-y, the string of characters saying `some text' would be inserted in this buffer where my cursor is located.

The yank command is also used for duplicating text by copying it. The copied text is not cut from the buffer, but a copy of it is put on the kill ring and is inserted by yanking it back.

Three functions are used for bringing text back from the kill ring: yank, which is usually bound to C-y; yank-pop, which is usually bound to M-y; and rotate-yank-pointer, which is used by the two other functions.

These functions refer to the kill ring through a variable called the kill-ring-yank-pointer. Indeed, the insertion code for both the yank and yank-pop functions is:

 
(insert (car kill-ring-yank-pointer))

To begin to understand how yank and yank-pop work, it is first necessary to look at the kill-ring-yank-pointer variable and the rotate-yank-pointer function.


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