From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: sbaugh@catern.com Newsgroups: gmane.emacs.bugs Subject: bug#64423: 29.0.92; save-interprogram-paste-before-kill doesn't prevent streaming large selections Date: Sat, 08 Jul 2023 16:39:00 +0000 (UTC) Message-ID: <87mt06mk7w.fsf@catern.com> References: <875y72ieq8.fsf@catern.com> <87cz193eno.fsf@yahoo.com> <87jzvgse4k.fsf@yahoo.com> <87pm58phyu.fsf@catern.com> <87y1jwqqel.fsf@yahoo.com> <87mt0bq4py.fsf@catern.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23847"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Spencer Baugh , 64423@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 08 18:40:19 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qIAyo-000614-Ff for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 Jul 2023 18:40:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIAyc-0002qs-UD; Sat, 08 Jul 2023 12:40:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qIAyZ-0002qh-BS for bug-gnu-emacs@gnu.org; Sat, 08 Jul 2023 12:40:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qIAyZ-0002pH-0i for bug-gnu-emacs@gnu.org; Sat, 08 Jul 2023 12:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qIAyY-0005U9-Gw for bug-gnu-emacs@gnu.org; Sat, 08 Jul 2023 12:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: sbaugh@catern.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Jul 2023 16:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64423 X-GNU-PR-Package: emacs Original-Received: via spool by 64423-submit@debbugs.gnu.org id=B64423.168883434920974 (code B ref 64423); Sat, 08 Jul 2023 16:40:02 +0000 Original-Received: (at 64423) by debbugs.gnu.org; 8 Jul 2023 16:39:09 +0000 Original-Received: from localhost ([127.0.0.1]:45110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIAxg-0005SE-Mo for submit@debbugs.gnu.org; Sat, 08 Jul 2023 12:39:09 -0400 Original-Received: from s.wrqvtbkv.outbound-mail.sendgrid.net ([149.72.123.24]:19652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIAxe-0005Re-J7 for 64423@debbugs.gnu.org; Sat, 08 Jul 2023 12:39:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=catern.com; h=from:subject:in-reply-to:references:mime-version:to:cc:content-type: cc:content-type:from:subject:to; s=s1; bh=KYoMkT002yoXT7XiIe0vZ0Edrc0lEkaSYVTzcfUapTQ=; b=iodZtyXHCJbThusnluWn9Z/wYBc6U22LZbFV9+8p2xAJB3EVZgJXiYMFOb+3A0l06bqB F1qrKxgEUZT23uv5O7rTo+WHNSygXkN2XaKNHl9ADBlpkHuJeNiCy51QHem6qeHP6/1M7u EowiIK8mESPA3+9lrpGWHvzg3bwLptkb7CdQ1mT2NbI3uTUeINFj6mJfQfLMo3I7r8Qss3 n2dseEpMSlzW9cjiC9pRaQbbbN9nidO9c+Kmx58/DZbucUaLYOBFW7X3HTBa9BhONGDIHz v1Fxi7XWicR0MOOIh2OM0Xdy8QUYX1crtR2mANnC1tomkoqWptaNjymBVKvDheKw== Original-Received: by filterdrecv-84b96456cb-hrvlt with SMTP id filterdrecv-84b96456cb-hrvlt-1-64A99124-12 2023-07-08 16:39:00.448431669 +0000 UTC m=+5072425.444531642 Original-Received: from earth.catern.com (unknown) by geopod-ismtpd-15 (SG) with ESMTP id x7GJlNhLSMSfNTUkrbydUw Sat, 08 Jul 2023 16:39:00.207 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=::1; helo=localhost; envelope-from=sbaugh@catern.com; receiver=yahoo.com Original-Received: from localhost (localhost [IPv6:::1]) by earth.catern.com (Postfix) with ESMTPSA id A335D6004F; Sat, 8 Jul 2023 12:38:59 -0400 (EDT) In-Reply-To: <87mt0bq4py.fsf@catern.com> (sbaugh@catern.com's message of "Tue, 04 Jul 2023 11:46:34 +0000 (UTC)") X-SG-EID: ZgbRq7gjGrt0q/Pjvxk7wM0yQFRdOkTJAtEbkjCkHbLp8QcpjKixcTZS0hXF2ccz2lQLK5ME56JYKgHNzKGtPtrrzQ+ptJrW2NY12IBdW1Z1cYtLkqJUyTh7kSAxz6Q83AL06COyS5fpALSFlbirxVwWBnSl+MKe7Pjtw305FyfnJ4lP7rCL6Uhe0Gi+0ZIrhub/0fC1QMRRU0/wdCiK1A== X-Entity-ID: d/0VcHixlS0t7iB1YKCv4Q== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264780 Archived-At: --=-=-= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit sbaugh@catern.com writes: > Po Lu writes: >> sbaugh@catern.com writes: >> >>> Po Lu writes: >>> >>>> Spencer Baugh writes: >>>> >>>>> When you do that, you interrupt the operation which is trying to add a >>>>> new kill. If you interrupt it and try again, you'll just get the same >>>>> long delay again. There's no way to mitigate this from within Emacs, >>>>> other than by turning off save-interprogram-paste-before-kill. >>>> >>>> Then I guess the solution is to temporarily disable >>>> `save-interprogram-paste-before-kill' if a quit arrives while it is >>>> reading selection data. >>> >>> That would be a decent solution. Although I'm not sure how we'd >>> implement it. We want to, somehow, know that after a selection-transfer >>> has been aborted, we should not try to transfer that selection again. >>> Is that something we can check? Whether the selection has changed, >>> without transferring it? >> >> Emacs will probably assert ownership of the selection after the kill >> takes place, anyway, so there is no need. > > Good point! So maybe if a quit arrives while we're reading the > selection in kill-new, we should immediately take ownership of the > selection. With an condition-case, perhaps. > > Or... just ignore the quit. If we're reading the selection in kill-new > and there's a quit, just proceed to doing the kill. Here is an implementation of that. I think this is the right strategy and I'm glad we discussed this, I think this will behave better for users than my original suggestion, and this way doesn't require any configuration. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Ignore-quit-while-getting-interprogram-paste-in-kill.patch >From b7b0feb879994696bdd6f6f4cc982779b1ff5b45 Mon Sep 17 00:00:00 2001 From: Spencer Baugh Date: Sat, 8 Jul 2023 12:36:22 -0400 Subject: [PATCH] Ignore quit while getting interprogram paste in kill-new On X, if the current selection owner is not responding to selection requests, the user may want to take ownership of the selection. The obvious way to do this is to kill some text (which a user might also be doing just as part of normal editing at the time the selection owner becomes nonresponsive). However, if save-interprogram-paste-before-kill is non-nil, then killing text will hang until the user quits, and this quit will abort the entire kill-new, preventing the user from taking ownership of the selection. Now instead if the user quits while we are attempting to retrieve the selection from hanging owner, we will proceed to take ownership of the selection as normal, resolving the problem. (One example of a selction owner that might not be responding to selection requests is another instance of Emacs itself; while Emacs is blocked in call-process or Lisp execution, it currently does not respond to selection requests.) * lisp/simple.el (kill-new): Ignore quit while getting interprogram paste (bug#64423) --- lisp/simple.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/simple.el b/lisp/simple.el index 26944f1f72d..95d00cc506b 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5618,8 +5618,10 @@ kill-new (if (fboundp 'menu-bar-update-yank-menu) (menu-bar-update-yank-menu string (and replace (car kill-ring))))) (when save-interprogram-paste-before-kill - (let ((interprogram-paste (and interprogram-paste-function - (funcall interprogram-paste-function)))) + (let ((interprogram-paste + (ignore-error 'quit + (and interprogram-paste-function + (funcall interprogram-paste-function))))) (when interprogram-paste (setq interprogram-paste (if (listp interprogram-paste) -- 2.41.0 --=-=-=--