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/mouse.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/mouse.el')
-rw-r--r-- | lisp/mouse.el | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 03f73ba8d9c..7b7f6927deb 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -927,6 +927,11 @@ will be deleted after return. DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by mouse-drag-region." (mouse-minibuffer-check start-event) (setq mouse-selection-click-count-buffer (current-buffer)) + ;; We must call deactivate-mark before repositioning point. + ;; Otherwise, for select-active-regions non-nil, we get the wrong + ;; selection if the user drags a region, clicks elsewhere to + ;; reposition point, then middle-clicks to paste the selection. + (deactivate-mark) (let* ((original-window (selected-window)) ;; We've recorded what we needed from the current buffer and ;; window, now let's jump to the place of the event, where things @@ -971,7 +976,6 @@ should only be used by mouse-drag-region." (mouse-move-drag-overlay mouse-drag-overlay start-point start-point click-count) (overlay-put mouse-drag-overlay 'window start-window) - (deactivate-mark) (let (event end end-point last-end-point) (track-mouse (while (progn @@ -1360,10 +1364,16 @@ Also move point to one end of the text thus inserted (normally the end), and set mark at the beginning. Prefix arguments are interpreted as with \\[yank]. If `mouse-yank-at-point' is non-nil, insert at point -regardless of where you click." +regardless of where you click. +If `select-active-regions' is non-nil, the mark is deactivated +before inserting the text." (interactive "e\nP") ;; Give temporary modes such as isearch a chance to turn off. (run-hooks 'mouse-leave-buffer-hook) + (when select-active-regions + ;; Without this, confusing things happen upon e.g. inserting into + ;; the middle of an active region. + (deactivate-mark t)) (or mouse-yank-at-point (mouse-set-point click)) (setq this-command 'yank) (setq mouse-selection-click-count 0) |