comparison lisp/simple.el @ 103947:37177e1f2fcb

* 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.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 17 Jul 2009 15:45:08 +0000
parents a4d216dbf517
children c59b9da550fc
comparison
equal deleted inserted replaced
103946:774187433685 103947:37177e1f2fcb
3487 This function also runs `deactivate-mark-hook'." 3487 This function also runs `deactivate-mark-hook'."
3488 (when (or transient-mark-mode force) 3488 (when (or transient-mark-mode force)
3489 ;; Copy the latest region into the primary selection, if desired. 3489 ;; Copy the latest region into the primary selection, if desired.
3490 (and select-active-regions 3490 (and select-active-regions
3491 mark-active 3491 mark-active
3492 (x-selection-owner-p 'PRIMARY)
3492 (x-set-selection 'PRIMARY (buffer-substring-no-properties 3493 (x-set-selection 'PRIMARY (buffer-substring-no-properties
3493 (region-beginning) (region-end)))) 3494 (region-beginning) (region-end))))
3494 (if (and (null force) 3495 (if (and (null force)
3495 (or (eq transient-mark-mode 'lambda) 3496 (or (eq transient-mark-mode 'lambda)
3496 (and (eq (car-safe transient-mark-mode) 'only) 3497 (and (eq (car-safe transient-mark-mode) 'only)
3531 3532
3532 (if pos 3533 (if pos
3533 (progn 3534 (progn
3534 (setq mark-active t) 3535 (setq mark-active t)
3535 (run-hooks 'activate-mark-hook) 3536 (run-hooks 'activate-mark-hook)
3536 (when select-active-regions 3537 (and select-active-regions
3537 (x-set-selection 'PRIMARY (current-buffer))) 3538 ;; Only set the selection if we already own PRIMARY. The
3539 ;; initial selection grab happens in `activate-mark', but
3540 ;; it is necessary to update it here.
3541 (x-selection-owner-p 'PRIMARY)
3542 (x-set-selection 'PRIMARY (current-buffer)))
3538 (set-marker (mark-marker) pos (current-buffer))) 3543 (set-marker (mark-marker) pos (current-buffer)))
3539 ;; Normally we never clear mark-active except in Transient Mark mode. 3544 ;; Normally we never clear mark-active except in Transient Mark mode.
3540 ;; But when we actually clear out the mark value too, we must 3545 ;; But when we actually clear out the mark value too, we must
3541 ;; clear mark-active in any mode. 3546 ;; clear mark-active in any mode.
3542 (deactivate-mark t) 3547 (deactivate-mark t)