help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Convert scroll-bar-scroll-down to scroll-bar-scroll-bottom?


From: Bruce Korb
Subject: Convert scroll-bar-scroll-down to scroll-bar-scroll-bottom?
Date: Tue, 04 Jan 2005 12:15:25 -0800

Hi,

I've stared at this a while and still see barely more than hieroglyphics.
Somehow, I need to fix the expression passed to the "scroll-down" function
so that it scrolls down by the number of lines the cursor is *above* the
bottom of the window.  Now that I know what I want to do, actually doing
it eludes me....

Thanks in advance ...
 - Bruce

(defun scroll-bar-scroll-bottom (event)
  "Scroll the line next to the scroll bar click to the bottom of the window.
EVENT should be a scroll bar click."
  (interactive "e")
  (let* ((end-position (event-end event))
         (window (nth 0 end-position))
         (before-scroll))
    (with-current-buffer (window-buffer window)
      (setq before-scroll point-before-scroll))
    (unwind-protect
        (save-selected-window
          (let ((portion-whole (nth 2 end-position)))
            (select-window window)
            (setq before-scroll
                  (or before-scroll (point)))
            (scroll-down
             (scroll-bar-scale portion-whole (1- (window-height)))))
          (sit-for 0))
      (with-current-buffer (window-buffer window)
        (setq point-before-scroll before-scroll)))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]