changeset 112016:dd7d92a355c6

Fix bug #7699 with pasting selected text on MS-Windows. mouse.el (mouse-yank-primary): On MS-Windows, try the (emulated) PRIMARY first, then the clipboard.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 25 Dec 2010 12:57:02 +0200
parents fa60617e20c1
children db006527425b
files lisp/ChangeLog lisp/mouse.el
diffstat 2 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Dec 24 10:25:18 2010 +0100
+++ b/lisp/ChangeLog	Sat Dec 25 12:57:02 2010 +0200
@@ -1,3 +1,8 @@
+2010-12-25  Eli Zaretskii  <eliz@gnu.org>
+
+	* mouse.el (mouse-yank-primary): On MS-Windows, try the (emulated)
+	PRIMARY first, then the clipboard.  (Bug#7699)
+
 2010-12-22  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* emacs-lisp/bytecomp.el (byte-compile-output-docform): Fix up use of
--- a/lisp/mouse.el	Fri Dec 24 10:25:18 2010 +0100
+++ b/lisp/mouse.el	Sat Dec 25 12:57:02 2010 +0200
@@ -1282,7 +1282,16 @@
   (or mouse-yank-at-point (mouse-set-point click))
   (let ((primary
 	 (cond
-	  ((fboundp 'x-get-selection-value) ; MS-DOS, MS-Windows and X.
+	  ((eq system-type 'windows-nt)
+	   ;; 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)))
+	  ((fboundp 'x-get-selection-value) ; MS-DOS and 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.?