diff lisp/gnus/gnus-sum.el @ 38:1a767b41a199 r19-15b102

Import from CVS: tag r19-15b102
author cvs
date Mon, 13 Aug 2007 08:54:01 +0200
parents c53a95d3c46d
children 8b8b7f3559a2
line wrap: on
line diff
--- a/lisp/gnus/gnus-sum.el	Mon Aug 13 08:53:41 2007 +0200
+++ b/lisp/gnus/gnus-sum.el	Mon Aug 13 08:54:01 2007 +0200
@@ -288,6 +288,11 @@
   :group 'gnus-article-headers
   :type 'boolean)
 
+(defcustom gnus-summary-ignore-duplicates nil
+  "*If non-nil, ignore articles with identical Message-ID headers."
+  :group 'gnus-summary
+  :type 'boolean)
+  
 (defcustom gnus-single-article-buffer t
   "*If non-nil, display all articles in the same buffer.
 If nil, each group will get its own article buffer."
@@ -2465,9 +2470,10 @@
   (let (result)
     (while (and group
 		(null (setq result
-			    (gnus-summary-read-group-1
-			     group show-all no-article
-			     kill-buffer no-display)))
+			    (let ((gnus-auto-select-next nil))
+			      (gnus-summary-read-group-1
+			       group show-all no-article
+			       kill-buffer no-display))))
 		(eq gnus-auto-select-next 'quietly))
       (set-buffer gnus-group-buffer)
       (if (not (equal group (gnus-group-group-name)))
@@ -2613,10 +2619,10 @@
 	    (select-window (get-buffer-window gnus-group-buffer t))
 	    (when (gnus-group-goto-group group)
 	      (recenter))
-	    (select-window owin))))
-      ;; Mark this buffer as "prepared".
-      (setq gnus-newsgroup-prepared t)
-      t))))
+	    (select-window owin)))
+	;; Mark this buffer as "prepared".
+	(setq gnus-newsgroup-prepared t)
+	t)))))
 
 (defun gnus-summary-prepare ()
   "Generate the summary buffer."
@@ -2886,19 +2892,21 @@
     (prog1
 	(save-excursion
 	  (set-buffer nntp-server-buffer)
-	  (goto-char (point-min))
-	  (while (and (not found) (search-forward id nil t))
-	    (beginning-of-line)
-	    (setq found (looking-at
-			 (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
-				 (regexp-quote id))))
-	    (or found (beginning-of-line 2)))
-	  (when found
-	    (beginning-of-line)
-	    (and
-	     (setq header (gnus-nov-parse-line
-			   (read (current-buffer)) deps))
-	     (gnus-parent-id (mail-header-references header)))))
+	  (let ((case-fold-search nil))
+	    (goto-char (point-min))
+	    (while (and (not found)
+			(search-forward id nil t))
+	      (beginning-of-line)
+	      (setq found (looking-at
+			   (format "^[^\t]*\t[^\t]*\t[^\t]*\t[^\t]*\t%s"
+				   (regexp-quote id))))
+	      (or found (beginning-of-line 2)))
+	    (when found
+	      (beginning-of-line)
+	      (and
+	       (setq header (gnus-nov-parse-line
+			     (read (current-buffer)) deps))
+	       (gnus-parent-id (mail-header-references header))))))
       (when header
 	(let ((number (mail-header-number header)))
 	  (push number gnus-newsgroup-limit)
@@ -4196,9 +4204,20 @@
 	  (if (boundp (setq id-dep (intern id dependencies)))
 	      (if (and (car (symbol-value id-dep))
 		       (not force-new))
-		  ;; An article with this Message-ID has already been seen,
-		  ;; so we rename the Message-ID.
-		  (progn
+		  ;; An article with this Message-ID has already been seen.
+		  (if gnus-summary-ignore-duplicates
+		      ;; We ignore this one, except we add
+		      ;; any additional Xrefs (in case the two articles
+		      ;; came from different servers).
+		      (progn
+			(mail-header-set-xref
+			 (car (symbol-value id-dep))
+			 (concat (or (mail-header-xref
+				      (car (symbol-value id-dep)))
+				     "")
+				 (or (mail-header-xref header) "")))
+			(setq header nil))
+		    ;; We rename the Message-ID.
 		    (set
 		     (setq id-dep (intern (setq id (nnmail-message-id))
 					  dependencies))
@@ -4285,9 +4304,20 @@
     (if (boundp (setq id-dep (intern id dependencies)))
 	(if (and (car (symbol-value id-dep))
 		 (not force-new))
-	    ;; An article with this Message-ID has already been seen,
-	    ;; so we rename the Message-ID.
-	    (progn
+	    ;; An article with this Message-ID has already been seen.
+	    (if gnus-summary-ignore-duplicates
+		;; We ignore this one, except we add any additional
+		;; Xrefs (in case the two articles came from different
+		;; servers.
+		(progn
+		  (mail-header-set-xref
+		   (car (symbol-value id-dep))
+		   (concat (or (mail-header-xref
+				(car (symbol-value id-dep)))
+			       "")
+			   (or (mail-header-xref header) "")))
+		  (setq header nil))
+	      ;; We rename the Message-ID.
 	      (set
 	       (setq id-dep (intern (setq id (nnmail-message-id))
 				    dependencies))