From 3260d9c4edcb845b7b441d42c294942957bee5ce Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 25 Apr 2020 23:07:05 +0100 Subject: [PATCH] el/dot-emacs.el: Fix page motion properly. Emacs's built-in page motion machinery wants pages to start /after/ the delimiter, but since I'm looking for page-heading banners, I want the page to start /before/ the banner. So add some advice so that Emacs does the right thing. --- el/dot-emacs.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 8ac22bb..0ff628b 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -169,6 +169,17 @@ library." (set-frame-parameter frame 'menu-bar-lines 0) (set-frame-parameter frame 'menu-bar-lines old))) +;; Page motion. + +(defun mdw-fixup-page-position () + (unless (eq (char-before (point)) ? ) + (forward-line 0))) + +(defadvice backward-page (after mdw-fixup compile activate) + (mdw-fixup-page-position)) +(defadvice forward-page (after mdw-fixup compile activate) + (mdw-fixup-page-position)) + ;; Splitting windows. (unless (fboundp 'scroll-bar-columns) -- 2.11.0