(gnus-article-next-page-1): Reduce the number of lines to scroll rather than
authorKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 29 Jul 2005 06:04:26 +0000 (06:04 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Fri, 29 Jul 2005 06:04:26 +0000 (06:04 +0000)
 to stop it.

lisp/ChangeLog
lisp/gnus-art.el

index be03eb9..2a0b647 100644 (file)
@@ -1,5 +1,8 @@
 2005-07-29  Katsumi Yamaoka  <yamaoka@jpl.org>
 
+       * gnus-art.el (gnus-article-next-page-1): Reduce the number of
+       lines to scroll rather than to stop it.
+
        * mml.el (mml-generate-default-type): Add doc string.
        (mml-generate-mime-1): Use mm-default-file-encoding or make it
        default to application/octet-stream when determining the content
index 63e2fc1..7fabfb8 100644 (file)
@@ -5199,17 +5199,23 @@ specifies."
                     (if header-line-format 1 0)))))))
 
 (defun gnus-article-next-page-1 (lines)
-  (unless (and (not (featurep 'xemacs))
-              (> (symbol-value 'scroll-margin) 0)
-              (<= (count-lines (window-start) (point-max))
-                  (symbol-value 'scroll-margin)))
-    (condition-case ()
-       (let ((scroll-in-place nil))
-         (scroll-up lines))
-      (end-of-buffer
-       ;; Long lines may cause an end-of-buffer error.
-       (goto-char (point-max))))
-    (gnus-article-beginning-of-window)))
+  (when (and (not (featurep 'xemacs))
+            (numberp lines)
+            (> lines 0)
+            (numberp (symbol-value 'scroll-margin))
+            (> (symbol-value 'scroll-margin) 0))
+    ;; Protect against the bug that Emacs 21.x hangs up when scrolling up for
+    ;; too many number of lines if `scroll-margin' is set as two or greater.
+    (setq lines (min lines
+                    (max 0 (- (count-lines (window-start) (point-max))
+                              (symbol-value 'scroll-margin))))))
+  (condition-case ()
+      (let ((scroll-in-place nil))
+       (scroll-up lines))
+    (end-of-buffer
+     ;; Long lines may cause an end-of-buffer error.
+     (goto-char (point-max))))
+  (gnus-article-beginning-of-window))
 
 (defun gnus-article-prev-page (&optional lines)
   "Show previous page of current article.