Function: scroll-bar-scale
scroll-bar-scale is a byte-compiled function defined in
scroll-bar.el.gz.
Signature
(scroll-bar-scale NUM-DENOM WHOLE)
Documentation
Given a pair (NUM . DENOM) and WHOLE, return (/ (* NUM WHOLE) DENOM).
This is handy for scaling a position on a scroll bar into real units,
like buffer positions. If SCROLL-BAR-POS is the (PORTION . WHOLE) pair
from a scroll bar event, then (scroll-bar-scale SCROLL-BAR-POS
(buffer-size)) is the position in the current buffer corresponding to
that scroll bar position.
Source Code
;; Defined in /usr/src/emacs/lisp/scroll-bar.el.gz
(defun scroll-bar-scale (num-denom whole)
"Given a pair (NUM . DENOM) and WHOLE, return (/ (* NUM WHOLE) DENOM).
This is handy for scaling a position on a scroll bar into real units,
like buffer positions. If SCROLL-BAR-POS is the (PORTION . WHOLE) pair
from a scroll bar event, then (scroll-bar-scale SCROLL-BAR-POS
\(buffer-size)) is the position in the current buffer corresponding to
that scroll bar position."
;; We multiply before we divide to maintain precision.
(truncate (* (car num-denom) whole) (cdr num-denom)))