Function: scroll-up-command

scroll-up-command is an interactive and byte-compiled function defined in window.el.gz.

Signature

(scroll-up-command &optional ARG)

Documentation

Scroll text of selected window upward ARG lines; or near full screen if no ARG.

Interactively, giving this command a numerical prefix will scroll up by that many lines (and down by that many lines if the number is negative). Without a prefix, scroll up by a full screen. If given a C-u - prefix, scroll a full page down instead.

If scroll-error-top-bottom is non-nil and scroll-up cannot scroll window further, move cursor to the bottom line. When point is already on that position, then signal an error. A near full screen is next-screen-context-lines less than a full screen. Negative ARG means scroll downward.

If ARG is the atom -, scroll downward by nearly full screen.

The command C-x C-n (set-goal-column) can be used to create a semipermanent goal column for this command.

View in manual

Probably introduced at or before Emacs version 24.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun scroll-up-command (&optional arg)
  "Scroll text of selected window upward ARG lines; or near full screen if no ARG.
Interactively, giving this command a numerical prefix will scroll
up by that many lines (and down by that many lines if the number
is negative).  Without a prefix, scroll up by a full screen.
If given a `C-u -' prefix, scroll a full page down instead.

If `scroll-error-top-bottom' is non-nil and `scroll-up' cannot
scroll window further, move cursor to the bottom line.
When point is already on that position, then signal an error.
A near full screen is `next-screen-context-lines' less than a full screen.
Negative ARG means scroll downward.

If ARG is the atom `-', scroll downward by nearly full screen.

The command \\[set-goal-column] can be used to create a
semipermanent goal column for this command."
  (interactive "^P")
  (prog1
      (cond
       ((null scroll-error-top-bottom)
        (scroll-up arg))
       ((eq arg '-)
        (scroll-down-command nil))
       ((< (prefix-numeric-value arg) 0)
        (scroll-down-command (- (prefix-numeric-value arg))))
       ((eobp)
        (scroll-up arg))                ; signal error
       (t
        (condition-case nil
	    (scroll-up arg)
          (end-of-buffer
           (if arg
	       ;; When scrolling by ARG lines can't be done,
	       ;; move by ARG lines instead.
	       (forward-line arg)
	     ;; When ARG is nil for full-screen scrolling,
	     ;; move to the bottom of the buffer.
	     (goto-char (point-max)))))))
    (scroll-command--goto-goal-column)))