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.
This commit is contained in:
Tom Willemse 2013-04-15 00:14:28 +02:00
parent 0e6eddf666
commit a271d7d0fe

View file

@ -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 "<prior>") 'oni:scroll-down-or-prev-page)