]> git.eshelyaron.com Git - emacs.git/commitdiff
* mwheel.el (mwheel-scroll): Call deactivate-mark at the right point.
authorChong Yidong <cyd@gnu.org>
Sat, 24 Mar 2012 11:05:39 +0000 (19:05 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 24 Mar 2012 11:05:39 +0000 (19:05 +0800)
Fixes: debbugs:9623
lisp/ChangeLog
lisp/mwheel.el

index 59abf190e14b52fe0e3a69142d60493c09d0c8ee..36dd6fc8a3fd12bc237b7d3682e0c1a3f51474e2 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-24  Chong Yidong  <cyd@gnu.org>
+
+       * mwheel.el (mwheel-scroll): Call deactivate-mark at the right
+       point (Bug#9623).
+
 2012-03-23  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * newcomment.el (comment-choose-indent): No space after BOL.
index 7b507664712d878b7e3d741e3883d3f4a3e564f3..1c2028ed02e80559366e32a3ebb792ac414bb2df 100644 (file)
@@ -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)