Subject: Re: bug#1765: Copy/paste inconsistent with other X apps

From: "Ole Laursen" <[email-masked]>
Date: Sun, 4 Jan 2009 17:29:59 +0100

2009/1/4 Sven Joachim <[email-masked]>:
> On 2009-01-04 04:33 +0100, Chong Yidong wrote:
>
>>> In every other recent X app I have tried, copy/pasting works the way
>>> that the mouse selection = copy and middle click = paste is seperate
>>> from the C-c/C-v clipboard.  I think it makes sense to change the
>>> Emacs behaviour to make it a good citizen in the free desktop. And
>>> it's arguably also more likely to prevent loss of clips.
>>
>> Set x-select-enable-clipboard to t.

It doesn't work, it's letting the selection overwrite the clipboard.
The behaviour we need here is that yank uses the clipboard and
kill-ring only. Never the selection.

I looked into x-win.el, and it seems this change (Dec. 25 2007) did
all the hard work:

  http://cvs.savannah.gnu.org/viewvc/emacs/lisp/term/x-win.el?root=emacs&r1=1.218&r2=1.219

So it's merely a matter of changing the two defcustoms

 (defcustom x-select-enable-clipboard nil ...)
 (defcustom x-select-enable-primary t ...)

to the reverse

 (defcustom x-select-enable-clipboard t ...)
 (defcustom x-select-enable-primary nil ...)

> I don't think it's a matter of speed (I set x-select-enable-clipboard to
> t long ago, and there are no noticeable delays), but rather the problems
> that occur with pasting text from "legacy" applications like xterm that
> only use the primary selection.  See
> http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg02462.html.

But that's a problem with xterm. It only supports mouse copy/paste.
And actually, as far as I can tell, it's still working with xterm
because it's using the cut buffers that everyone seam to agree should
die but Emacs is still supporting (also with the above changes I'm
suggesting).

Regarding speed issues: other applications with much larger data sets
can use the clipboard without problems. If you read Jamie Zawinski's
account, he's arguing that it's a problem because people might have a
clipboard monitoring app that sucks in the data - but the natural
evolution of that argument is that no X apps should use the clipboard
because of performance issues. If you have a program that slows down
your desktop because it's monitoring the clipboard in a dumb way, then
either you remove that program or you fix it to be less dumb. In any
case, it's not Emacs' problem.

-- 
Ole Laursen
http://people.iola.dk/olau/