Subject: bug#6635: mouse-yank-primary/secondary and unicode from other apps.

From: David De La Harpe Golden <[email-masked]>
Date: Thu, 15 Jul 2010 01:38:11 +0100

mouse-yank-primary and mouse-yank-secondary don't like
inserting non-ascii chars from other apps.

They need to use the slightly higher-level
(x-selection-value 'PRIMARY)

or at least give a 'TEXT arg to their
(x-get-selection 'PRIMARY 'TEXT),

so that the proper kinds of selection type are tried
as e.g. attached.

=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2010-07-14 18:03:39 +0000
+++ lisp/mouse.el	2010-07-15 00:32:41 +0000
@@ -1277,19 +1277,19 @@
   (interactive "e")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (when select-active-regions
     ;; Without this, confusing things happen upon e.g. inserting into
     ;; 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-selection-value 'PRIMARY)))
     (if primary
-        (insert (x-get-selection 'PRIMARY))
+        (insert (x-selection-value 'PRIMARY))
       (error "No primary selection"))))
 
 (defun mouse-kill-ring-save (click)
   "Copy the region between point and the mouse click in the kill ring.
 This does not delete the region; it acts like \\[kill-ring-save]."
   (interactive "e")
   (mouse-set-mark-fast click)
   (let (this-command last-command)
@@ -1572,19 +1572,19 @@
   "Insert the secondary selection at the position clicked on.
 Move point to the end of the inserted text.
 If `mouse-yank-at-point' is non-nil, insert at point
 regardless of where you click."
   (interactive "e")
   ;; Give temporary modes such as isearch a chance to turn off.
   (run-hooks 'mouse-leave-buffer-hook)
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((secondary (x-get-selection 'SECONDARY)))
+  (let ((secondary (x-selection-value 'SECONDARY)))
     (if secondary
-        (insert (x-get-selection 'SECONDARY))
+        (insert (x-selection-value 'SECONDARY))
       (error "No secondary selection"))))
 
 (defun mouse-kill-secondary ()
   "Kill the text in the secondary selection.
 This is intended more as a keyboard command than as a mouse command
 but it can work as either one.
 
 The current buffer (in case of keyboard use), or the buffer clicked on,