From a271d7d0fe71db92c7691411e7a0ab226966bb45 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Mon, 15 Apr 2013 00:14:28 +0200 Subject: Improve the custom scoll functions This way they won't go to the next page if they can scroll enough, only when the en of a page has been reached will they go to the next one. --- emacs/init.el | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index ac7b269..a39751d 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -593,22 +593,28 @@ Also change directories to current working directory." "Either scroll down or go to the previous page. Depending on the value of `buffer-narrowed-p'." - (interactive "P") + (interactive "^P") (if (buffer-narrowed-p) - (progn - (narrow-to-page (or arg -1)) - (goto-char (point-min))) + (let ((scroll-error-top-bottom nil)) + (condition-case nil + (scroll-down-command arg) + (beginning-of-buffer + (narrow-to-page -1) + (goto-char (point-min))))) (scroll-down-command arg))) (defun oni:scroll-up-or-next-page (arg) "Either scroll up or go to the next page. Depending on the value of `buffer-narrowed-p'." - (interactive "P") + (interactive "^P") (if (buffer-narrowed-p) - (progn - (narrow-to-page (or arg 1)) - (goto-char (point-min))) + (let ((scroll-error-top-bottom nil)) + (condition-case nil + (scroll-up-command arg) + (end-of-buffer + (narrow-to-page 1) + (goto-char (point-min))))) (scroll-up-command arg))) (global-set-key (kbd "") 'oni:scroll-down-or-prev-page) -- cgit v1.2.3-54-g00ecf