[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6802: 24.0.50; Yanking non-ASCII text from other X application leads

From: Kenichi Handa
Subject: bug#6802: 24.0.50; Yanking non-ASCII text from other X application leads to unicode escapes
Date: Mon, 09 Aug 2010 11:57:12 +0900

In article <address@hidden>, Kaloian Doganov <address@hidden> writes:

> 0. Start Emacs using `emacs -Q'.
> 1. Open some other X application (gedit, GNOME Terminal, etc.) and enter
>    the following text:

>        Проба

> 2. Select the text using the mouse and yank it using mouse-2 in a
>    scratch buffer in Emacs.

> 3. The result is:

>        \u041f\u0440\u043e\u0431\u0430

>    instead of the expected:

>        Проба

I can reproduce this bug.  In Emacs 23 mouse-2 was bound to
mouse-yank-at-click which calls (x-get-selection 'PRIMARY
'UTF8_STRING) with this calling sequence.


But, now mouse-2 is bound to mouse-yank-primary which
directly calls (x-get-selection 'PRIMARY).  As the second
optional arg DATA-TYPE is omitted, x-get-selection uses
'STRING for that.  And, for such a data-type request, Gnome
applications returns something like this:

There are various ways to fix it, and each is fairly easy
once we decide the precise spec of each functions.  But as I
have not followed the discussions in the thread "Cut and
paste with C-w/mouse-2 not working?", I don't know which is
the best.  One easy way is this:

=== modified file 'lisp/mouse.el'
--- lisp/mouse.el       2010-08-08 21:57:34 +0000
+++ lisp/mouse.el       2010-08-09 02:54:23 +0000
@@ -1265,7 +1265,7 @@
     ;; the middle of an active region.
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((primary (x-get-selection 'PRIMARY)))
+  (let ((primary (x-get-selection 'PRIMARY 'TEXT)))
     (if primary
         (insert primary)
       (error "No primary selection"))))

Kenichi Handa

reply via email to

[Prev in Thread] Current Thread [Next in Thread]