Function: scroll-lock-mode
scroll-lock-mode is an autoloaded, interactive and byte-compiled
function defined in scroll-lock.el.gz.
Signature
(scroll-lock-mode &optional ARG)
Documentation
Buffer-local minor mode for pager-like scrolling.
This is a minor mode. If called interactively, toggle the
Scroll-Lock mode mode. If the prefix argument is positive, enable
the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the
mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate scroll-lock-mode(var)/scroll-lock-mode(fun).
The mode's hook is called both when the mode is enabled and when it is disabled.
When enabled, keys that normally move point by line or paragraph will scroll the buffer by the respective amount of lines instead and point will be kept vertically fixed relative to window boundaries during scrolling.
Note that the default key binding to Scroll_Lock will not work on
MS-Windows systems if w32-scroll-lock-modifier is non-nil.
Probably introduced at or before Emacs version 27.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/scroll-lock.el.gz
;;;###autoload
(define-minor-mode scroll-lock-mode
"Buffer-local minor mode for pager-like scrolling.
When enabled, keys that normally move point by line or paragraph
will scroll the buffer by the respective amount of lines instead
and point will be kept vertically fixed relative to window
boundaries during scrolling.
Note that the default key binding to Scroll_Lock will not work on
MS-Windows systems if `w32-scroll-lock-modifier' is non-nil."
:lighter " ScrLck"
:keymap scroll-lock-mode-map
(if scroll-lock-mode
(progn
(setq scroll-lock-preserve-screen-pos-save
scroll-preserve-screen-position)
(setq-local scroll-preserve-screen-position 'always))
(setq scroll-preserve-screen-position
scroll-lock-preserve-screen-pos-save)))