aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2008-04-08 05:38:39 +0000
committerChong Yidong2008-04-08 05:38:39 +0000
commit05786f2d93c238651290639638b1007eab20a7ac (patch)
tree9e7a118842daf87e578a2bf44544eb829c944e37
parent18cba22a626f9a5f5936fe501f258efd72033b20 (diff)
downloademacs-05786f2d93c238651290639638b1007eab20a7ac.tar.gz
emacs-05786f2d93c238651290639638b1007eab20a7ac.zip
(mwheel-scroll): Deactivate any temporarily active region if point
moves.
-rw-r--r--lisp/mwheel.el12
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."
190 (prog1 190 (prog1
191 (selected-window) 191 (selected-window)
192 (select-window (mwheel-event-window event))))) 192 (select-window (mwheel-event-window event)))))
193 (buffer (window-buffer curwin))
194 (opoint (with-current-buffer buffer
195 (when (eq (car-safe transient-mark-mode) 'only)
196 (point))))
193 (mods 197 (mods
194 (delq 'click (delq 'double (delq 'triple (event-modifiers event))))) 198 (delq 'click (delq 'double (delq 'triple (event-modifiers event)))))
195 (amt (assoc mods mouse-wheel-scroll-amount))) 199 (amt (assoc mods mouse-wheel-scroll-amount)))
@@ -224,7 +228,13 @@ This should only be bound to mouse buttons 4 and 5."
224 ;; Make sure we do indeed scroll to the end of the buffer. 228 ;; Make sure we do indeed scroll to the end of the buffer.
225 (end-of-buffer (while t (scroll-up))))) 229 (end-of-buffer (while t (scroll-up)))))
226 (t (error "Bad binding in mwheel-scroll")))) 230 (t (error "Bad binding in mwheel-scroll"))))
227 (if curwin (select-window curwin)))) 231 (if curwin (select-window curwin)))
232 ;; If there is a temporarily active region, deactivate it iff
233 ;; scrolling moves point.
234 (when opoint
235 (with-current-buffer buffer
236 (when (/= opoint (point))
237 (deactivate-mark)))))
228 (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time) 238 (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time)
229 (if mwheel-inhibit-click-event-timer 239 (if mwheel-inhibit-click-event-timer
230 (cancel-timer mwheel-inhibit-click-event-timer) 240 (cancel-timer mwheel-inhibit-click-event-timer)