From: Leo <sdl.web@gmail.com>
To: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: kill-new may replace the wrong item
Date: Wed, 2 Jun 2010 04:10:49 +0100 [thread overview]
Message-ID: <AANLkTilLwZE5stPTnDD8HlVlVh2ZByIs1fG_FPXppY4j@mail.gmail.com> (raw)
In-Reply-To: <87d3wasfpf.fsf@mail.jurta.org>
On 1 June 2010 20:58, Juri Linkov <juri@jurta.org> wrote:
>> In the BODY of kill-new, it sets REPLACE t if the new entry is the same
>> as the head of the kill-ring.
>>
>> When save-interprogram-paste-before-kill is non-nil, at the time of
>> replacing it may replace the entry from 'clipboard' instead of the one
>> it used to set REPLACE to t.
>>
>> Is this a bug?
>
> I have non-nil save-interprogram-paste-before-kill and non-nil
> kill-do-not-save-duplicates, but I never noticed a problem with them.
>
> Could you please provide step-by-step test case to reproduce this?
I was debugging another problem due to pasting images but it was not
the fault of kill-new.
The problem with kill-new is as commented here:
;;; 1. here REPLACE is set to T according to the CAR at this time.
(when (and kill-do-not-save-duplicates
(equal string (car kill-ring)))
(setq replace t))
(if (fboundp 'menu-bar-update-yank-menu)
(menu-bar-update-yank-menu string (and replace (car kill-ring))))
;;; 2. things from clipboard or whatnot get pushed into kill-ring
(when save-interprogram-paste-before-kill
(let ((interprogram-paste (and interprogram-paste-function
(funcall interprogram-paste-function))))
(when interprogram-paste
(if (listp interprogram-paste)
(dolist (s (nreverse interprogram-paste))
(push s kill-ring))
(push interprogram-paste kill-ring)))))
;;; 3. when REPLACE happens, CAR may have changed due to step 2
(if (and replace kill-ring)
(setcar kill-ring string)
(push string kill-ring)
(if (> (length kill-ring) kill-ring-max)
(setcdr (nthcdr (1- kill-ring-max) kill-ring) nil)))
So kill-new could end up replacing the item it is not supposed to replace.
> --
> Juri Linkov
> http://www.jurta.org/emacs/
Leo
next prev parent reply other threads:[~2010-06-02 3:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-31 21:32 kill-new may replace the wrong item Leo
2010-06-01 19:58 ` Juri Linkov
2010-06-02 3:10 ` Leo [this message]
2010-06-02 3:36 ` Leo
2010-06-02 19:53 ` Juri Linkov
2010-06-02 21:33 ` Leo
2010-06-03 19:17 ` Juri Linkov
2010-06-03 23:31 ` Leo
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTilLwZE5stPTnDD8HlVlVh2ZByIs1fG_FPXppY4j@mail.gmail.com \
--to=sdl.web@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=juri@jurta.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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).