diff options
author | Tom Willemse | 2013-04-15 00:14:28 +0200 |
---|---|---|
committer | Tom Willemse | 2013-04-15 00:14:28 +0200 |
commit | a271d7d0fe71db92c7691411e7a0ab226966bb45 (patch) | |
tree | 9b8b30980b659001f90f93f37b67c2ec1b16c637 /emacs/init.el | |
parent | 0e6eddf66641c85b71552dc12a5faeef40e2a43d (diff) | |
download | dotfiles-a271d7d0fe71db92c7691411e7a0ab226966bb45.tar.gz dotfiles-a271d7d0fe71db92c7691411e7a0ab226966bb45.zip |
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.
Diffstat (limited to 'emacs/init.el')
-rw-r--r-- | emacs/init.el | 22 |
1 files 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 "<prior>") 'oni:scroll-down-or-prev-page) |