summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2010-12-25 12:57:02 +0200
committerEli Zaretskii <eliz@gnu.org>2010-12-25 12:57:02 +0200
commite77714da30b53ec866d2bbfd88527b215a715bb0 (patch)
treee8c5596b21733557c1270dda02f75207466c9cbd /lisp/mouse.el
parent36de6a045f3c3de316e2703aecee2861ede70cb4 (diff)
downloademacs-e77714da30b53ec866d2bbfd88527b215a715bb0.tar.gz
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.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index aa5dadf84ff..14d981f78b2 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1282,7 +1282,16 @@ regardless of where you click."
(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.?