[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

32.8.3 Yanking

Yanking means inserting text from the kill ring, but it does not insert the text blindly. Yank commands and some other commands use insert-for-yank to perform special processing on the text that they copy into the buffer.

Function: insert-for-yank string

This function normally works like insert except that it doesn't insert the text properties in the yank-excluded-properties list. However, if any part of string has a non-nil yank-handler text property, that property can do various special processing on that part of the text being inserted.

Function: insert-buffer-substring-as-yank buf &optional start end

This function resembles insert-buffer-substring except that it doesn't insert the text properties in the yank-excluded-properties list.

You can put a yank-handler text property on all or part of the text to control how it will be inserted if it is yanked. The insert-for-yank function looks for that property. The property value must be a list of one to four elements, with the following format (where elements after the first may be omitted):

 
(function param noexclude undo)

Here is what the elements do:

fonction

When function is present and non-nil, it is called instead of insert to insert the string. function takes one argument—the string to insert.

param

If param is present and non-nil, it replaces string (or the part of string being processed) as the object passed to function (or insert); for example, if function is yank-rectangle, param should be a list of strings to insert as a rectangle.

noexclude

If noexclude is present and non-nil, the normal removal of the yank-excluded-properties is not performed; instead function is responsible for removing those properties. This may be necessary if function adjusts point before or after inserting the object.

undo

If undo is present and non-nil, it is a function that will be called by yank-pop to undo the insertion of the current object. It is called with two arguments, the start and end of the current region. function can set yank-undo-function to override the undo value.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.