From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#56530: 29.0.50; mouse-2 cut selected text when cua-mode is enabled Date: Sun, 24 Jul 2022 19:52:19 +0300 Organization: LINKOV.NET Message-ID: <86sfmq78sc.fsf@mail.linkov.net> References: <3c83c124-95a9-9dc6-a7a6-6e357c7574e4@orange.fr> <877d4hmjdh.fsf@gmail.com> <87lesxtivx.fsf@gnus.org> <87wnchl1fm.fsf@gmail.com> <86mtdcg6qr.fsf@mail.linkov.net> <87edyna9wy.fsf@gnus.org> <867d4fa9p7.fsf@mail.linkov.net> <87h73j7epu.fsf@gnus.org> <86edym1a36.fsf@mail.linkov.net> <8735f1tkg2.fsf@gnus.org> <86r12j5yya.fsf@mail.linkov.net> <877d4589un.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22195"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: David Ponce , 56530@debbugs.gnu.org, Visuwesh To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 24 19:20:45 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 1oFfHZ-0005d0-Ef for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Jul 2022 19:20:45 +0200 Original-Received: from localhost ([::1]:52500 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oFfHY-0001Am-0l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Jul 2022 13:20:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33820) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oFfFu-0008To-SV for bug-gnu-emacs@gnu.org; Sun, 24 Jul 2022 13:19:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:58844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oFfFu-0007Ab-J2 for bug-gnu-emacs@gnu.org; Sun, 24 Jul 2022 13:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oFfFu-0003Vf-Ed for bug-gnu-emacs@gnu.org; Sun, 24 Jul 2022 13:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 24 Jul 2022 17:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56530 X-GNU-PR-Package: emacs Original-Received: via spool by 56530-submit@debbugs.gnu.org id=B56530.165868308813419 (code B ref 56530); Sun, 24 Jul 2022 17:19:02 +0000 Original-Received: (at 56530) by debbugs.gnu.org; 24 Jul 2022 17:18:08 +0000 Original-Received: from localhost ([127.0.0.1]:48593 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oFfF2-0003UM-Ac for submit@debbugs.gnu.org; Sun, 24 Jul 2022 13:18:08 -0400 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:39995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oFfF0-0003Tc-A2 for 56530@debbugs.gnu.org; Sun, 24 Jul 2022 13:18:06 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 5B20C240002; Sun, 24 Jul 2022 17:17:57 +0000 (UTC) In-Reply-To: <877d4589un.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 22 Jul 2022 17:07:12 +0200") 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:237857 Archived-At: >> All affected mouse commands mouse-yank-from-menu, mouse-yank-at-click, >> mouse-yank-primary, mouse-yank-secondary have the same line: >> >> (or mouse-yank-at-point (mouse-set-point event)) >> >> So when the region is deleted by delete-selection-pre-hook >> `mouse-set-point' tries to set point using outdated information >> of the event's position in the deleted region. >> >> Maybe delete-selection-pre-hook could directly modify the event? >> Everything works fine with this: >> >> ((eq type 'yank-on-region) >> (let ((pos (posn-point (event-end last-nonmenu-event)))) >> (when (and (>= pos (region-beginning)) >> (<= pos (region-end))) >> (delete-selection-helper 'yank) >> (setf (nth 5 (nth 1 last-nonmenu-event)) (region-beginning))))) >> >> But is this a good idea? > > It sounds kinda gross. Would it be possible to rewrite these commands > to that point is set before the deletion is done, or is that unfeasible? delete-selection-mode deletes the region in pre-command-hook before running the command. Maybe then these commands could have special handling of delete-selection-mode? They already contain special handling of select-active-regions: ;; 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)))