authors.el: Add some renamed/moved files
[bpt/emacs.git] / lisp / mwheel.el
index 7b50766..3824891 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mwheel.el --- Wheel mouse support
 
-;; Copyright (C) 1998, 2000-201 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2014 Free Software Foundation, Inc.
 ;; Maintainer: William M. Perry <wmperry@gnu.org>
 ;; Keywords: mouse
 ;; Package: emacs
@@ -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)