all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Convert scroll-bar-scroll-down to scroll-bar-scroll-bottom?
@ 2005-01-04 20:15 Bruce Korb
  0 siblings, 0 replies; only message in thread
From: Bruce Korb @ 2005-01-04 20:15 UTC (permalink / raw)



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)))))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-01-04 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-04 20:15 Convert scroll-bar-scroll-down to scroll-bar-scroll-bottom? Bruce Korb

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.