unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
@ 2023-06-03 13:35 Shynur Xie
  2023-06-03 13:52 ` Shynur Xie
  2023-06-04  0:31 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 9+ messages in thread
From: Shynur Xie @ 2023-06-03 13:35 UTC (permalink / raw)
  To: 63872

[-- Attachment #1: Type: text/plain, Size: 499 bytes --]

The function `mouse-drag-and-drop-region' couldn't cut/move the
selected region when `mark-even-if-inactive' is t.

Say execute `emacs -Q` then evaluate
    (custom-set-variables
     '(mark-even-if-inactive nil)
     '(mouse-drag-and-drop-region t))
When I use mouse to drag and drop a selected region, the region is not
cut and pasted; it is copied and pasted instead.

The attached patch binds `mark-even-if-inactive' to t within the body
of `mouse-drag-and-drop-region'.

--
shynur

[-- Attachment #2: 0001-Fix-bug-that-mouse-drag-and-drop-region-couldn-t-cut.patch --]
[-- Type: application/octet-stream, Size: 885 bytes --]

From e6c6d33b3b4f142d475a50c71b011ea0ef0f1533 Mon Sep 17 00:00:00 2001
From: Shynur <one.last.kiss@outlook.com>
Date: Sat, 3 Jun 2023 21:14:41 +0800
Subject: [PATCH] Fix bug that `mouse-drag-and-drop-region' couldn't cut

* lisp/mouse.el (mouse-drag-and-drop-region): Bind
`mark-even-if-inactive' to t locally.
---
 lisp/mouse.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 3c30361ad7d..475b3871348 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -3154,6 +3154,7 @@ is copied instead of being cut."
          ;; System tooltips tend to flicker and in general work
          ;; incorrectly.
          (use-system-tooltips nil)
+         (mark-even-if-inactive t)
          ;; Whether or not some text was ``cut'' from Emacs to another
          ;; program and the cleaanup code should not try modifying the
          ;; region.
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
  2023-06-03 13:35 bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut Shynur Xie
@ 2023-06-03 13:52 ` Shynur Xie
  2023-06-04  0:31 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 9+ messages in thread
From: Shynur Xie @ 2023-06-03 13:52 UTC (permalink / raw)
  To: 63872@debbugs.gnu.org

A typo in line 2:

> selected region when `mark-even-if-inactive' is t.
                                                  ^
                                         should be "nil" here




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
  2023-06-03 13:35 bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut Shynur Xie
  2023-06-03 13:52 ` Shynur Xie
@ 2023-06-04  0:31 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-04  8:38   ` Shynur Xie
  1 sibling, 1 reply; 9+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-04  0:31 UTC (permalink / raw)
  To: Shynur Xie; +Cc: 63872

Shynur Xie <one.last.kiss@outlook.com> writes:

> When I use mouse to drag and drop a selected region, the region is not
> cut and pasted; it is copied and pasted instead.

With transient-mark-mode on or off?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
  2023-06-04  0:31 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-06-04  8:38   ` Shynur Xie
  2023-06-04  8:48     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 9+ messages in thread
From: Shynur Xie @ 2023-06-04  8:38 UTC (permalink / raw)
  To: Po Lu; +Cc: 63872@debbugs.gnu.org

> From: Po Lu
> Date: Sun, 04 Jun 2023 08:31:31 +0800
>   To: Shynur
>
>> When I use mouse to drag and drop a selected region, the region is
>> not cut and pasted; it is copied and pasted instead.
>
> With transient-mark-mode on or off?

On, by default.  I used `-Q` to launch Emacs.

(I forgot to CC the last email, my apologies.  I am resending it now.)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
  2023-06-04  8:38   ` Shynur Xie
@ 2023-06-04  8:48     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]       ` <SN7PR11MB74653C0C276CD27DE0CCD886D74CA@SN7PR11MB7465.namprd11.prod.outlook.com>
  0 siblings, 1 reply; 9+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-04  8:48 UTC (permalink / raw)
  To: Shynur Xie; +Cc: 63872@debbugs.gnu.org

Shynur Xie <one.last.kiss@outlook.com> writes:

>> From: Po Lu
>> Date: Sun, 04 Jun 2023 08:31:31 +0800
>>   To: Shynur
>>
>>> When I use mouse to drag and drop a selected region, the region is
>>> not cut and pasted; it is copied and pasted instead.
>>
>> With transient-mark-mode on or off?
>
> On, by default.  I used `-Q` to launch Emacs.

Right.  Have you looked at the option
`mouse-drag-and-drop-region-cut-when-buffers-differ'?  I believe you're
experiencing intentional behavior: by default, text is copied when the
buffer which receives the drop is different from its source.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
       [not found]       ` <SN7PR11MB74653C0C276CD27DE0CCD886D74CA@SN7PR11MB7465.namprd11.prod.outlook.com>
@ 2023-06-04 10:50         ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-06 10:57         ` Stefan Kangas
  1 sibling, 0 replies; 9+ messages in thread
From: Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-04 10:50 UTC (permalink / raw)
  To: Shynur Xie; +Cc: Po Lu, 63872

On Jun 4, 2023, at 17:04, Shynur Xie <one.last.kiss@outlook.com> wrote:
> 
> 
>> 
>> From: Po Lu
>> Date: Sun, 04 Jun 2023 16:48:00 +0800
>>  To: Shynur
>> 
>> I believe you're experiencing intentional behavior: by default, text
>> is copied when the buffer which receives the drop is different from
>> its source.
> 
> The destination buffer is the original buffer.  I attached an MP4.
> 
> --
> shynur
> <bug63872-1.mp4>

Next time, please compress your attachments when they are large (> 1MB).  :)

-- 
Best,


RY





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
       [not found]       ` <SN7PR11MB74653C0C276CD27DE0CCD886D74CA@SN7PR11MB7465.namprd11.prod.outlook.com>
  2023-06-04 10:50         ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-06 10:57         ` Stefan Kangas
  2023-09-06 11:42           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 9+ messages in thread
From: Stefan Kangas @ 2023-09-06 10:57 UTC (permalink / raw)
  To: Shynur Xie; +Cc: Po Lu, 63872@debbugs.gnu.org

Shynur Xie <one.last.kiss@outlook.com> writes:

>> From: Po Lu
>> Date: Sun, 04 Jun 2023 16:48:00 +0800
>>   To: Shynur
>>
>> I believe you're experiencing intentional behavior: by default, text
>> is copied when the buffer which receives the drop is different from
>> its source.
>
> The destination buffer is the original buffer.  I attached an MP4.

The video shows that text is copied also when the buffer which receives
the drop is the same as the source buffer.

Is that the intended behavior?  It seems off, to me.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
  2023-09-06 10:57         ` Stefan Kangas
@ 2023-09-06 11:42           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-09-06 12:07             ` Stefan Kangas
  0 siblings, 1 reply; 9+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-09-06 11:42 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Shynur Xie, 63872@debbugs.gnu.org

Stefan Kangas <stefankangas@gmail.com> writes:

> The video shows that text is copied also when the buffer which receives
> the drop is the same as the source buffer.
>
> Is that the intended behavior?  It seems off, to me.

I can't download that attachment, so would you please summarize its
contents?  The important detail is whether the destination window is the
same as the source.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut
  2023-09-06 11:42           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-09-06 12:07             ` Stefan Kangas
  0 siblings, 0 replies; 9+ messages in thread
From: Stefan Kangas @ 2023-09-06 12:07 UTC (permalink / raw)
  To: Po Lu; +Cc: Shynur Xie, 63872@debbugs.gnu.org

Po Lu <luangruo@yahoo.com> writes:

> Stefan Kangas <stefankangas@gmail.com> writes:
>
>> The video shows that text is copied also when the buffer which receives
>> the drop is the same as the source buffer.
>>
>> Is that the intended behavior?  It seems off, to me.
>
> I can't download that attachment, so would you please summarize its
> contents?  The important detail is whether the destination window is the
> same as the source.

I can reproduce this on current master with the following steps:

0. emacs -Q
1. Evaluate this in *scratch*:

    (custom-set-variables
     '(mark-even-if-inactive nil)
     '(mouse-drag-and-drop-region t))

2. Mark some text with the mouse, and then drag and drop it into the
   same window.

The result is that the text is copied.  This is also what happens in the
video.

In GNU Emacs 30.0.50 (build 12, x86_64-apple-darwin21.6.0, NS
 appkit-2113.60 Version 12.6.8 (Build 21G725)) of 2023-09-06 built on
 MY-MacBook-Pro
Repository revision: c3584bb3ab6f442a837464e191182f713acc3be3
Repository branch: master
Windowing system distributor 'Apple', version 10.3.2113
System Description:  macOS 12.6.8

Configured features:
ACL GIF GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE NS
PDUMPER PNG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP
XIM ZLIB





^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-09-06 12:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-03 13:35 bug#63872: [PATCH] `mouse-drag-and-drop-region' sometimes couldn't cut Shynur Xie
2023-06-03 13:52 ` Shynur Xie
2023-06-04  0:31 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-04  8:38   ` Shynur Xie
2023-06-04  8:48     ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]       ` <SN7PR11MB74653C0C276CD27DE0CCD886D74CA@SN7PR11MB7465.namprd11.prod.outlook.com>
2023-06-04 10:50         ` Ruijie Yu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-06 10:57         ` Stefan Kangas
2023-09-06 11:42           ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-06 12:07             ` Stefan Kangas

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).