From: yamaoka Date: Fri, 24 Sep 1999 12:39:55 +0000 (+0000) Subject: (gnus-article-prev-page): Rewrite to realize smooth scrolling under XEmacs. X-Git-Tag: t-gnus-6_13_1-07~2 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=03d98904f82e51c59adf31d4afcebf910160ffef;p=elisp%2Fgnus.git- (gnus-article-prev-page): Rewrite to realize smooth scrolling under XEmacs. (gnus-article-next-page):Ditto. --- diff --git a/lisp/gnus-art.el b/lisp/gnus-art.el index a4c6fb5..ee3b041 100644 --- a/lisp/gnus-art.el +++ b/lisp/gnus-art.el @@ -3701,48 +3701,53 @@ If given a numerical ARG, move forward ARG pages." If end of article, return non-nil. Otherwise return nil. Argument LINES specifies lines to be scrolled up." (interactive "p") - (move-to-window-line -1) - (if (save-excursion - (end-of-line) - (and (pos-visible-in-window-p) ;Not continuation line. - (eobp))) - ;; Nothing in this page. - (if (or (not gnus-page-broken) - (save-excursion - (save-restriction - (widen) (forward-line 1) (eobp)))) ;Real end-of-buffer? - t ;Nothing more. - (gnus-narrow-to-page 1) ;Go to next page. - nil) - ;; More in this page. - (let ((scroll-in-place nil)) - (condition-case () - (scroll-up lines) - (end-of-buffer - ;; Long lines may cause an end-of-buffer error. - (goto-char (point-max))))) - (move-to-window-line 0) - nil)) + (let ((start (window-start)) + end-of-buffer end-of-page) + (save-excursion + (move-to-window-line -1) + (if (<= (point) start) + (progn + (forward-line 2) + (setq start (point))) + (forward-line 1) + (setq start nil)) + (unless (or (cond ((eq (1+ (buffer-size)) (point)) + (setq end-of-buffer t)) + ((eobp) + (setq end-of-page t))) + (not lines)) + (move-to-window-line lines) + (unless (search-backward "\n\n" nil t) + (setq start (point))))) + (cond (end-of-buffer t) + (end-of-page + (gnus-narrow-to-page 1) + nil) + (t + (if start + (set-window-start (selected-window) start) + (scroll-up lines)) + nil)))) (defun gnus-article-prev-page (&optional lines) "Show previous page of current article. Argument LINES specifies lines to be scrolled down." (interactive "p") - (move-to-window-line 0) - (if (and gnus-page-broken - (bobp) - (not (save-restriction (widen) (bobp)))) ;Real beginning-of-buffer? - (progn - (gnus-narrow-to-page -1) ;Go to previous page. - (goto-char (point-max)) - (recenter -1)) - (let ((scroll-in-place nil)) - (prog1 - (condition-case () - (scroll-down lines) - (beginning-of-buffer - (goto-char (point-min)))) - (move-to-window-line 0))))) + (let (beginning-of-buffer beginning-of-page) + (save-excursion + (move-to-window-line 0) + (cond ((eq 1 (point)) + (setq beginning-of-buffer t)) + ((bobp) + (setq beginning-of-page t)))) + (cond (beginning-of-buffer) + (beginning-of-page + (gnus-narrow-to-page -1)) + (t + (condition-case nil + (scroll-down lines) + (beginning-of-buffer + (goto-char (point-min)))))))) (defun gnus-article-refer-article () "Read article specified by message-id around point."