From: Mark Wooding Date: Sat, 25 Apr 2020 22:07:05 +0000 (+0100) Subject: el/dot-emacs.el: Fix page motion properly. X-Git-Url: https://git.distorted.org.uk/~mdw/profile/commitdiff_plain/3260d9c4edcb845b7b441d42c294942957bee5ce 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. --- 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)