GNU bug report logs - #6720
battle with x-clipboard vs. Chinese

Previous Next

Package: emacs;

Reported by: jidanni <at> jidanni.org

Date: Sat, 24 Jul 2010 17:37:02 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 6720 in the body.
You can then email your comments to 6720 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sat, 24 Jul 2010 17:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jidanni <at> jidanni.org:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 24 Jul 2010 17:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: bug-gnu-emacs <at> gnu.org
Subject: battle with x-clipboard vs. Chinese
Date: Sun, 25 Jul 2010 01:36:17 +0800
I just updated to
emacs-snapshot:
  Installed: 1:20100724-1
and am having to battle getting Chinese in correctly from the X
clipboard.
It is turning into ###, ???, \u{5432}, etc. etc.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sat, 24 Jul 2010 19:09:02 GMT) Full text and rfc822 format available.

Message #8 received at 6720 <at> debbugs.gnu.org (full text, mbox):

From: David De La Harpe Golden <david <at> harpegolden.net>
To: jidanni <at> jidanni.org
Cc: 6720 <at> debbugs.gnu.org
Subject: Re: bug#6720: battle with x-clipboard vs. Chinese
Date: Sat, 24 Jul 2010 20:08:07 +0100
On 24/07/10 18:36, jidanni <at> jidanni.org wrote:
> I just updated to
> emacs-snapshot:
>    Installed: 1:20100724-1
> and am having to battle getting Chinese in correctly from the X
> clipboard.
> It is turning into ###, ???, \u{5432}, etc. etc.
>

Do you see this when using middle mouse button or C-y or both?

This sounds like it might be bug #6635, an encoding handling problem in 
mouse-yank-primary, which could affect people more due to recent changes:

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6635






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sun, 25 Jul 2010 01:10:04 GMT) Full text and rfc822 format available.

Message #11 received at 6720 <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: david <at> harpegolden.net
Cc: 6720 <at> debbugs.gnu.org, 6635 <at> debbugs.gnu.org
Subject: Re: battle with x-clipboard vs. Chinese
Date: Sun, 25 Jul 2010 09:08:58 +0800
>>>>> "DDLHG" == David De La Harpe Golden <david <at> harpegolden.net> writes:

DDLHG> On 24/07/10 18:36, jidanni <at> jidanni.org wrote:
>> I just updated to
>> emacs-snapshot:
>> Installed: 1:20100724-1
>> and am having to battle getting Chinese in correctly from the X
>> clipboard.
>> It is turning into ###, ???, \u{5432}, etc. etc.
>> 

DDLHG> Do you see this when using middle mouse button or C-y or both?

All I know is starting with 
   $ apt-cache policy emacs-snapshot 
   emacs-snapshot:
     Installed: 1:20100724-1
     Candidate: 1:20100724-1
     Version table:
    *** 1:20100724-1 0
           500 http://emacs.orebokech.com sid/main Packages
           100 /var/lib/dpkg/status

I am having two kinds of pain:

1. Having to write things into /tmp/files to be able to read them into
emacs correctly as xclip now can't if I want Chinese intact.
I try every button and end up having to resort to /tmp.


2. Even more disconnection between C-y, Shift-insert, the middle mouse
button, between emacs and the outside world. I wish I could make them
all connected.

DDLHG> This sounds like it might be bug #6635, an encoding handling problem
DDLHG> in mouse-yank-primary, which could affect people more due to recent
DDLHG> changes:

DDLHG> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6635






Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sun, 25 Jul 2010 01:29:02 GMT) Full text and rfc822 format available.

Message #14 received at 6720 <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: david <at> harpegolden.net
Cc: 6720 <at> debbugs.gnu.org, 6635 <at> debbugs.gnu.org
Subject: Re: battle with x-clipboard vs. Chinese
Date: Sun, 25 Jul 2010 09:28:20 +0800
And the most scary thing of all is now things that I kill with C-k in
emacs are not necessarily what Shift-Insert will now paste in xterm.
That has never happened before and is causing me to send dangers wads of
text of some previous yank to the shell.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sun, 25 Jul 2010 03:32:02 GMT) Full text and rfc822 format available.

Message #17 received at 6720 <at> debbugs.gnu.org (full text, mbox):

From: David De La Harpe Golden <david <at> harpegolden.net>
To: jidanni <at> jidanni.org
Cc: 6720 <at> debbugs.gnu.org
Subject: Re: battle with x-clipboard vs. Chinese
Date: Sun, 25 Jul 2010 04:31:57 +0100
[Message part 1 (text/plain, inline)]
On 25/07/10 02:08, jidanni <at> jidanni.org wrote:

> All I know is starting with
>   $ apt-cache policy emacs-snapshot
>   emacs-snapshot:
>     Installed: 1:20100724-1
>     Candidate: 1:20100724-1


Yes, this appears to be Romain Francoise's snapshot packaging of latest 
emacs development code. Bug reports for development code are of course 
helpful and welcome, but please be aware that isn't an official release 
if you aren't already.

> I am having two kinds of pain:
>
> 1. Having to write things into /tmp/files to be able to read them into
> emacs correctly as xclip now can't if I want Chinese intact.
> I try every button and end up having to resort to /tmp.


Middle mouse button is currently known to be broken due to #6635., 
symptoms being strings like  "\u4e2d\u6587" or "中文".

"M-x load-file" of the attached fix6635.el file in emacs will help 
there, until a fix goes into the tree.

"xclip": you mean the command line tool to manipulate the clipboard?

Using xclip to put text on the clipboard for C-y to pull in does seem to 
work as expected on my system:

# shell
$ echo "中文" | xclip -selection clipboard

# in emacs, C-y
中文


But I don't actually know chinese.  Do you have a sample string that is 
breaking if you do the above?

[fix6635.el (text/x-emacs-lisp, attachment)]

Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sun, 25 Jul 2010 03:59:02 GMT) Full text and rfc822 format available.

Message #20 received at 6720 <at> debbugs.gnu.org (full text, mbox):

From: David De La Harpe Golden <david <at> harpegolden.net>
To: jidanni <at> jidanni.org
Cc: 6720 <at> debbugs.gnu.org
Subject: Re: battle with x-clipboard vs. Chinese
Date: Sun, 25 Jul 2010 04:58:22 +0100
On 25/07/10 02:28, jidanni <at> jidanni.org wrote:
> And the most scary thing of all is now things that I kill with C-k in
> emacs are not necessarily what Shift-Insert will now paste in xterm.

This is a likely separate issue to the encoding problem and expected 
behaviour.   Recently a decision was made to make emacs act more like 
and play nicer with more recent x11 applications in the area of cut and 
paste.  xterm is ...not a recent application in this respect.

Things killed in emacs presently go to the _system clipboard_, but 
Shift-Insert in xterm inserts the "x11 primary selection" (unless you 
reconfigure it to use the clipboard).

The below does not directly address encoding problems (though step 3 
will mask the known encoding bug):

*** The new settings are only a revised default, you can still 
reconfigure emacs to act like it used to.  This will mean it won't work 
well with more recent x11 applications anymore, much like the way xterm 
doesn't work well with them.  Of course, you may not care.

1. M-x customize-group killing

Turn off x-select-enable-clipboard
Turn on x-select-enable-primary
Turn off select-active-regions

2. M-x customize-group mouse

Turn on mouse-drag-copy-region

3. Add the following to your ~/.emacs:

(global-set-key [mouse-2] 'mouse-yank-at-click)


**** various forms of xterm reconfiguration are also possible, though 
may not prove satisfactory. Using gnome-terminal (or xfce4-terminal or 
konsole, etc.) might be a better option.

Firstly, you can easily make xterm use the clipboard, but then it uses 
it all the time:  Hold down ctrl and middle mouse button on the xterm 
window. Select menu option "Select to Clipboard".  If you like that, 
making that permanent involves setting X resource 
XTerm.selectToClipboard as per the xterm manual.

http://www.davidsimmons.com/soft/xtermhacks/#copynpaste has another take 
on the problem with xterm in this area, and offers some more advanced 
hackery for changing xterm's behaviour.













Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#6720; Package emacs. (Sun, 25 Jul 2010 17:10:02 GMT) Full text and rfc822 format available.

Message #23 received at 6720 <at> debbugs.gnu.org (full text, mbox):

From: jidanni <at> jidanni.org
To: david <at> harpegolden.net
Cc: 6720 <at> debbugs.gnu.org
Subject: Re: battle with x-clipboard vs. Chinese
Date: Mon, 26 Jul 2010 01:09:10 +0800
Cool, using
   (setq
    x-select-enable-clipboard nil
    x-select-enable-primary t
    select-active-regions nil
    mouse-drag-copy-region t)
   (global-set-key [mouse-2] 'mouse-yank-at-click)
I didn't even need to load that .el you sent and all seems OK now. Thanks!




bug closed, send any further explanations to jidanni <at> jidanni.org Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 25 Feb 2011 00:14:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 25 Mar 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 14 years and 86 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.