Do not steal primary selection on mark deactivation.

* lisp/simple.el (deactivate-mark): Do not set the primary selection
if another program has acquired it.

Fixes: debbugs:11772
This commit is contained in:
Chong Yidong 2012-07-08 14:09:21 +08:00
parent 1ac8b55c0c
commit d75be97d54
2 changed files with 10 additions and 1 deletions

View file

@ -1,3 +1,8 @@
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).

View file

@ -3863,7 +3863,11 @@ run `deactivate-mark-hook'."
(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)