GNU bug report logs - #6802
24.0.50; Yanking non-ASCII text from other X application leads to unicode escapes

Previous Next

Package: emacs;

Reported by: Kaloian Doganov <kaloian <at> gnu.org>

Date: Thu, 5 Aug 2010 15:32:01 UTC

Severity: normal

Merged with 6635

Found in version 24.0.50

Done: Jan Djärv <jan.h.d <at> swipnet.se>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Kenichi Handa <handa <at> m17n.org>
To: Kaloian Doganov <kaloian <at> gnu.org>
Cc: 6802 <at> debbugs.gnu.org
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 <87mxt1go33.fsf <at> doganov.org>, Kaloian Doganov <kaloian <at> gnu.org> 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.

mouse-yank-at-click
  ->yank->current-kill
    ->x-cut-buffer-or-selection-value
      ->x-get-buffer

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:
  \u041f\u0440\u043e\u0431\u0430

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.
     (deactivate-mark))
   (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
handa <at> m17n.org




This bug report was last modified 13 years and 233 days ago.

Previous Next


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