Next: , Previous: , Up: Altering and Searching Text   [Contents][Index]


4.3 Kill Ring

Variable: *kill-ring*

This is a ring (see section rings) of regions deleted from buffers. Some commands save affected regions on the kill ring before performing modifications. You should consider making the command undoable (see section undo), but this is a simple way of achieving a less satisfactory means for the user to recover.

Function: kill-region region current-type

This kills region saving it in kill-ring. Current-type is either :kill-forward or :kill-backward. When the last-command-type is one of these, this adds region to the beginning or end, respectively, of the top of kill-ring. The result of calling this is undoable using the command Undo (see the Hemlock User’s Manual). This sets last-command-type to current-type, and it interacts with kill-characters.

Hemlock Variable: Character Deletion Threshold (initial value 5)
Function: Function kill-characters mark count

kill-characters kills count characters after mark if count is positive, otherwise before mark if count is negative. When count is greater than or equal to Character Deletion Threshold, the killed characters are saved on kill-ring. This may be called multiple times contiguously (that is, without last-command-type being set) to accumulate an effective count for purposes of comparison with the threshold.

This sets last-command-type, and it interacts with kill-region. When this adds a new region to kill-ring, it sets last-command-type to :kill-forward (if count is positive) or :kill-backward (if count is negative). When last-command-type is :kill-forward or :kill-backward, this adds the killed characters to the beginning (if count is negative) or the end (if count is positive) of the top of kill-ring, and it sets last-command-type as if it added a new region to kill-ring. When the kill ring is unaffected, this sets last-command-type to :char-kill-forward or :char-kill-backward depending on whether count is positive or negative, respectively.

This returns mark if it deletes characters. If there are not count characters in the appropriate direction, this returns nil.


Next: Active Regions, Previous: Text Predicates, Up: Altering and Searching Text   [Contents][Index]