diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2008-04-08 05:38:39 +0000 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2008-04-08 05:38:39 +0000 |
commit | 05786f2d93c238651290639638b1007eab20a7ac (patch) | |
tree | 9e7a118842daf87e578a2bf44544eb829c944e37 /lisp/mwheel.el | |
parent | 18cba22a626f9a5f5936fe501f258efd72033b20 (diff) | |
download | emacs-05786f2d93c238651290639638b1007eab20a7ac.tar.gz |
(mwheel-scroll): Deactivate any temporarily active region if point
moves.
Diffstat (limited to 'lisp/mwheel.el')
-rw-r--r-- | lisp/mwheel.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/mwheel.el b/lisp/mwheel.el index 908dc3a6fff..8236d08dbc9 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -190,6 +190,10 @@ This should only be bound to mouse buttons 4 and 5." (prog1 (selected-window) (select-window (mwheel-event-window event))))) + (buffer (window-buffer curwin)) + (opoint (with-current-buffer buffer + (when (eq (car-safe transient-mark-mode) 'only) + (point)))) (mods (delq 'click (delq 'double (delq 'triple (event-modifiers event))))) (amt (assoc mods mouse-wheel-scroll-amount))) @@ -224,7 +228,13 @@ This should only be bound to mouse buttons 4 and 5." ;; Make sure we do indeed scroll to the end of the buffer. (end-of-buffer (while t (scroll-up))))) (t (error "Bad binding in mwheel-scroll")))) - (if curwin (select-window curwin)))) + (if curwin (select-window curwin))) + ;; If there is a temporarily active region, deactivate it iff + ;; scrolling moves point. + (when opoint + (with-current-buffer buffer + (when (/= opoint (point)) + (deactivate-mark))))) (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time) (if mwheel-inhibit-click-event-timer (cancel-timer mwheel-inhibit-click-event-timer) |