From: Chong Yidong Date: Sat, 24 Mar 2012 11:05:39 +0000 (+0800) Subject: * mwheel.el (mwheel-scroll): Call deactivate-mark at the right point. X-Git-Tag: emacs-pretest-24.0.05~64 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f06e2758ba96694f76389a65f7395dbae557ba73;p=emacs.git * mwheel.el (mwheel-scroll): Call deactivate-mark at the right point. Fixes: debbugs:9623 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 59abf190e14..36dd6fc8a3f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-03-24 Chong Yidong + + * mwheel.el (mwheel-scroll): Call deactivate-mark at the right + point (Bug#9623). + 2012-03-23 Stefan Monnier * newcomment.el (comment-choose-indent): No space after BOL. 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)