From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#18090: 24.4.50; `delete-selection-helper' logic changed for non-mouse region? Date: Tue, 25 Sep 2018 22:02:20 +0300 Organization: LINKOV.NET Message-ID: <87r2hho7vv.fsf@mail.linkov.net> References: <95e066b9-792c-4b38-8f4b-fd225578ed45@default> <9859e098-daf7-4b67-a8a6-c53d01a18f93@default> <83fty4elsx.fsf@gnu.org> <87pnx8xckg.fsf@mail.linkov.net> <874leju83n.fsf@mail.linkov.net> <626fca93-0fba-4dd7-b119-7187b818dccb@default> <87ftxy69o9.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1537904106 12780 195.159.176.226 (25 Sep 2018 19:35:06 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Sep 2018 19:35:06 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 18090@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 25 21:35:02 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4t6q-0003AU-5D for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Sep 2018 21:35:02 +0200 Original-Received: from localhost ([::1]:54966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4t8w-0006UX-Qw for geb-bug-gnu-emacs@m.gmane.org; Tue, 25 Sep 2018 15:37:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g4t8q-0006UC-TG for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2018 15:37:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g4t8p-0005bA-5G for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2018 15:37:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:49768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g4t8o-0005ad-QL for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2018 15:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g4t8n-0000pJ-TW for bug-gnu-emacs@gnu.org; Tue, 25 Sep 2018 15:37: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: Tue, 25 Sep 2018 19:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18090 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18090-submit@debbugs.gnu.org id=B18090.15379042183169 (code B ref 18090); Tue, 25 Sep 2018 19:37:01 +0000 Original-Received: (at 18090) by debbugs.gnu.org; 25 Sep 2018 19:36:58 +0000 Original-Received: from localhost ([127.0.0.1]:54026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4t8k-0000p2-Ia for submit@debbugs.gnu.org; Tue, 25 Sep 2018 15:36:58 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:36566 helo=pdx1-sub0-mail-a31.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g4t8j-0000ou-0J for 18090@debbugs.gnu.org; Tue, 25 Sep 2018 15:36:57 -0400 Original-Received: from pdx1-sub0-mail-a31.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a31.g.dreamhost.com (Postfix) with ESMTP id 465A57F6EA; Tue, 25 Sep 2018 12:36:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=sKPpTOZxPgnzjiw1utjin8QoRhA=; b= GihXEAFX03SehQlsZSUoqVwYNeeE+un2+8I/8HFTKj39X8Dlx3q6qIZAn1RdsltU v2Jdg5/pD7jdBAsZf2p7Tv/Ds7Lwu066dgcUIG+wdunmut7oxmshxsfgV3lDThpR ieSfdIt8Mkk2DA34TFCTKS9YgZrB6h4YH8i+xeZS5w4= Original-Received: from localhost.linkov.net (m91-129-111-128.cust.tele2.ee [91.129.111.128]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a31.g.dreamhost.com (Postfix) with ESMTPSA id 1DA2C7F37D; Tue, 25 Sep 2018 12:36:53 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a31 X-DH-BACKEND: pdx1-sub0-mail-a31 In-Reply-To: (Drew Adams's message of "Mon, 24 Sep 2018 14:16:28 -0700 (PDT)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150657 Archived-At: >> Shouldn't mouse yanking be supported by `delete-selection-mode', >> what do you think? > > Dunno. Please file a bug report, if you think so. Or > feel free to bring that into this report, if you like. > > What do you want it to do? Does it do what you want if you > (put 'mouse-yank-primary 'delete-selection 'yank)? > If not, what code change do you think is needed? The reason why I asked this question is because it's the only case what might fail AFAICS. When I tried what you suggested (put 'mouse-yank-primary 'delete-selection 'yank) I see that it pastes at the wrong place - before yanking it moves point at the offset of the distance between the region beginning and the position clicked with the mouse, but since delete-selection-mode already deleted the region, this means that it puts point at unrelated text that shifts into this position after deleting the region. mouse-yank-primary provides the correct result only when mouse-yank-at-point is non-nil. I don't see how this could be supported within the limitations of the current design of delete-selection-mode. One way is to reimplement delete-selection-mode using advices - it's easy to put advice around mouse-yank-at-point that would set mouse-yank-at-point to t around the call to mouse-yank-at-point. Another not so good solution is to hard-code checks for delete-selection-mode in mouse-yank-primary. So after mouse-yank-primary is supported, we could look under what conditions to call (current-kill 1) in delete-selection-helper. Please note that the current condition in (eq type 'yank) that checks for (car kill-ring) is unsuitable because mouse-yank-primary pastes from (gui-get-primary-selection), not from (car kill-ring) >> I agree that code that calls (delete-active-region) under the >> condition (eq type 'yank) is essential to handle `yank'. >> But I think that (current-kill 1) is not essential >> unless it renders yank useless in some cases (yet unknown). > > Maybe you're right; dunno. > > Do you want to remove that code? Without it, does > `deletion-selection-mode' do what you want for both > t and nil values of `mouse-drag-copy-region'? > > At this point it's not clear to me what behavior is bugged, > if any. I'd like to hear what changes, if any, you propose, > both for the code and the desired behavior (for both t > and nil values of `mouse-drag-copy-region'). When mouse-drag-copy-region is non-nil, I see that (mouse-region-match) returns non-nil, so no changes are required in delete-selection-helper for this case.