+2012-07-08 Chong Yidong <cyd@gnu.org>
+
+ * simple.el (deactivate-mark): Do not set the primary selection
+ if another program has acquired it (Bug#11772).
+
2012-07-07 Kevin Ryde <user42@zip.com.au>
* woman.el (woman-strings): Fix double-quote handling (Bug#1151).
(cond (saved-region-selection
(x-set-selection 'PRIMARY saved-region-selection)
(setq saved-region-selection nil))
- ((/= (region-beginning) (region-end))
+ ;; If another program has acquired the selection, region
+ ;; deactivation should not clobber it (Bug#11772).
+ ((and (/= (region-beginning) (region-end))
+ (or (x-selection-owner-p 'PRIMARY)
+ (null (x-selection-exists-p 'PRIMARY))))
(x-set-selection 'PRIMARY
(buffer-substring-no-properties
(region-beginning)