diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2009-07-17 15:45:08 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2009-07-17 15:45:08 +0000 |
commit | 3f5c9cad1790b08f123b2bf81aa090b23e416f25 (patch) | |
tree | ca2fdda1e0c254f4f033cfa84afb5d62b3001809 /lisp/simple.el | |
parent | db170c743ed325cbd0ed5c3ab93a1c07a0ec504f (diff) | |
download | emacs-3f5c9cad1790b08f123b2bf81aa090b23e416f25.tar.gz |
* w32-fns.el (x-selection-owner-p): New function.
* mouse.el (mouse-drag-track): Call deactivate-mark earlier.
(mouse-yank-at-click): If select-active-regions is non-nil,
deactivate the mark before insertion.
* simple.el (deactivate-mark, set-mark): Only save selection if we
own it.
Diffstat (limited to 'lisp/simple.el')
-rw-r--r-- | lisp/simple.el | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/simple.el b/lisp/simple.el index 959076b11cb..1e0f83152cf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -3489,6 +3489,7 @@ This function also runs `deactivate-mark-hook'." ;; Copy the latest region into the primary selection, if desired. (and select-active-regions mark-active + (x-selection-owner-p 'PRIMARY) (x-set-selection 'PRIMARY (buffer-substring-no-properties (region-beginning) (region-end)))) (if (and (null force) @@ -3533,8 +3534,12 @@ store it in a Lisp variable. Example: (progn (setq mark-active t) (run-hooks 'activate-mark-hook) - (when select-active-regions - (x-set-selection 'PRIMARY (current-buffer))) + (and select-active-regions + ;; Only set the selection if we already own PRIMARY. The + ;; initial selection grab happens in `activate-mark', but + ;; it is necessary to update it here. + (x-selection-owner-p 'PRIMARY) + (x-set-selection 'PRIMARY (current-buffer))) (set-marker (mark-marker) pos (current-buffer))) ;; Normally we never clear mark-active except in Transient Mark mode. ;; But when we actually clear out the mark value too, we must |