Function: scroll-bar-drag
scroll-bar-drag is an interactive and byte-compiled function defined
in scroll-bar.el.gz.
Signature
(scroll-bar-drag EVENT)
Documentation
Scroll the window by dragging the scroll bar slider.
If you click outside the slider, the window scrolls to bring the slider there.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/scroll-bar.el.gz
(defun scroll-bar-drag (event)
"Scroll the window by dragging the scroll bar slider.
If you click outside the slider, the window scrolls to bring the slider there."
(interactive "e")
(let* (done
(echo-keystrokes 0)
(end-position (event-end event))
(window (nth 0 end-position))
(before-scroll))
(with-current-buffer (window-buffer window)
(setq before-scroll point-before-scroll))
(save-selected-window
(select-window window 'mark-for-redisplay)
(setq before-scroll
(or before-scroll (point))))
(scroll-bar-drag-1 event)
(track-mouse
(while (not done)
(setq event (read-event))
(if (eq (car-safe event) 'mouse-movement)
(setq event (read-event)))
(cond ((eq (car-safe event) 'scroll-bar-movement)
(scroll-bar-drag-1 event))
(t
;; Exit when we get the drag event; ignore that event.
(setq done t)))))
(sit-for 0)
(with-current-buffer (window-buffer window)
(setq point-before-scroll before-scroll))))