From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phil Sainty Newsgroups: gmane.emacs.bugs Subject: bug#58608: 29.0.50; Nasty bug with pasting primary selection in term buffers Date: Wed, 19 Oct 2022 16:22:32 +1300 Message-ID: <28b4d56584b38019d38d6c7c9e0bb2d1@webmail.orcon.net.nz> References: <4b9aa5bac2d1bfe5af7c246ae9648c87@webmail.orcon.net.nz> <62d5bb83a2bd9e5464d198c4ad38ec77@webmail.orcon.net.nz> <901d65e2e6e961136ff0053917d57a05@webmail.orcon.net.nz> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18577"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Orcon Webmail To: 58608@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 19 05:23:12 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 1okzfj-0004cC-Eu for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 19 Oct 2022 05:23:11 +0200 Original-Received: from localhost ([::1]:33776 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okzfi-0006Hu-0g for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Oct 2022 23:23:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okzfa-0006Hk-R8 for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 23:23:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56295) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okzfa-000750-IC for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 23:23:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1okzfa-0000mv-6o for bug-gnu-emacs@gnu.org; Tue, 18 Oct 2022 23:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Phil Sainty Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 19 Oct 2022 03:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58608 X-GNU-PR-Package: emacs Original-Received: via spool by 58608-submit@debbugs.gnu.org id=B58608.16661497572981 (code B ref 58608); Wed, 19 Oct 2022 03:23:02 +0000 Original-Received: (at 58608) by debbugs.gnu.org; 19 Oct 2022 03:22:37 +0000 Original-Received: from localhost ([127.0.0.1]:55373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okzfB-0000m1-AP for submit@debbugs.gnu.org; Tue, 18 Oct 2022 23:22:37 -0400 Original-Received: from smtp-2.orcon.net.nz ([60.234.4.43]:36701) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1okzf8-0000lq-5n for 58608@debbugs.gnu.org; Tue, 18 Oct 2022 23:22:36 -0400 Original-Received: from [10.253.37.70] (port=27234 helo=webmail.orcon.net.nz) by smtp-2.orcon.net.nz with esmtpa (Exim 4.90_1) (envelope-from ) id 1okzf6-0006vG-BD for 58608@debbugs.gnu.org; Wed, 19 Oct 2022 16:22:32 +1300 Original-Received: from ip-116-251-140-135.kinect.net.nz ([116.251.140.135]) via [10.253.37.253] by webmail.orcon.net.nz with HTTP (HTTP/1.1 POST); Wed, 19 Oct 2022 16:22:32 +1300 In-Reply-To: <901d65e2e6e961136ff0053917d57a05@webmail.orcon.net.nz> X-Sender: psainty@orcon.net.nz X-GeoIP: -- X-Spam_score: -2.9 X-Spam_score_int: -28 X-Spam_bar: -- 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:245843 Archived-At: > In line mode middle click calls `mouse-⁠yank-⁠primary' I realised I should look at this as well, and sure enough it has some handling for `select-active-regions': (defun mouse-yank-primary (click) "Insert the primary selection at the position clicked on. Move point to the end of the inserted text, and set mark at beginning. If `mouse-yank-at-point' is non-nil, insert at point regardless of where you click." (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) ;; Without this, confusing things happen upon e.g. inserting into ;; the middle of an active region. (when select-active-regions (let (select-active-regions) (deactivate-mark))) (or mouse-yank-at-point (mouse-set-point click)) (let ((primary (gui-get-primary-selection))) (push-mark) (insert-for-yank primary))) The call to (mouse-set-point click) is also conditional here: (or mouse-yank-at-point (mouse-set-point click)) As opposed to: (defun term-mouse-paste (click) "Insert the primary selection at the position clicked on." (interactive "e") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) (setq this-command 'yank) (mouse-set-point click) (term-send-raw-string (gui-get-primary-selection))) I don't know if `mouse-yank-at-point' needs consideration here too? I wondered whether both of these could be rewritten to use a common subroutine, but it might be a bit awkward. Failing that, I would cross-reference them in code comments (are there any other similar functions besides?).