From 6cfcb515aa19c8915a0929b98e021cb611d8544e Mon Sep 17 00:00:00 2001 From: rearman Date: Mon, 2 Mar 2026 16:21:40 -0500 Subject: [PATCH] Fixup scroll and recenter next/prev page now automatically puts the line at the top of the page. Recenter now goes top/middle/bottom instead of middle/top/bottom. Top and Bottom also now have two lines of context preserved. --- init.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/init.el b/init.el index f7760e1..f170916 100644 --- a/init.el +++ b/init.el @@ -64,7 +64,6 @@ (setq delete-by-moving-to-trash t delete-pair-blink-delay 0 next-line-add-newlines t - scroll-conservatively 101 ring-bell-function 'ignore use-short-answers t use-file-dialog nil @@ -74,7 +73,16 @@ history-delete-duplicates t disabled-command-function nil save-interprogram-paste-before-kill t - confirm-kill-processes nil) + confirm-kill-processes nil + recenter-positions '(2 middle -3)) + +(defun re/recenter-advice (&rest _) + "Recenter to page start." + (when (called-interactively-p 'any) (recenter 2))) + +(advice-add #'backward-page :after #'re/recenter-advice) +(advice-add #'forward-page :after #'re/recenter-advice) + ;; Recent Files/Buffers (midnight-mode t) -- 2.39.5