Subject: bug#56530: 29.0.50; mouse-2 cut selected text when cua-mode is enabled

From: David Ponce <[email-masked]>
Date: Wed, 13 Jul 2022 13:10:32 +0200

On 13/07/2022 11:50, Visuwesh wrote:
> [Wednesday July 13, 2022] David Ponce wrote:
> 
>> Hello,
>>
>> I noticed that now, when cua-mode is enabled, when I select a region
>> (with mouse or keyboard), then use mouse-2 click on another point to
>> insert the selected text, the active region is cut before to insert text
>> at the mouse-2 click for the first time. As far as I remember this is a
>> new behavior, and previously the selected region was not cut, but
>> copied, like when cua-mode is disabled.
>>
>> The woraround is to first deselect the region before to click mouse-2 to
>> insert the previously selected text. This way the initially selected
>> text is not cut.
>>
>> Not sure this is expected, so this bug report ;-)
> 
> It is expected.  mouse-2 (and other mouse yank commands) were recently
> changed to respect delete-selection-mode (which is enabled by cua-mode)
> by yours truly.  :-)
> 
> You can disable the new behaviour by saying,
> 
>      (put 'mouse-yank-primary 'delete-selection nil)
>      (put 'mouse-yank-secondary 'delete-selection nil)
>      (put 'mouse-yank-at-click 'delete-selection nil)
> 
> But I guess, it sure didn't take long for the complaints to come in
Maybe the behavior could be disabled for cua-mode to be consistent with 
CUA expected behavior? After all, cua-mode is more than just 
delete-selection-mode ;-)

Thanks
[resent, forgot to CC the bug list]