From 1427e3102cf8a3b48be83ab7ba77871f388ac334 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 20 Aug 2021 17:27:12 -0500 Subject: Change page-handling logic See the following urls: http://endlessparentheses.com/improving-page-navigation.html https://ericjmritz.wordpress.com/2015/08/29/using-page-breaks-in-gnu-emacs/ --- init.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/init.el b/init.el index ddf2708..89c3ecd 100644 --- a/init.el +++ b/init.el @@ -603,11 +603,21 @@ like a dumbass." (fset 'yes-or-no-p #'y-or-n-p)) (setup page - (defun recenter-to-top (&rest _args) + + (:option page-delimiter + (rx bol (or "\f" ";;;") + (not (any "#")) (* not-newline) "\n" + (* (* blank) (opt ";" (* not-newline)) "\n"))) + + (defun recenter-to-top (&rest _) "Recenter the cursor to the top of the window." - (recenter 0)) + (when (called-interactively-p 'any) + (recenter 5))) (:advise forward-page :after #'recenter-to-top - backward-page :after #'recenter-to-top)) + backward-page :after #'recenter-to-top) + + (:global "C-x C-n" forward-page + "C-x C-p" backward-page)) (setup prog (:option smie-indent-basic tab-width) -- cgit 1.4.1-21-gabe81