Subject: bug#20906: 25.0.50;

From: Andreas Schwab <[email-masked]>
Date: Thu, 08 Oct 2015 16:02:05 +0200

Mike FABIAN <[email-masked]> writes:

> Eli Zaretskii <[email-masked]> さんはかきました:
>
>> If the data we receive is different, I guess the only explanation
>> could be that we request it in some different way?
>
> Yes, in the old code
>
>    (defun x-get-selection (&optional type data-type)
>
> is called with “'UTF8_STRING” in data-type,
> in the new code 
>
>    (defun gui-get-selection (&optional type data-type)
>
> is called with “nil” in data type.
>
> That seems to make the difference, evaluating
>
>     (gui-get-selection 'PRIMARY 'UTF8_STRING)
>
> gets the selection correctly using the new code,  
>
>     (gui-get-selection 'PRIMARY)
>
> produces the problem I am seeing. 
>
> I still now know why this is called differently, looking ...

This:

diff --git a/lisp/mouse.el b/lisp/mouse.el
index 93bd628..f569ec3 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1068,24 +1068,7 @@ regardless of where you click."
     (let (select-active-regions)
       (deactivate-mark)))
   (or mouse-yank-at-point (mouse-set-point click))
-  (let ((primary
-         (if (fboundp 'x-get-selection-value)
-             (if (eq (framep (selected-frame)) 'w32)
-                 ;; MS-Windows emulates PRIMARY in x-get-selection, but not
-                 ;; in x-get-selection-value (the latter only accesses the
-                 ;; clipboard).  So try PRIMARY first, in case they selected
-                 ;; something with the mouse in the current Emacs session.
-                 (or (x-get-selection 'PRIMARY)
-                     (x-get-selection-value))
-               ;; Else MS-DOS or X.
-               ;; On X, x-get-selection-value supports more formats and
-               ;; encodings, so use it in preference to x-get-selection.
-               (or (x-get-selection-value)
-                   (x-get-selection 'PRIMARY)))
-           ;; FIXME: What about xterm-mouse-mode etc.?
-           (x-get-selection 'PRIMARY))))
-    (unless primary
-      (error "No selection is available"))
+  (let ((primary (gui-get-primary-selection)))
     (push-mark (point))
     (insert-for-yank primary)))

The comment is there for a reason...

Andreas.

-- 
Andreas Schwab, SUSE Labs, [email-masked]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."