From: Smith_RS <rsmithpv@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Annoying kill-ring behavior
Date: Fri, 4 Apr 2014 00:00:43 -0700 (PDT) [thread overview]
Message-ID: <cbda30ac-4795-4772-a0ec-72421a812932@googlegroups.com> (raw)
In-Reply-To: <slrnljsdih.2sl.joost.m.kremers@j.kremers4.news.arnhem.chello.nl>
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
kill-ring-yank-pointer.
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
http://www.gnu.org/software/emacs/manual/html_node/eintr/kill_002dnew-function.html
http://www.gnu.org/software/emacs/manual/html_node/eintr/kill_002dring_002dyank_002dpointer.html
So, yes, I'm still confused about what the real difference is between kill-ring and
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. :)
prev parent reply other threads:[~2014-04-04 7:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 22:06 Annoying kill-ring behavior Smith_RS
2014-03-31 22:45 ` Stefan Monnier
[not found] ` <mailman.18630.1396305973.10748.help-gnu-emacs@gnu.org>
2014-04-01 7:54 ` Smith_RS
2014-04-01 16:23 ` Smith_RS
2014-04-02 11:59 ` Stefan Monnier
[not found] ` <mailman.18813.1396529475.10748.help-gnu-emacs@gnu.org>
2014-04-03 16:52 ` Smith_RS
2014-04-03 21:59 ` Smith_RS
2014-04-04 4:34 ` Joost Kremers
2014-04-04 7:00 ` Smith_RS [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cbda30ac-4795-4772-a0ec-72421a812932@googlegroups.com \
--to=rsmithpv@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.