From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Leo Newsgroups: gmane.emacs.devel Subject: Re: kill-new may replace the wrong item Date: Wed, 2 Jun 2010 04:10:49 +0100 Message-ID: References: <87d3wasfpf.fsf@mail.jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: dough.gmane.org 1275448265 21894 80.91.229.12 (2 Jun 2010 03:11:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 2 Jun 2010 03:11:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 02 05:11:02 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OJeM9-00061k-4v for ged-emacs-devel@m.gmane.org; Wed, 02 Jun 2010 05:11:01 +0200 Original-Received: from localhost ([127.0.0.1]:44656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJeM8-00017V-Hk for ged-emacs-devel@m.gmane.org; Tue, 01 Jun 2010 23:11:00 -0400 Original-Received: from [140.186.70.92] (port=38392 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OJeM0-000164-DE for emacs-devel@gnu.org; Tue, 01 Jun 2010 23:10:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OJeLz-0005zW-CM for emacs-devel@gnu.org; Tue, 01 Jun 2010 23:10:52 -0400 Original-Received: from mail-ww0-f41.google.com ([74.125.82.41]:62147) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OJeLz-0005zN-21 for emacs-devel@gnu.org; Tue, 01 Jun 2010 23:10:51 -0400 Original-Received: by wwb24 with SMTP id 24so2197711wwb.0 for ; Tue, 01 Jun 2010 20:10:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type; bh=kZY31Y0Pxf65jbMzvojk2JAmvlnRmiccMUH9a/8WoPo=; b=NkqMCNhKyuBRFH+NLBonO9/gT1IraZPnJsi2endxXLhH87c0viiZI0YLcvFk6deskg Iiu+AfZMiLm78bITv4UQCstKNWkl0zhWA5nyFWhM1BC6LHltdYih+OO0zGY+vAeERPml heOWXHGsZL7KDJuFS05z9k7jpKpvYXpwMId7M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=UYVkEVT3cuAK3MRuc8IOOVnPrJv+PIxxvYcgFJcSfB7ZAwsRTftL7ZxvhvBcOgwNEM 4hfx0hkq2qTCVkTkm63Diug/iPeNKJfNbNh1FKX+U+REHkUtGAGBCJDSVbd+TnJcj8bB CAyncXIK73SfvntmsXUPgc8QjpCyYsGoJC1eE= Original-Received: by 10.216.155.141 with SMTP id j13mr696352wek.7.1275448249279; Tue, 01 Jun 2010 20:10:49 -0700 (PDT) Original-Received: by 10.216.188.139 with HTTP; Tue, 1 Jun 2010 20:10:49 -0700 (PDT) In-Reply-To: <87d3wasfpf.fsf@mail.jurta.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:125439 Archived-At: On 1 June 2010 20:58, Juri Linkov 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