]> code.delx.au - gnu-emacs/blobdiff - lisp/simple.el
Merge from origin/emacs-24
[gnu-emacs] / lisp / simple.el
index f7f35564f35c735de8f155cd2ed3630a9b91af8b..518560704374b16ad0ffa561e936ebde83645a29 100644 (file)
@@ -4807,7 +4807,8 @@ run `deactivate-mark-hook'."
       ;; the region prior to the last command modifying the buffer.
       ;; Set the selection to that, or to the current region.
       (cond (saved-region-selection
-            (gui-set-selection 'PRIMARY saved-region-selection)
+            (if (gui-call gui-selection-owner-p 'PRIMARY)
+                (gui-set-selection 'PRIMARY saved-region-selection))
             (setq saved-region-selection nil))
            ;; If another program has acquired the selection, region
            ;; deactivation should not clobber it (Bug#11772).