From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" 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: Tue, 29 Mar 2022 21:00:50 +0800 Message-ID: <87a6d829rx.fsf@yahoo.com> References: <87wni1tzzl.fsf@yahoo.com> <87pmnttw78.fsf@yahoo.com> <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> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39515"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) Cc: Eli Zaretskii , 53894@debbugs.gnu.org, larsi@gnus.org To: Ignacio Casso Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Mar 29 15:06:52 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 1nZBYi-000AAs-B1 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Mar 2022 15:06:52 +0200 Original-Received: from localhost ([::1]:50266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nZBYh-0003Fs-3g for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 29 Mar 2022 09:06:51 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:47912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nZBU2-0007PK-MW for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2022 09:02:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nZBU1-00080R-O4 for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2022 09:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nZBU1-00050x-M0 for bug-gnu-emacs@gnu.org; Tue, 29 Mar 2022 09:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 29 Mar 2022 13:02:01 +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.164855886919216 (code B ref 53894); Tue, 29 Mar 2022 13:02:01 +0000 Original-Received: (at 53894) by debbugs.gnu.org; 29 Mar 2022 13:01:09 +0000 Original-Received: from localhost ([127.0.0.1]:60159 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZBTB-0004zs-G9 for submit@debbugs.gnu.org; Tue, 29 Mar 2022 09:01:09 -0400 Original-Received: from sonic309-20.consmr.mail.ne1.yahoo.com ([66.163.184.146]:37408) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nZBTA-0004zW-8K for 53894@debbugs.gnu.org; Tue, 29 Mar 2022 09:01:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1648558862; bh=Ro4HoyvvRKCqcUFOoIkZpslolmXYgyWLc8W6Sypv1Vk=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=VMc7u6csy9IiD9QvkwCbxqeuFdvbdltc9nNWbZBg04gRHMtF7qMsRX0pUtl3E+9iltkotPo00qgZfR3fN4nbDr3PJjL3RtaoiykAucZgux26mTph6ZHvdFO0PvMpbiUSKBHykinCVjYDBy0P3FG4ivYu41N3yyEE/fLOxOIPNOt1jN9CX5WXsdGq7OGyj9vvtUfhY7aDbSxZTqbu4MDFtLQNqTJV9bcr6P5FEK/OAylraP0Q5c0Mt9Et4z+max0qxmmX/8/Yra+41oKjue4UNs+1P9iuZIVY9xB2nLxXG+4lUAkskQOcCjdthnLFs04o1HB4vkPPD05uuR69dRh98A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1648558862; bh=cFf1gyt6dwhQ4u70am0ip20xpOm6msxuviagPMgNM17=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=JkF844/e+iPxHoGa5R99zE4rvA1ExMMRlElGtG5uG3l7XY8laC23dRkBM7Ask71EYcGBHonqQbghO1DCqnBaCrogocZ+X+D2765w/5XNnhAysufgtIn8/JY7GZwsYCU5KIdhrTU1dReqj8ZVbkN0tJ7DhosWKjq3Yiby4gTgeX+57QdvBwCHP3FcgWs1d4xOjyVL+tM+OjSYesGVV2HU4xVNAZ9ciNA2R519uE4RfOPxy8mP60/0ifhss0PsohsQtK6R/yj02d3HNBP0LDrOYHPbsbyA2QES9AkJ4dO16mVHo+aqeESaMNENYcnHHEsDpMe1VyhaULG4hA1FIhLxTQ== X-YMail-OSG: KkFP2kgVM1lNAGTWobjAe6e7aQS7xvojjhRsnQhcP2ZRfkjOzmtAJ_f.NE1oJFa 7Ak1.JFQxHzEAzTWH0ZZ_xN2r.AHrOHIcTlqPTavazKuk.DCmV1OHDwqWYxyGx.74VgJBgsaadj6 pDEcTnERqxhllbGjlAoK.F3pHpQ6z4toBREIno.MwMZSqsk47gEkIcDbXLmNPJeSnO3fLb0zB7nM jHPwrGwbmZ4.Jtcpl887QhYWLTqdLrtq91e5IDfrg5mt0LTjDSFa03KFACc0DLKohAnWn8pG3RCb FZ8MH81I60s1wgilf91a50qIhHvjPTTMs2mznfEh2Sp18X9HrmTBfkpl1kAQqTYQq5F0pl2Gv672 TP3.tz__o5eo38Fe1754j01sYIjulBL2dBLQYH2U8yPIuAhYzqj8EdGtS8stEgNU1CeM7mdditN2 yu5t_VgbZw7Fp6n4h0ouZpvkupFSIzG5XYAkTFykCvAP.3EtbPFcsDmGCLmj6ufUJz7zKC0_ZLXR V4uHe8F5YNUZfO7iPcJscgh.19nohO6e6ltpxaFf6tANGw1J.fVd0BNr6yzZDpTAkJybXAwhrkPO 9Bv13IUjYXSqssqXiwWErZyFXP8_p5Y0zrGsbV1_73ElZioe0D97stXdQfpszleeW04S5QlBA6XQ Gd3Ql8OGN.bAMJSiQ5t1kjsyaSt_nNojy7wiTY0QGPujZAdxStbAgPDVFjZYVB7WkAttafpVMtSL Lfmj3mhZK2Z.oPLuCMS.aja2bUuCX7OF9.BibJAWetUHh43.SFnMmMuBsEi.trFE2JEkQgPi.pRg cd9Fd68MTHap7Nv9jkYFEiEIoIGgaKV6f21B_mwMrZ X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ne1.yahoo.com with HTTP; Tue, 29 Mar 2022 13:01:02 +0000 Original-Received: by kubenode517.mail-prod1.omega.sg3.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 1492d81c71149dbaa6339759f47ea171; Tue, 29 Mar 2022 13:00:54 +0000 (UTC) In-Reply-To: (Ignacio Casso's message of "Wed, 02 Mar 2022 09:37:28 +0100") X-Mailer: WebService/1.1.19987 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:229055 Archived-At: Ignacio Casso writes: > Ok, here is the final patch, and a suggested commit message. I've > initiated the paperwork for the copyright assignment, I will let you > know when it is done. Thanks. A last-minute comment: > +(defun gui--set-last-clipboard-selection (text) > + "Save last clipboard selection, to be able to check later whether > +it has changed. Save the selected text, and for window systems > +that support it, the selection timestamp." > + (setq gui--last-selected-text-clipboard text) > + (when (memq window-system '(x)) > + (setq gui--last-selection-timestamp-clipboard > + (gui-get-selection 'CLIPBOARD 'TIMESTAMP)))) > + > +(defun gui--set-last-primary-selection (text) > + "Save last primary selection, to be able to check later whether > +it has changed. Save the selected text, and for window systems > +that support it, the selection timestamp." > + (setq gui--last-selected-text-primary text) > + (when (memq window-system '(x)) > + (setq gui--last-selection-timestamp-primary > + (gui-get-selection 'PRIMARY 'TIMESTAMP)))) > + > +(defun gui--clipboard-selection-unchanged-p (text) > + "Check whether the clipboard selection is the same as the last > +time it was read, by comparing the selected text, and for window > +systems that support it, the selection timestamp." > + (and > + (equal text gui--last-selected-text-clipboard) > + (or (not (memq window-system '(x))) > + (eq gui--last-selection-timestamp-clipboard > + (gui-get-selection 'CLIPBOARD 'TIMESTAMP))))) > + > +(defun gui--primary-selection-unchanged-p (text) > + "Check whether the primary selection is the same as the last > +time it was read, by comparing the selected text, and for window > +systems that support it, the selection timestamp." > + (and > + (equal text gui--last-selected-text-primary) > + (or (not (memq window-system '(x))) > + (eq gui--last-selection-timestamp-primary > + (gui-get-selection 'PRIMARY 'TIMESTAMP))))) These checks should use `gui-backend-get-selection' to find the selection timestamp, not the public function. Also, the doc strings of the new functions should explain the meaning of the argument `text', and the first line of each doc string should be a complete sentence not more than 70 characters wide, terminated by a period. > - ;; one they wanted. > + ;; one they wanted. EDIT: We do have timestamps or selection > + ;; counter now (for some window systems), so we can return the > + ;; newer. Perhaps the entire comment could be reworded instead of adding an edit to the end. There should also be two spaces between punctuation and any further text, like this: "wanted. EDIT: We do...". Thanks.