Gnus development mailing list
 help / color / mirror / Atom feed
* [PATCH] Skip over the rest of the article if it contains no useful content
@ 2003-01-07  4:18 Michael Shields
  2003-01-07  4:41 ` Daniel Pittman
  2003-01-07 16:49 ` Raja R Harinath
  0 siblings, 2 replies; 18+ messages in thread
From: Michael Shields @ 2003-01-07  4:18 UTC (permalink / raw)


The patch below helps to deal with people who don't trim their
citations and who have giant signatures.  It makes SPC just skip over
the rest of the article (instead of scrolling) if the rest of the
article consists only of citations and signature.  It also makes SPC
and DEL in the article buffer work exactly the same as in the summary
buffer, instead of just mostly the same.

Index: lisp/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/ChangeLog,v
retrieving revision 6.1812
diff -u -r6.1812 ChangeLog
--- lisp/ChangeLog	2003/01/07 01:22:43	6.1812
+++ lisp/ChangeLog	2003/01/07 04:19:41
@@ -1,3 +1,15 @@
+2003-01-07  Michael Shields  <shields@msrl.com>
+
+	* gnus-art.el (gnus-article-boring-faces): New.
+	(gnus-article-only-boring-p): New.
+
+	* gnus-sum.el (gnus-summary-next-page): Use
+	gnus-article-only-boring-p.
+
+	* gnus-sum.el (gnus-article-goto-next-page,
+	gnus-article-goto-prev-page): Call gnus-summary-*-page, instead of
+	relying on the summary bindings of `n' and `p'.
+
 2003-01-07  Simon Josefsson  <jas@extundo.com>
 
 	* message.el (message-mode-menu): Fix receipt balloon help.
Index: lisp/gnus-art.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-art.el,v
retrieving revision 6.266
diff -u -r6.266 gnus-art.el
--- lisp/gnus-art.el	2003/01/04 00:43:57	6.266
+++ lisp/gnus-art.el	2003/01/07 04:19:47
@@ -196,6 +196,17 @@
 	      (const :tag "Multiple To and/or Cc headers." many-to))
   :group 'gnus-article-hiding)
 
+(defcustom gnus-article-boring-faces (append (list gnus-signature-face)
+					     gnus-cite-face-list nil)
+  "List of faces for text that is 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.  Setting this
+variable to nil will disable the functionality and speed scrolling
+by a bit."
+  :type '(repeat face)
+  :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
@@ -4711,15 +4729,14 @@
 (defun gnus-article-goto-next-page ()
   "Show the next page of the article."
   (interactive)
-  (when (gnus-article-next-page)
-    (goto-char (point-min))
-    (gnus-article-read-summary-keys nil (gnus-character-to-event ?n))))
+  (gnus-eval-in-buffer-window gnus-summary-buffer
+    (gnus-summary-next-page)))
 
 (defun gnus-article-goto-prev-page ()
   "Show the next page of the article."
   (interactive)
-  (if (bobp) (gnus-article-read-summary-keys nil (gnus-character-to-event ?p))
-    (gnus-article-prev-page nil)))
+  (gnus-eval-in-buffer-window gnus-summary-buffer
+    (gnus-summary-prev-page)))
 
 (defun gnus-article-next-page (&optional lines)
   "Show the next page of the current article.
@@ -4768,6 +4785,31 @@
 	    (beginning-of-buffer
 	     (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'."
+  (if (null gnus-article-boring-faces)
+      nil
+    (save-excursion
+      (let ((only-boring t))
+	(catch 'found
+	  (while (re-search-forward "\\b\\w\\w" nil t)
+	    (let ((extent-face
+		   (plist-get (extent-properties-at (point)) 'face))
+		  (text-face
+		   (plist-get (text-properties-at (point)) 'face)))
+	      (when (or (and (null extent-face) (null text-face))
+			(and extent-face
+			     (not (member extent-face
+					  gnus-article-boring-faces)))
+			(and text-face
+			     (not (member text-face
+					  gnus-article-boring-faces))))
+		(setq only-boring nil)
+		(throw 'found nil))))
+	  only-boring)))))
 
 (defun gnus-article-refer-article ()
   "Read article specified by message-id around point."
Index: lisp/gnus-sum.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/gnus-sum.el,v
retrieving revision 6.274
diff -u -r6.274 gnus-sum.el
--- lisp/gnus-sum.el	2003/01/06 14:01:54	6.274
+++ lisp/gnus-sum.el	2003/01/07 04:19:58
@@ -7036,7 +7036,8 @@
 	  (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"))
Index: texi/ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/ChangeLog,v
retrieving revision 6.411
diff -u -r6.411 ChangeLog
--- texi/ChangeLog	2003/01/06 03:02:21	6.411
+++ texi/ChangeLog	2003/01/07 04:20:00
@@ -1,3 +1,14 @@
+2003-01-07  Michael Shields  <shields@msrl.com>
+
+	* gnus.texi (Paging the Article): Document
+	gnus-article-boring-faces.
+	(Choosing Commands): Explain that SPACE in the summary buffer
+	is used for both selecting and scrolling.
+
+	* gnus.texi (Article Keymap): Say that SPACE and DEL in the
+	summary buffer are the same as switching to the article buffer
+	and using SPACE and DEL; since now that is the case.
+
 2003-01-06  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
 	* message.texi (Various Commands): Addition.
Index: texi/gnus.texi
===================================================================
RCS file: /usr/local/cvsroot/gnus/texi/gnus.texi,v
retrieving revision 6.367
diff -u -r6.367 gnus.texi
--- texi/gnus.texi	2003/01/06 01:25:26	6.367
+++ texi/gnus.texi	2003/01/07 04:20:22
@@ -4861,6 +4861,10 @@
 Select the current article, or, if that one's read already, the next
 unread article (@code{gnus-summary-next-page}).
 
+If you have an article window open already and you press @kbd{SPACE}
+again, the article will be scrolled.  This lets you conveniently
+@kbd{SPACE} through an entire newsgroup.  @pxref{Paging the Article}.
+
 @item G n
 @itemx n
 @kindex n (Summary)
@@ -4998,6 +5002,14 @@
 or, if you have come to the end of the current article, will choose the
 next article (@code{gnus-summary-next-page}).
 
+@vindex gnus-article-boring-faces
+If the rest of the article consists only of citations and signature,
+then it will be skipped; the next article will be shown instead.  You
+can customize what is considered uninteresting with
+@code{gnus-article-boring-faces}, or set it to @code{nil} to disable
+this feature.  You can manually view the article's pages, no matter how
+boring, using @kbd{C-v} in the article buffer.
+
 @item DEL
 @kindex DEL (Summary)
 @findex gnus-summary-prev-page
@@ -10739,11 +10751,13 @@
 @kindex SPACE (Article)
 @findex gnus-article-next-page
 Scroll forwards one page (@code{gnus-article-next-page}).
+This is exactly the same as @kbd{h SPACE h}.
 
 @item DEL
 @kindex DEL (Article)
 @findex gnus-article-prev-page
 Scroll backwards one page (@code{gnus-article-prev-page}).
+This is exactly the same as @kbd{h DEL h}.
 
 @item C-c ^
 @kindex C-c ^ (Article)

-- 
Shields.




^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2003-01-09  9:30 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-07  4:18 [PATCH] Skip over the rest of the article if it contains no useful content Michael Shields
2003-01-07  4:41 ` Daniel Pittman
2003-01-07  4:45   ` Michael Shields
2003-01-07  5:00     ` Lars Magne Ingebrigtsen
2003-01-07  5:49       ` Daniel Pittman
2003-01-07  7:02         ` Michael Shields
2003-01-07  6:39       ` Michael Shields
2003-01-07  8:31         ` Daniel Pittman
2003-01-08  3:50         ` Lars Magne Ingebrigtsen
2003-01-08  6:58           ` Michael Shields
2003-01-07  4:59   ` Lars Magne Ingebrigtsen
2003-01-07 16:49 ` Raja R Harinath
2003-01-07 18:09   ` Michael Shields
2003-01-07 18:29     ` David S Goldberg
2003-01-07 18:45       ` Michael Shields
2003-01-08  6:09     ` Kai Großjohann
2003-01-08 22:49       ` Michael Shields
2003-01-09  9:30       ` Malcolm Purvis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).