Emacs: How to move forward (after going back) into the kill ring?

I understand that after yanking ( Cy ) I can move back through the kill ring ( My ). But sometimes I move past the desired Yankee - is there a way to move forward in the kill ring? Basically, I want the opposite of My .

If this is a duplicate, just let me know. I can not find the answer on SO or Google.

+7
emacs
source share
3 answers

You can prefix arguments with yank-pop . From Ch f yank-pop RET documentation

Without an argument, the previous kill is inserted. With argument N, insert the Nth previous kill. If N is negative, this is a more recent kill.

So, for example, to move "forward" one record after yanking, you can make Cu - 1 My . You can also just use undo , as @seanmcl suggests.

Itโ€™s hard to keep track of kill-ring entries. Therefore, I would recommend an extension, for example browse-kill-ring , which displays a kill ring and allows you to select the text you want to pull out.

+5
source share

You can simply โ€œcancelโ€ when you pass it. Repeated bounces will constantly move forward. I agree with @Iqbai, although this viewing ring is more suitable for long chains of Yankees.

+4
source share

There is also M-- My , which is the shorter equivalent of Cu - 1 My .

+3
source share

All Articles