]> git.earman.xyz Git - emacsinit.git/commitdiff
Fixup scroll and recenter
authorrearman <rearman@r717.net>
Mon, 2 Mar 2026 21:21:40 +0000 (16:21 -0500)
committerrearman <rearman@r717.net>
Mon, 2 Mar 2026 21:21:40 +0000 (16:21 -0500)
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

diff --git a/init.el b/init.el
index f7760e193a77c6759c53350dd606adc5bc0b23cd..f170916da71e9b5513c5b0db17a09914dd733a37 100644 (file)
--- 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
       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)
+
 \f
 ;; Recent Files/Buffers
 (midnight-mode t)