Subject: Re: bug#21196: 24.5; Paste from clipboard to emacs -nw on windows 8.1

From: Eli Zaretskii <[email-masked]>
Date: Thu, 06 Aug 2015 17:31:38 +0300

> Date: Wed, 5 Aug 2015 20:06:19 -0400
> From: Pablo Mercader Alcántara <[email-masked]>
> 
> Some days ago I installed version 24.5, in the previous version that I
> used (24.3) everything was fine.
> 
> I start my emacs session with the "-nw" command line option. And
> proceeded to work. Everything works fine, except that now after the
> update the text that I kill on emacs doesn't go into windows
> clipboard. I can paste on emacs text coming from other programs through
> the clipboard, but the inverse is not possible.

This is expected behavior: Emacs doesn't support clipboard operations
in -nw sessions, neither on MS-Windows nor on other platforms.  To be
sure, I just tested in v24.3 on MS-Windows, and I see there exactly
the same results as you report for 24.5.  So I cannot understand why
you say it was OK in v24.3.

> When I start emacs normally (without "-nw") everything works fine, so at
> first I thought that this was some kind of new configuration. Later I
> decided to make some research and found where the problem was. Looking
> at the value of the variable "interprogram-cut-function" in my system I
> see that it's set to "x-select-text" and in my system this function is
> defined at "common-win.el". In the body of "x-select-text" the first
> "cond" function is like this "(cond ((eq (framep (selected-frame)) 'w32)
> ..." and I think this is the cause for the kill function to be unable to
> send the text to the clipboard when running with the "-nw" option,
> because when emacs runs in this mode the call "(framep
> (selected-frame))" returns "t" when it is waiting for a "w32"
> value. When the same call is run on the emacs running whithout the "-nw"
> option the expected "w32" value appears.

That's correct.  And the same is true for Emacs 24.3.  Maybe you mean
Emacs 23, where indeed the test for the GUI frame was absent.  But
that was an omission, which is now fixed.

If you want to have access to the clipboard in -nw sessions, you can
always override x-select-text with your own version that doesn't
include that test.  Although I'm unsure why would you want to use
text-mode sessions too much on MS-Windows; GUI sessions have, of
course, full access to the clipboard.