Function: view-scroll-lines

view-scroll-lines is a byte-compiled function defined in view.el.gz.

Signature

(view-scroll-lines LINES BACKWARD DEFAULT MAXDEFAULT)

Source Code

;; Defined in /usr/src/emacs/lisp/view.el.gz
(defun view-scroll-lines (lines backward default maxdefault)
  ;; This function does the job for all the scrolling commands.
  ;; Scroll forward LINES lines.  If BACKWARD is non-nil, scroll backwards.
  ;; If LINES is negative scroll in the other direction.
  ;; If LINES is 0 or nil, scroll DEFAULT lines (if DEFAULT is nil, scroll
  ;; by one page).  If MAXDEFAULT is non-nil, scroll no more than a window.
  (if (or (null lines) (zerop (setq lines (prefix-numeric-value lines))))
      (setq lines default))
  (when (and lines (< lines 0))
    (setq backward (not backward) lines (- lines)))
  (when (and maxdefault lines (> lines (view-window-size)))
    (setq lines nil))
  (cond (backward (scroll-down-command lines))
	((view-really-at-end)
	 (if view-scroll-auto-exit
	     (View-quit)
	   (ding)
	   (view-end-message)))
	(t (scroll-up-command lines)
	   (if (view-really-at-end) (view-end-message)))))