diff options
author | Case Duckworth | 2021-08-20 17:27:12 -0500 |
---|---|---|
committer | Case Duckworth | 2021-08-20 17:27:12 -0500 |
commit | 1427e3102cf8a3b48be83ab7ba77871f388ac334 (patch) | |
tree | c34b51183c2bc46dcb3559842b67d9d96dd4567d | |
parent | Fix typos (diff) | |
download | emacs-1427e3102cf8a3b48be83ab7ba77871f388ac334.tar.gz emacs-1427e3102cf8a3b48be83ab7ba77871f388ac334.zip |
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/
-rw-r--r-- | init.el | 16 |
1 files 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." | |||
603 | (fset 'yes-or-no-p #'y-or-n-p)) | 603 | (fset 'yes-or-no-p #'y-or-n-p)) |
604 | 604 | ||
605 | (setup page | 605 | (setup page |
606 | (defun recenter-to-top (&rest _args) | 606 | |
607 | (:option page-delimiter | ||
608 | (rx bol (or "\f" ";;;") | ||
609 | (not (any "#")) (* not-newline) "\n" | ||
610 | (* (* blank) (opt ";" (* not-newline)) "\n"))) | ||
611 | |||
612 | (defun recenter-to-top (&rest _) | ||
607 | "Recenter the cursor to the top of the window." | 613 | "Recenter the cursor to the top of the window." |
608 | (recenter 0)) | 614 | (when (called-interactively-p 'any) |
615 | (recenter 5))) | ||
609 | (:advise forward-page :after #'recenter-to-top | 616 | (:advise forward-page :after #'recenter-to-top |
610 | backward-page :after #'recenter-to-top)) | 617 | backward-page :after #'recenter-to-top) |
618 | |||
619 | (:global "C-x C-n" forward-page | ||
620 | "C-x C-p" backward-page)) | ||
611 | 621 | ||
612 | (setup prog | 622 | (setup prog |
613 | (:option smie-indent-basic tab-width) | 623 | (:option smie-indent-basic tab-width) |