Subject: bug#6774: Cut and paste with C-w/mouse-2 not working?

From: Angelo Graziosi <[email-masked]>
Date: Mon, 02 Aug 2010 15:33:46 +0200

Il 02/08/2010 6.12, David De La Harpe Golden ha scritto:
> On 01/08/10 23:04, Angelo Graziosi wrote:
>> It seems that with recent trunk sources (also with the last,
>> rev.100958), cutting with C-w and then pasting with mouse-2 does not
>> work. To reproduce:
>>
>> 1. emacs -Q &
>>
>> 2. In the 'scratch' buffer double click on some text, 'buffer', for
>> example.
>>
>> 3. Now cut it: C-w
>>
>> 4. Go to the bottom of the buffer and paste with mouse-2: empty!
>>
>> I can paste only with C-y. If at step 3. I use M-w (Copy), then pasting
>> with mouse-2 works.
>>
>
> Yes, there's a problem here - I guess emacs is keeping primary bound to
> a span that's become zero-length. Again.
>
> N.B. your case ideally would work in emacs much like in KDE - but emacs
> still has teething problems and sometimes manages to make primary a
> zero-length string.[this is already "fixed" in the horrible selx branch]
>
>> For example, on Kubuntu, one can cut with C-x and the paste with mouse-2
>> (Konqueror, Kate,...)
>
> Not exactly - not quite what's really going on. There's a spec for how
> this is supposed to work, and KDE follows it.*
>
> When you have _selected_ the text in KDE before hitting C-x, it is made
> available as the "primary" x11 selection (referred to as "the selection"
> in klipper*)
>
> C-x makes the text available as the CLIPBOARD x11 selection while
> removing it from the body of the document. (and it's still available on
> PRIMARY too, where emacs fails).
>
> mouse-2 inserts what's in PRIMARY in KDE.
>
> So in KDE, try selecting more/different text, _without_ hitting C-x or
> C-c. This will change only PRIMARY.
>
> Hitting mouse-2 again will insert the _new_ PRIMARY.
>
> Then hitting C-v will insert the old CLIPBOARD. To update the clipboard
> you always have to C-x or C-c.
>
> (* though the situation is further complicated by klipper, the KDE
> clipboard daemon, which can be configured to do various strange things
> in this area, I mean KDE's out-of-box defaults).

I do not doubt that, internally, things are different. Anyway, from the
'End User' point of view,

C-w/mouse-2 (in Emacs)

should behave in the same way of

C-X/mouse-2 (in other X applications like Konqueror, Kate etc.)

BTW, if I add the step:

1.1 I choose: Options | C-x/.../C-v Cut and Paste (CUA)

then C-x/mouse-2, in Emacs still does not work!

So, at the moment, Emacs, in this regard (Copy/Paste), from the 'End
User' point of view, behaves differently from other X applications.

Ciao,
Angelo.