summaryrefslogtreecommitdiff
path: root/lisp/mwheel.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-03-24 19:05:39 +0800
committerChong Yidong <cyd@gnu.org>2012-03-24 19:05:39 +0800
commitf06e2758ba96694f76389a65f7395dbae557ba73 (patch)
tree65f2397c5e2a0cf170b7704f1a6541de53429421 /lisp/mwheel.el
parent8ed795237554b555fcfa3f4d0d6710f88469a491 (diff)
downloademacs-f06e2758ba96694f76389a65f7395dbae557ba73.tar.gz
* mwheel.el (mwheel-scroll): Call deactivate-mark at the right point.
Fixes: debbugs:9623
Diffstat (limited to 'lisp/mwheel.el')
-rw-r--r--lisp/mwheel.el9
1 files changed, 7 insertions, 2 deletions
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 7b507664712..1c2028ed02e 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -232,12 +232,17 @@ This should only be bound to mouse buttons 4 and 5."
(end-of-buffer (while t (funcall mwheel-scroll-up-function)))))
(t (error "Bad binding in mwheel-scroll"))))
(if curwin (select-window curwin)))
- ;; If there is a temporarily active region, deactivate it iff
+ ;; If there is a temporarily active region, deactivate it if
;; scrolling moves point.
(when opoint
(with-current-buffer buffer
(when (/= opoint (point))
- (deactivate-mark)))))
+ ;; Call `deactivate-mark' at the original position, so that
+ ;; the original region is saved to the X selection.
+ (let ((newpoint (point)))
+ (goto-char opoint)
+ (deactivate-mark)
+ (goto-char newpoint))))))
(when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time)
(if mwheel-inhibit-click-event-timer
(cancel-timer mwheel-inhibit-click-event-timer)