From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ignacio Casso Newsgroups: gmane.emacs.bugs Subject: bug#53894: 27.2; Clipboard copy -> C-y -> M-y -> Same clipboard copy does not push to kill ring Date: Fri, 01 Apr 2022 13:23:27 +0200 Message-ID: References: <87leyhtv9q.fsf@yahoo.com> <87wni0str6.fsf@yahoo.com> <87h78j6bz0.fsf@yahoo.com> <87czj73xw8.fsf@yahoo.com> <87wnhfoy5h.fsf@hotmail.com> <87sfs233lx.fsf@yahoo.com> <83fso1lsjf.fsf@gnu.org> <871qzlw50r.fsf@yahoo.com> <87sfs0u6n2.fsf@yahoo.com> <87a6d829rx.fsf@yahoo.com> <83h77d5atf.fsf@gnu.org> 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="6927"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.10; emacs 29.0.50 Cc: luangruo@yahoo.com, larsi@gnus.org, 53894@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 01 13:30:35 2022 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 1naFU7-0001TC-16 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Apr 2022 13:30:31 +0200 Original-Received: from localhost ([::1]:60588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naFU5-0005Yp-J5 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 01 Apr 2022 07:30:29 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:54424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naFTf-0005YB-K4 for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 07:30:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47124) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naFTf-0003zW-Ax for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 07:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naFTe-00077r-U6 for bug-gnu-emacs@gnu.org; Fri, 01 Apr 2022 07:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ignacio Casso Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 01 Apr 2022 11:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53894 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53894-submit@debbugs.gnu.org id=B53894.164881258327325 (code B ref 53894); Fri, 01 Apr 2022 11:30:02 +0000 Original-Received: (at 53894) by debbugs.gnu.org; 1 Apr 2022 11:29:43 +0000 Original-Received: from localhost ([127.0.0.1]:41021 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naFTL-00076f-2F for submit@debbugs.gnu.org; Fri, 01 Apr 2022 07:29:43 -0400 Original-Received: from mail-db8eur05olkn2034.outbound.protection.outlook.com ([40.92.89.34]:46688 helo=EUR05-DB8-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naFTI-00076H-Bg for 53894@debbugs.gnu.org; Fri, 01 Apr 2022 07:29:41 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RVpPZl6rNzQcU6w+g4ZYyBxH4cVzOUSaCqG9qq2lnyN9Yin4hmREZeiIWUgXJAXT9DVSBt+7ZsQITWvTAuQuNvNGromL32XWjLD0BViwNhVazd+MPlaYpEf5uxtfkJH4Ir01gH9jQwpdh/5TTUCyqLuaNIh+5KTtdJtxVLsfWFyqs3j4rOCVFPfmsBI+/ilwUJt3uqHkKH+IrBdfN6VoKb1738JyUJqhL3Ryf25QisMCuhApH4vQjXESdqpWcQpX3/ecbJW3k3UElyg6P3W0U1d6sLjRPWoFGavMJnYJFVQ4sj5CCP5cTkTkQjpJ75pWkzU4uU/kxbhCb/21zhQJ7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KEwiVAP4dYdl7FfYZoRxQUHkMMocTqlLgcKUMRpGZek=; b=FaSzVGfapZH04cmJHysr/Cptc4eNio6ARkLwatEpqju4RR8jIyonJsZgphFwsf0BKnTZc3UOUKYwfA5K3c5qsQ+BE2F9hUtf2R2Elx+poopJ9aww3yISkYGZKsK+rBi1S9fwEr8N5xhu2RNzHwbmRknuj29ViboamYT/Q6tzToJSF06a0fuIi6a3UMMsYmbkTBMQxLyElJxxl1U4SVSG+7NCvfm2XC9Z183WlQcA03Ihxt57CjX3aORzuf/zSGj6dNaDYYW0BvBNYjfFnKhoBTZ0WtEXlL9KNA4grdYqtL6doRLcFTKDsvTOpbxqXs4H0HHVzeIHK6RMnk3AZfBHpg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KEwiVAP4dYdl7FfYZoRxQUHkMMocTqlLgcKUMRpGZek=; b=py2v2VtggXrPGMRRJm/8Q5oDQcdGTAhQjSc+zbp+LHf/EcoLMIbmw7C6DZpNR+LnH5dNOweq1tErCoFVxfPKLicCP567cY8OCsbClKJ+6iA2hFoyx+Q9M3Jj889X/CXZgnPLDtOUlBrFXExqaHqZuDro0h9g/Lbpybyp1CP5iug4R1FNFiwDWLMDxAbhpiZLFNsbJKfSej0Zz+PL+Uh3XY/e9yL2+a5HlpKjEXLmcSKO88pMHD7e11R81W7eEjAIV7tOhEbSokbxjl8yeAVaIfqPgXec/bf7eh/uDzZF6IgVQblhgQWpiryF9ViV+/+3ejWQun9ImqPtSa9NHcVcbw== Original-Received: from PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) by DB7PR06MB5960.eurprd06.prod.outlook.com (2603:10a6:10:2c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.21; Fri, 1 Apr 2022 11:29:33 +0000 Original-Received: from PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f]) by PAXPR06MB7760.eurprd06.prod.outlook.com ([fe80::e05a:8d81:8648:b10f%8]) with mapi id 15.20.5123.025; Fri, 1 Apr 2022 11:29:33 +0000 In-reply-to: <83h77d5atf.fsf@gnu.org> X-TMN: [+TxUItSnGuMO1F70CcGifiSUJjLFmXZI] X-ClientProxiedBy: MR2P264CA0175.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501::14) To PAXPR06MB7760.eurprd06.prod.outlook.com (2603:10a6:102:155::8) X-Microsoft-Original-Message-ID: <87mth511pl.fsf@hotmail.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a82ad995-7faf-45d8-c023-08da13d2e3aa X-MS-TrafficTypeDiagnostic: DB7PR06MB5960:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gi8PkBQJ/KpOF5t1QtCIyanr0DgLfZt6T9kWruACYUU01ujXQcHZJlUEIAWiKYA5ujYIvdkLJKTkxSpAO0PRz2sRkmL1pI20Jl4htwWrAygAu9NyQm/xFzefUKPpKcVpO+w03PYXA+rdV6/jyqECNroZGT0lTiLUHsWa310v7XMl7h2siXT8rs8JoSS4XZdJ6+V3AG7U0HZK2STLSZb8r1pLFnzbzVULjf2ksdmCkc/gP10pBvYBsfIWdv9Diur1k8IfFOz/GQvJ3NQ8elNIjzaQl8WUgAZUBjdMrvilK18xYQzAwi/umAsWkAdd2EkNBGcAWtehcyZpE8lmznYudyqKs9AQaHvD96X4KQZCT9dH1ly5oQwrLvcx6x0kSIqctvmaqDI8ieYcZ/n0uU9MmbTmbZDV0wRcD7FsguoJqJ0+eIpzkJX7B58Sfj/Krz7ueBnQHm/WQmb/sz7I2mAVKfjl6En2F9mLtknDb4IIiXuWAjTLIQSyra8SWW6Bw3sxZ0AMd5aFqvCjp99RvqWvEmrz3mMX4ljB9T58DHjggwyYNjYTum8rqWAR6jiv4/RQdPOTEe5VMZwZFQE+YqxWUA== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jwAmksBszmrl1qQSKv3zrZycfKbe6SbEYCqO+3WW4xkpR8qICjitH4J9hClKC/x19CWcUl1qaVF23OE9y02PcX2XlK8Icz/O16W++HwyDtTHF4iDdFgxFiwvIS3T/+cm0IIJYJCFMcciqv5+bNs2ozlxiwHZ1TNKC5NxMI2MFDx+27oFQeEWiCtd/AnEzfCKq/p5yTe+y2OnnHy1mD3NnL74tXrMyyZ72ePp/NiPWrV5Dr2ZDF9oKibu9aRirk65xpiXBS2++MLsSplHbXYMzNQoHvetGiFpZ7DGpi1sy19YS7KeTYAtIzXj7x2baD3OadX1O2sR4S8O/6OzGLph28M5C1cZWC1SE6DH7+19yhDD85jYtI5uOeTG2Fd80eTElMoCR/4iP49pNLgo7CBRc7wI1GhPxrfg/HrHLWhaXUG7K04t07RwMoCj7pzhZDRUOfroKp4cbNs0gvfLKZVLR2JTrtJwVwAkyxr1xcRJRBjMvJ/HMXuEYWBSwDK0hKC70wJYn3CMuZuJDUUSck/+fxWdRB8qGaMTW8Sa1N5clmjHQeo/0k0Ewj2x5+JZtBa+TSvDtGlua5N1d8q4awmuiJ/jprCECL2O3EzOjf8qR8aCwhuu8T5O1tMLJk3MZZ+JdgZNnuOrCqu84Fncr7s5s9L8ygnNW43Q+Cy7reWgY+XrxlwLmgXzoPDoNa6yOphJrxMtZvr4SA4K1rYuipRodeIJWez6AVYrKNuzvkpaZ6H5VviOzz/3axufc8 uBiFxV9Mq9R22pYIrTUgWdYtcKkC6hN39jYujW3EAWYhVdGoGcB4gd5Q6IafxpbEfzuLCuQitouQViyuO2+VQKEtWbgAhFhYzY X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-6e454.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: a82ad995-7faf-45d8-c023-08da13d2e3aa X-MS-Exchange-CrossTenant-AuthSource: PAXPR06MB7760.eurprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2022 11:29:33.2826 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR06MB5960 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" Xref: news.gmane.io gmane.emacs.bugs:229216 Archived-At: --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Ignacio Casso >> Cc: Eli Zaretskii , 53894@debbugs.gnu.org, larsi@gnus.org >> Date: Fri, 01 Apr 2022 12:15:58 +0200 >> >> +(defun gui--set-last-clipboard-selection (text) >> + "Save last clipboard selection. >> +Save the selected text, passed as argument, and for window >> +systems that support it, save the selection timestamp too." >> + (setq gui--last-selected-text-clipboard text) >> + (when (memq window-system '(x)) > > This should use 'eq', nor 'memq', since you are testing against a > single value. (There are more of such code elsewhere in the patch.) Well the idea is that in the future there could be more window systems in that list, that's why I used `memq'. I attach the patch using `eq' instead. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Better-check-for-when-clipboard-or-primary-selection.patch Content-Description: Patch for bug#53894 >From b069ee6a9c6454bf30a26730635702cb24dbd950 Mon Sep 17 00:00:00 2001 From: Ignacio Date: Sun, 13 Mar 2022 21:05:18 +0100 Subject: [PATCH] Better check for when clipboard or primary selection have changed Previously it was done by just comparing new and old selection text, now we use also selection timestamps for systems that support it (only enabled in X for now). This fixes bug#53894. lisp/select.el: new variables gui--last-selection-timestamp-clipboard and gui--last-selection-timestamp-primary. New functions gui--set-last-clipboard-selection, gui--set-last-primary-selection, gui--clipboard-selection-unchanged-p and gui--primary-selection-unchanged-p. --- lisp/menu-bar.el | 3 +- lisp/select.el | 108 +++++++++++++++++++++++++++++++------------- lisp/term/pc-win.el | 8 ++++ 3 files changed, 87 insertions(+), 32 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index ab64928fe7..d8c8c760f7 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -606,7 +606,8 @@ clipboard-yank "Insert the clipboard contents, or the last stretch of killed text." (interactive "*") (let ((select-enable-clipboard t) - ;; Ensure that we defeat the DWIM login in `gui-selection-value'. + ;; Ensure that we defeat the DWIM logic in `gui-selection-value' + ;; (i.e., that gui--clipboard-selection-unchanged-p returns nil). (gui--last-selected-text-clipboard nil)) (yank))) diff --git a/lisp/select.el b/lisp/select.el index c352a48261..0b51f01cc5 100644 --- a/lisp/select.el +++ b/lisp/select.el @@ -25,9 +25,10 @@ ;; Based partially on earlier release by Lucid. ;; The functionality here is divided in two parts: -;; - Low-level: gui-get-selection, gui-set-selection, gui-selection-owner-p, -;; gui-selection-exists-p are the backend-dependent functions meant to access -;; various kinds of selections (CLIPBOARD, PRIMARY, SECONDARY). +;; - Low-level: gui-backend-get-selection, gui-backend-set-selection, +;; gui-backend-selection-owner-p, gui-backend-selection-exists-p are +;; the backend-dependent functions meant to access various kinds of +;; selections (CLIPBOARD, PRIMARY, SECONDARY). ;; - Higher-level: gui-select-text and gui-selection-value go together to ;; access the general notion of "GUI selection" for interoperation with other ;; applications. This can use either the clipboard or the primary selection, @@ -108,9 +109,10 @@ select-enable-primary :group 'killing :version "25.1") -;; We keep track of the last text selected here, so we can check the -;; current selection against it, and avoid passing back our own text -;; from gui-selection-value. We track both +;; We keep track of the last selection here, so we can check the +;; current selection against it, and avoid passing back with +;; gui-selection-value the same text we previously killed or +;; yanked. We track both ;; separately in case another X application only sets one of them ;; we aren't fooled by the PRIMARY or CLIPBOARD selection staying the same. @@ -119,22 +121,68 @@ gui--last-selected-text-clipboard (defvar gui--last-selected-text-primary nil "The value of the PRIMARY selection last seen.") +(defvar gui--last-selection-timestamp-clipboard nil + "The timestamp of the CLIPBOARD selection last seen.") +(defvar gui--last-selection-timestamp-primary nil + "The timestamp of the PRIMARY selection last seen.") + +(defun gui--set-last-clipboard-selection (text) + "Save last clipboard selection. +Save the selected text, passed as argument, and for window +systems that support it, save the selection timestamp too." + (setq gui--last-selected-text-clipboard text) + (when (eq window-system 'x) + (setq gui--last-selection-timestamp-clipboard + (gui-backend-get-selection 'CLIPBOARD 'TIMESTAMP)))) + +(defun gui--set-last-primary-selection (text) + "Save last primary selection. +Save the selected text, passed as argument, and for window +systems that support it, save the selection timestamp too." + (setq gui--last-selected-text-primary text) + (when (eq window-system 'x) + (setq gui--last-selection-timestamp-primary + (gui-backend-get-selection 'PRIMARY 'TIMESTAMP)))) + +(defun gui--clipboard-selection-unchanged-p (text) + "Check whether the clipboard selection has changed. +Compare the selection text, passed as argument, with the text +from the last saved selection. For window systems that support +it, compare the selection timestamp too." + (and + (equal text gui--last-selected-text-clipboard) + (or (not (eq window-system 'x)) + (eq gui--last-selection-timestamp-clipboard + (gui-backend-get-selection 'CLIPBOARD 'TIMESTAMP))))) + +(defun gui--primary-selection-unchanged-p (text) + "Check whether the primary selection has changed. +Compare the selection text, passed as argument, with the text +from the last saved selection. For window systems that support +it, compare the selection timestamp too." + (and + (equal text gui--last-selected-text-primary) + (or (not (eq window-system 'x)) + (eq gui--last-selection-timestamp-primary + (gui-backend-get-selection 'PRIMARY 'TIMESTAMP))))) + + (defun gui-select-text (text) "Select TEXT, a string, according to the window system. -if `select-enable-clipboard' is non-nil, copy TEXT to the system's clipboard. +If `select-enable-clipboard' is non-nil, copy TEXT to the system's clipboard. If `select-enable-primary' is non-nil, put TEXT in the primary selection. MS-Windows does not have a \"primary\" selection." (when select-enable-primary (gui-set-selection 'PRIMARY text) - (setq gui--last-selected-text-primary text)) + (gui--set-last-primary-selection text)) (when select-enable-clipboard ;; When cutting, the selection is cleared and PRIMARY ;; set to the empty string. Prevent that, PRIMARY ;; should not be reset by cut (Bug#16382). (setq saved-region-selection text) (gui-set-selection 'CLIPBOARD text) - (setq gui--last-selected-text-clipboard text))) + (gui--set-last-clipboard-selection text))) (define-obsolete-function-alias 'x-select-text 'gui-select-text "25.1") (defcustom x-select-request-type nil @@ -175,6 +223,7 @@ gui--selection-value-internal ;; some other window systems. (memq window-system '(x haiku)) (eq type 'CLIPBOARD) + ;; Should we unify this with gui--clipboard-selection-unchanged-p? (gui-backend-selection-owner-p type)) (let ((request-type (if (memq window-system '(x pgtk haiku)) (or x-select-request-type @@ -197,19 +246,17 @@ gui-selection-value (let ((text (gui--selection-value-internal 'CLIPBOARD))) (when (string= text "") (setq text nil)) - ;; When `select-enable-clipboard' is non-nil, - ;; killing/copying text (with, say, `C-w') will push the - ;; text to the clipboard (and store it in - ;; `gui--last-selected-text-clipboard'). We check - ;; whether the text on the clipboard is identical to this - ;; text, and if so, we report that the clipboard is - ;; empty. See (bug#27442) for further discussion about - ;; this DWIM action, and possible ways to make this check - ;; less fragile, if so desired. - (prog1 - (unless (equal text gui--last-selected-text-clipboard) - text) - (setq gui--last-selected-text-clipboard text))))) + ;; Check the CLIPBOARD selection for 'newness', i.e., + ;; whether it is different from the last time we did a + ;; yank operation or whether it was set by Emacs itself + ;; with a kill operation, since in both cases the text + ;; will already be in the kill ring. See (bug#27442) and + ;; (bug#53894) for further discussion about this DWIM + ;; action, and possible ways to make this check less + ;; fragile, if so desired. + (unless (gui--clipboard-selection-unchanged-p text) + (gui--set-last-clipboard-selection text) + text)))) (primary-text (when select-enable-primary (let ((text (gui--selection-value-internal 'PRIMARY))) @@ -217,10 +264,9 @@ gui-selection-value ;; Check the PRIMARY selection for 'newness', is it different ;; from what we remembered them to be last time we did a ;; cut/paste operation. - (prog1 - (unless (equal text gui--last-selected-text-primary) - text) - (setq gui--last-selected-text-primary text)))))) + (unless (gui--primary-selection-unchanged-p text) + (gui--set-last-primary-selection text) + text))))) ;; As we have done one selection, clear this now. (setq next-selection-coding-system nil) @@ -235,11 +281,11 @@ gui-selection-value ;; something like the following has happened since the last time ;; we looked at the selections: Application X set all the ;; selections, then Application Y set only one of them. - ;; In this case since we don't have - ;; timestamps there is no way to know what the 'correct' value to - ;; return is. The nice thing to do would be to tell the user we - ;; saw multiple possible selections and ask the user which was the - ;; one they wanted. + ;; In this case, for systems that support selection timestamps, we + ;; could return the newer. For systems that don't, there is no + ;; way to know what the 'correct' value to return is. The nice + ;; thing to do would be to tell the user we saw multiple possible + ;; selections and ask the user which was the one they wanted. (or clip-text primary-text) )) diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el index 327d51f275..514267a52d 100644 --- a/lisp/term/pc-win.el +++ b/lisp/term/pc-win.el @@ -246,6 +246,14 @@ w16-selection-owner-p ;; if it does not exist, or exists and compares ;; equal with the last text we've put into the ;; Windows clipboard. + ;; NOTE: that variable is actually the last text any program + ;; (not just Emacs) has put into the windows clipboard (up + ;; until the last time Emacs read or set the clipboard), so + ;; it's not suitable for checking actual selection + ;; ownership. This should not result in a bug for the current + ;; uses of gui-backend-selection-owner however, since they + ;; don't actually care about selection ownership, but about + ;; the selected text having changed. (cond ((not text) t) ((equal text gui--last-selected-text-clipboard) text) -- 2.25.1 --=-=-=--