Function: pixel-scroll-precision-scroll-up-page
pixel-scroll-precision-scroll-up-page is a byte-compiled function
defined in pixel-scroll.el.gz.
Signature
(pixel-scroll-precision-scroll-up-page DELTA)
Documentation
Scroll the current window up by DELTA pixels.
Note that this function doesn't work if DELTA is larger than the height of the current window.
Source Code
;; Defined in /usr/src/emacs/lisp/pixel-scroll.el.gz
(defun pixel-scroll-precision-scroll-up-page (delta)
"Scroll the current window up by DELTA pixels.
Note that this function doesn't work if DELTA is larger than
the height of the current window."
(let* ((edges (window-edges nil t nil t))
(max-y (- (nth 3 edges)
(nth 1 edges)))
(usable-height max-y)
(posn (posn-at-x-y 0 (+ (window-tab-line-height)
(window-header-line-height)
(- max-y delta))))
(point (posn-point posn))
(up-point (and point
(save-excursion
(goto-char point)
(vertical-motion (- (1+ scroll-margin)))
(point)))))
(when (and point (> (point) up-point))
(when (let ((pos-visible (pos-visible-in-window-p up-point nil t)))
(or (eq (length pos-visible) 2)
(when-let* ((posn (posn-at-point up-point))
(edges (window-edges nil t))
(usable-height (- (nth 3 edges)
(nth 1 edges))))
(> (cdr (posn-object-width-height posn))
usable-height))))
(goto-char up-point)))
(let ((current-vscroll (window-vscroll nil t)))
(setq delta (- delta current-vscroll))
(set-window-vscroll nil 0 t t)
(when (> delta 0)
(let* ((start (window-start))
(dims (window-text-pixel-size nil (cons start (- delta))
start nil nil nil t))
(height (nth 1 dims))
(position (nth 2 dims)))
(set-window-start nil position t)
;; If the line above is taller than the window height (i.e. there's
;; a very tall image), keep point on it.
(when (> height usable-height)
(goto-char position))
(when (or (not position) (eq position start))
(signal 'beginning-of-buffer nil))
(setq delta (- delta height))))
(when (< delta 0)
(set-window-vscroll nil (- delta) t t)))))