[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Annoying kill-ring behavior

From: Smith_RS
Subject: Re: Annoying kill-ring behavior
Date: Fri, 4 Apr 2014 00:00:43 -0700 (PDT)
User-agent: G2/1.0

On Thursday, April 3, 2014 9:34:25 PM UTC-7, Joost Kremers wrote:
> Did you check the doc string of `kill-ring'? There, you'll find the
> warning not to use that variable directly. There are functions to update
> the kill ring that you should use instead:

[ ... ]

> And although it doesn't say so, looking at the source shows that
> the yank menu is also updated.

I know, I wanted to see if it could be done.

But you raise a valid point. What I found was that if I modified kill-ring I 
had to also modify

In the simplest case you can do this, and get a clean slate:

(setq kill-ring nil)
(setq kill-ring-yank-pointer nil)

If you edit the kill-ring like this (my original problem was empty strings):

(setq kill-ring (remove "" kill-ring))

You have to do this:

(setq kill-ring-yank-pointer kill-ring)

These two web pages were helpful

So, yes, I'm still confused about what the real difference is between kill-ring 
kill-ring-yank-pointer, but I was able to get the behavior I wanted.

It took some more digging to fix yank-menu, but I got this to work:

(setcdr yank-menu nil)
(dolist (str kill-ring)
  (menu-bar-update-yank-menu str nil))
(setcdr yank-menu (reverse (cdr yank-menu)))

Try it for yourself. :)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]