2003-02-12 Michael Shields <shields@msrl.com>
authorKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 12 Feb 2003 15:06:16 +0000 (15:06 +0000)
committerKai Grossjohann <kgrossjo@eu.uu.net>
Wed, 12 Feb 2003 15:06:16 +0000 (15:06 +0000)
* gnus-art.el (gnus-article-only-boring-p): New.
(gnus-article-skip-boring): New.
* gnus-cite.el (gnus-article-boring-faces): New.
* gnus-sum.el (gnus-summary-next-page): Use
gnus-article-only-boring-p.

lisp/ChangeLog
lisp/gnus-art.el
lisp/gnus-cite.el
lisp/gnus-sum.el

index a759e8e..58fcbcd 100644 (file)
@@ -1,3 +1,11 @@
+2003-02-12  Michael Shields  <shields@msrl.com>
+
+       * gnus-art.el (gnus-article-only-boring-p): New.
+       (gnus-article-skip-boring): New.
+       * gnus-cite.el (gnus-article-boring-faces): New.
+       * gnus-sum.el (gnus-summary-next-page): Use
+       gnus-article-only-boring-p.
+
 2003-02-12  Teodor Zlatanov  <tzz@lifelogs.com>
 
        * spam.el (spam-mark-spam-as-expired-and-move-routine)
index a06d41e..cd23f29 100644 (file)
@@ -200,6 +200,15 @@ Possible values in this list are:
              (const :tag "Multiple To and/or Cc headers." many-to))
   :group 'gnus-article-hiding)
 
+(defcustom gnus-article-skip-boring nil
+  "Skip over text that is not worth reading.
+By default, if you set this t, then Gnus will display citations and
+signatures, but will never scroll down to show you a page consisting
+only of boring text.  Boring text is controlled by
+`gnus-article-boring-faces'."
+  :type 'boolean
+  :group 'gnus-article-hiding)
+
 (defcustom gnus-signature-separator '("^-- $" "^-- *$")
   "Regexp matching signature separator.
 This can also be a list of regexps.  In that case, it will be checked
@@ -4735,6 +4744,27 @@ Argument LINES specifies lines to be scrolled down."
             (goto-char (point-min))))
        (move-to-window-line 0)))))
 
+(defun gnus-article-only-boring-p ()
+  "Decide whether there is only boring text remaining in the article.
+Something \"interesting\" is a word of at least two letters that does
+not have a face in `gnus-article-boring-faces'."
+  (when (and gnus-article-skip-boring
+            gnus-article-boring-faces)
+    (save-excursion
+      (catch 'only-boring
+       (while (re-search-forward "\\b\\w\\w" nil t)
+         (forward-char -1)
+         (when (not (gnus-intersection
+                     (cons (plist-get (text-properties-at (point))
+                                      'face)
+                           (mapcar-extents
+                            '(lambda (extent)
+                               (extent-property extent 'face))
+                            nil (current-buffer) (point) (point)))
+                     gnus-article-boring-faces))
+           (throw 'only-boring nil)))
+       (throw 'only-boring t)))))
+
 (defun gnus-article-refer-article ()
   "Read article specified by message-id around point."
   (interactive)
index f3e53a2..1db19cc 100644 (file)
@@ -29,7 +29,6 @@
 (eval-when-compile (require 'cl))
 
 (require 'gnus)
-(require 'gnus-art)
 (require 'gnus-range)
 (require 'message)     ; for message-cite-prefix-regexp
 
@@ -251,6 +250,17 @@ This should make it easier to see who wrote what."
   :group 'gnus-cite
   :type 'boolean)
 
+;; This has to go here because its default value depends on
+;; gnus-cite-face-list.
+(defcustom gnus-article-boring-faces (cons 'gnus-signature-face
+                                          gnus-cite-face-list)
+  "List of faces that are not worth reading.
+If an article has more pages below the one you are looking at, but
+nothing on those pages is a word of at least three letters that is not
+in a boring face, then the pages will be skipped."
+  :type '(repeat face)
+  :group 'gnus-article-hiding)
+
 ;;; Internal Variables:
 
 (defvar gnus-cite-article nil)
index cc1d05c..392f693 100644 (file)
@@ -7098,7 +7098,8 @@ If STOP is non-nil, just stop when reaching the end of the message."
          (gnus-summary-display-article article)
        (when article-window
          (gnus-eval-in-buffer-window gnus-article-buffer
-           (setq endp (gnus-article-next-page lines)))
+           (setq endp (or (gnus-article-next-page lines)
+                          (gnus-article-only-boring-p))))
          (when endp
            (cond (stop
                   (gnus-message 3 "End of message"))