all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Emacs kill/copy under X versus under Windows
@ 2009-08-30 16:54 Jeff Clough
  2009-08-31 15:05 ` Drew Adams
  2009-08-31 16:28 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Jeff Clough @ 2009-08-30 16:54 UTC (permalink / raw
  To: GNU Emacs List

While dinking around with kill/yank and copy/paste to answer a question 
posted earlier, I stumbled upon something that I'd like to know how to fix.

Running 22.3 on both Windows and X, I notice a difference in how Emacs 
interacts with the clipboard.

Under X, killing and yanking text with the "normal" commands (such as 
kill-line) only diddles the kill ring and doesn't touch the clipboard 
selection.  Copying text in another application does not affect what you 
get when doing C-y in Emacs.  C-y doesn't care about your clipboard 
selection at all and neither does C-k, etc.  When you *do* care about 
such things, there are specific commands (like "Copy" from the menu) 
that let you do things.

Under Windows, this isn't true at all.  Whatever you last killed goes 
straight to the clipboard, and whatever you last copied in another 
application gets dumped into your buffer with a yank.  What's worse, try 
this in Windows:

1.  Type a line of text in Emacs and do a kill-line on it.
2.  Copy a different line of text from some other application.
3.  Do a (car kill-ring) in emacs.  See it display the text you typed 
from step #1.
4.  Do a C-y in emacs, this dumps in the text from step #2.
5.  Do (car kill-ring) again and see that the text from #2 has magically 
been added to the kill ring.

I should note that C-y, C-k and the like are all mapped to functions 
with the same names on both platforms (yank and kill-line, respectively) 
and doing a describe-function on these functions has no hint they should 
be working any differently.

So we have different behavior between ports for I don't know what reason 
(is it really assumed that someone capable of downloading and using 
Emacs on their Windows box is going to be confused by the behavior found 
on X systems?), and some *truly* nutty behavior under the Windows side.

Is there some way to make Emacs on Windows behave itself and ignore the 
clipboard unless told otherwise, just like under X?

Jeff

-- 

Author of the Genesys System
A "free" universal role-playing game.
http://www.chaosphere.com/genesys/





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

* RE: Emacs kill/copy under X versus under Windows
  2009-08-30 16:54 Emacs kill/copy under X versus under Windows Jeff Clough
@ 2009-08-31 15:05 ` Drew Adams
  2009-08-31 16:28   ` Jeff Clough
  2009-08-31 16:28 ` Eli Zaretskii
  1 sibling, 1 reply; 5+ messages in thread
From: Drew Adams @ 2009-08-31 15:05 UTC (permalink / raw
  To: 'Jeff Clough', 'GNU Emacs List'

> Running 22.3 on both Windows and X, I notice a difference in 
> how Emacs interacts with the clipboard.
> 
> Under Windows...Whatever you last killed goes 
> straight to the clipboard, and whatever you last copied in another 
> application gets dumped into your buffer with a yank.
...
> So we have different behavior between ports...

Yes, it is by design (a feature, not a bug).

> Is there some way to make Emacs on Windows behave itself and 
> ignore the clipboard unless told otherwise, just like under X?

C-h v  x-select-enable-clipboard

,----
| x-select-enable-clipboard's value is 
| t
| 
| Documentation:
| Non-nil means cutting and pasting uses the clipboard.
| This is in addition to the primary selection.
| 
| Defined in `term/w32-win'.
`----

This is non-nil on Windows because many users thought it was nutty that
out-of-the-box Emacs didn't work with other apps wrt copy/paste. You prefer that
it not do that, so set it to nil.





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

* Re: Emacs kill/copy under X versus under Windows
  2009-08-30 16:54 Emacs kill/copy under X versus under Windows Jeff Clough
  2009-08-31 15:05 ` Drew Adams
@ 2009-08-31 16:28 ` Eli Zaretskii
  1 sibling, 0 replies; 5+ messages in thread
From: Eli Zaretskii @ 2009-08-31 16:28 UTC (permalink / raw
  To: help-gnu-emacs

> Date: Sun, 30 Aug 2009 12:54:17 -0400
> From: Jeff Clough <jeff@chaosphere.com>
> 
> Under X, killing and yanking text with the "normal" commands (such as 
> kill-line) only diddles the kill ring and doesn't touch the clipboard 
> selection.  Copying text in another application does not affect what you 
> get when doing C-y in Emacs.  C-y doesn't care about your clipboard 
> selection at all and neither does C-k, etc.  When you *do* care about 
> such things, there are specific commands (like "Copy" from the menu) 
> that let you do things.
> 
> Under Windows, this isn't true at all.  Whatever you last killed goes 
> straight to the clipboard, and whatever you last copied in another 
> application gets dumped into your buffer with a yank.

As Drew pointed out, this is a feature.  Unlike X, which has primary
and secondary selection in addition the the clipboard, Windows has
only the clipboard.  So on Windows Emacs uses the clipboard as the
primary selection would be used on X (well, almost, because the
semantics of the clipboard and the primary selection are different).




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

* Re: Emacs kill/copy under X versus under Windows
  2009-08-31 15:05 ` Drew Adams
@ 2009-08-31 16:28   ` Jeff Clough
  0 siblings, 0 replies; 5+ messages in thread
From: Jeff Clough @ 2009-08-31 16:28 UTC (permalink / raw
  To: 'GNU Emacs List'

Drew Adams wrote:
> C-h v  x-select-enable-clipboard
>
> [snip]
> This is non-nil on Windows because many users thought it was nutty that
> out-of-the-box Emacs didn't work with other apps wrt copy/paste. You prefer that
> it not do that, so set it to nil.
>
>   

Thanks for pointing out this variable.  Setting to nil makes things work 
as expected.

Jeff

-- 

Author of the Genesys System
A "free" universal role-playing game.
http://www.chaosphere.com/genesys/





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

* Re: Emacs kill/copy under X versus under Windows
       [not found] <mailman.5696.1251714880.2239.help-gnu-emacs@gnu.org>
@ 2009-08-31 20:33 ` John A Pershing Jr
  0 siblings, 0 replies; 5+ messages in thread
From: John A Pershing Jr @ 2009-08-31 20:33 UTC (permalink / raw
  To: help-gnu-emacs

Jeff Clough <jeff@chaosphere.com> writes:

> 1.  Type a line of text in Emacs and do a kill-line on it.  2.  Copy a
> different line of text from some other application.  3.  Do a (car
> kill-ring) in emacs.  See it display the text you typed from step #1.
> 4.  Do a C-y in emacs, this dumps in the text from step #2.  5.  Do (car
> kill-ring) again and see that the text from #2 has magically been added
> to the kill ring.

The reason for this is that Emacs doesn't check the Windoze clipboard
until you run the 'yank' function (actually, the function named by
'interprogram-paste-function', but that's a low-level detail), so the
kill ring won't show the contents of the clipboard until you actually
yank it into the buffer.

  -jp


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

end of thread, other threads:[~2009-08-31 20:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-30 16:54 Emacs kill/copy under X versus under Windows Jeff Clough
2009-08-31 15:05 ` Drew Adams
2009-08-31 16:28   ` Jeff Clough
2009-08-31 16:28 ` Eli Zaretskii
     [not found] <mailman.5696.1251714880.2239.help-gnu-emacs@gnu.org>
2009-08-31 20:33 ` John A Pershing Jr

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.