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)