all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: Kaloian Doganov <kaloian@gnu.org>
Cc: 6802@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	[thread overview]
Message-ID: <tl71va8sdbr.fsf@m17n.org> (raw)
In-Reply-To: <87mxt1go33.fsf@doganov.org> (message from Kaloian Doganov on Thu, 05 Aug 2010 16:56:32 +0300)

In article <87mxt1go33.fsf@doganov.org>, Kaloian Doganov <kaloian@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@m17n.org





  parent reply	other threads:[~2010-08-09  2:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-05 13:56 bug#6802: 24.0.50; Yanking non-ASCII text from other X application leads to unicode escapes Kaloian Doganov
2010-08-09  1:46 ` David De La Harpe Golden
2010-08-09  2:57 ` Kenichi Handa [this message]
2010-08-09 14:06   ` bug#6802: 24.0.50; Yanking non-ASCII text from other X application leads to unicodeescapes Drew Adams
2010-08-09 16:34   ` bug#6802: 24.0.50; Yanking non-ASCII text from other X application leads to unicode escapes Eli Zaretskii
2010-08-09 17:26     ` Jan Djärv
2010-08-10  2:29       ` Kenichi Handa
2010-08-10  6:15         ` Jan D.
2010-10-28 12:10           ` Štěpán Němec
2010-10-29  2:18             ` Kenichi Handa
2010-10-31  0:38               ` David De La Harpe Golden
2010-10-31 16:05                 ` Jan Djärv
2010-11-05 11:58                   ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tl71va8sdbr.fsf@m17n.org \
    --to=handa@m17n.org \
    --cc=6802@debbugs.gnu.org \
    --cc=kaloian@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.