summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2013-04-15 00:14:28 +0200
committerGravatar Tom Willemse2013-04-15 00:14:28 +0200
commita271d7d0fe71db92c7691411e7a0ab226966bb45 (patch)
tree9b8b30980b659001f90f93f37b67c2ec1b16c637
parent0e6eddf66641c85b71552dc12a5faeef40e2a43d (diff)
downloaddotfiles-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.
-rw-r--r--emacs/init.el22
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)