diff options
author | Marco Wahl <marcowahlsoft@gmail.com> | 2019-07-04 22:32:44 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2019-07-14 09:23:20 +0300 |
commit | 352530ee0a52153a7936864275dce7f89e070a15 (patch) | |
tree | ad132f6c5f219c2fbddeae0b148efc9f487822ca /lisp/scroll-lock.el | |
parent | 474bd9d4a0f57c55d8c7ab435885804062992d0f (diff) | |
download | emacs-352530ee0a52153a7936864275dce7f89e070a15.tar.gz emacs-352530ee0a52153a7936864275dce7f89e070a15.tar.bz2 emacs-352530ee0a52153a7936864275dce7f89e070a15.zip |
New function for scroll-lock-mode to almost always scroll
* lisp/scroll-lock.el (scroll-lock-next-line-always-scroll): New
function. Opposed to scroll-lock-next-line it does not switch to
forward-line at eob. S-down is the default key binding for this
function. (Bug#36494)
* test/lisp/scroll-lock-tests.el: A few tests for
scroll-lock-next-line-always-scroll.
* etc/NEWS: Announce the new command.
Diffstat (limited to 'lisp/scroll-lock.el')
-rw-r--r-- | lisp/scroll-lock.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el index 8281edb1720..3a74c11b7a1 100644 --- a/lisp/scroll-lock.el +++ b/lisp/scroll-lock.el @@ -36,6 +36,7 @@ (define-key map [remap previous-line] 'scroll-lock-previous-line) (define-key map [remap forward-paragraph] 'scroll-lock-forward-paragraph) (define-key map [remap backward-paragraph] 'scroll-lock-backward-paragraph) + (define-key map [S-down] 'scroll-lock-next-line-always-scroll) map) "Keymap for Scroll Lock mode.") @@ -81,6 +82,16 @@ boundaries during scrolling." (move-to-column column) (forward-char (min column (- (line-end-position) (point)))))) +(defun scroll-lock-next-line-always-scroll (&optional arg) + "Scroll up ARG lines keeping point fixed." + (interactive "p") + (or arg (setq arg 1)) + (scroll-lock-update-goal-column) + (condition-case nil + (scroll-up arg) + (end-of-buffer (goto-char (point-max)) (recenter 1))) + (scroll-lock-move-to-column scroll-lock-temporary-goal-column)) + (defun scroll-lock-next-line (&optional arg) "Scroll up ARG lines keeping point fixed." (interactive "p") |