Function: scroll-bar-horizontal-drag

scroll-bar-horizontal-drag is an interactive and byte-compiled function defined in scroll-bar.el.gz.

Signature

(scroll-bar-horizontal-drag EVENT)

Documentation

Scroll the window horizontally 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-horizontal-drag (event)
  "Scroll the window horizontally 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-horizontal-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-horizontal-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))))