Bit side of life

Technical notes of digital heart

The Kill Ring

| Comments

Sounds scary, but it’s not about killing (this time). Kill ring is a term used in Emacs to describe a list of cut (killed) blocks of text. Yes, that’s right. It’s about mutliple blocks of text that you can cut and paste. Emacs as an extraoridinary editor gives you ability to keep the history of what you have just killed. Be sure to close it before you start doing nasty things :)

Ok, so how to use our all-remembe-ring? Easy, as usual you need to tranform to octopus and put your 8 hands on a keyboard:

  • the C-y (yank) reinserts the text of the most recent copy/cut action
  • use M-y to iterate through the copy/cut history

For example, you might want to copy 2 block of text and subsequently paste them somewhere into your buffer. To do this, select first block and copy it (M-w), do the same with second block. Next, go to place where you want to paste it, press C-y (for most recent copied block) or C-y M-y for block(s) copied earlier.

Sometimes iterating through history might be a bit painful, in particluar when your history grows very dynamically. In this case we would like rather to see what’s in the kill ring and more interactively decide what to paste.

browse-kill-ring.el comes to rescue. put this into your load path, make it required:

    (require 'browse-kill-ring)

and use whenever you want with M-x browse-kill-ring.

To move faster between history items, use n (for next) and p (for previous) keyboard shortcuts.

But that’s not the real fun. The real fun comes when you discover anything. Install it along with anything-config and enjoy awesome anything-show-kill-ring

Comments