1

I have such a table

  | C                   | M                   |
  |---------------------+---------------------|
  | Character           | Word                |
  |---------------------+---------------------|

I want to swap the positions of Characters and word and perform the following operation:

  1. M-d to kill "Character" and "word" respectively.
  2. Cursor on "word" position, yank C-y and rotate with M-y, then "word" is replaced with "Character"
  3. Back to left column, do yanking with C-y, it's "Character", rotate through with M-y, it provide other content rather than "Word",

On this moment, "Word" is gone.

How could I reverse the rotating of yanking ring?

  • Not a direct answer, but one approach is to use an alternative to yank-pop that lets you select a specific entry from the kill ring. I use ivy and counsel-yank-pop for this, but I believe other completion frameworks (ido, helm) have similar capabilties. – glucas Jan 8 at 16:46
  • 2
    Here is a link to the wiki page that describes various packages to browse the kill-ring: emacswiki.org/emacs/BrowseKillRing – lawlist Jan 8 at 17:12
1

The built-in command rotate-yank-pointer does what you want, I believe. So in your example you could call M-x rotate-yank-pointer (or of course bind it to something) after yanking 'Character' so that the next yank gives you 'Word' again.

That said, this approach relies on knowing the order of the kill ring. You may get more mileage out of one of the various packages that allow browsing the kill ring to yank any arbitrary entry, as suggested elsewhere in the comments and answers.

As @lawlist noted, emacswiki.org/emacs/BrowseKillRing lists a number of such packages. I personally use counsel-yank-pop, which is built on the ivy completion framework.

0

The helm package provides the command helm-show-kill-ring as a drop-in replacement for yank-pop (ordinarily bound to M-y). It opens the kill ring in a temporary buffer and then allows you to use helm's narrowing framework to select which entry to yank. After the first call (while the helm buffer is open), further calls move you to the next entry of the kill ring.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.