[gnus git] branch master updated: n0-17-188-g1655d61 =1= Remove duplicates with `A T' when running unthreaded.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  1655d61cbda74a7223935196be1e1c6182a3c9b8 (commit)
      from  e1889675b7f4adf057833c5513c9374134c4e053 (commit)


- Log -----------------------------------------------------------------
commit 1655d61cbda74a7223935196be1e1c6182a3c9b8
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Tue Jul 19 19:30:04 2011 +0200

    Remove duplicates with `A T' when running unthreaded.
    
    * gnus-sum.el (gnus-delete-duplicate-headers): New function.
    (gnus-summary-refer-thread): Use it to remove duplicates in the
    un-threaded view (bug#9053).

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f99a1bd..c47cc5c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-19  Lars Magne Ingebrigtsen  <[email protected]>
+
+	* gnus-sum.el (gnus-delete-duplicate-headers): New function.
+	(gnus-summary-refer-thread): Use it to remove duplicates in the
+	un-threaded view (bug#9053).
+
 2011-07-07  Kan-Ru Chen  <[email protected]>
 
 	* nnir.el (nnir-read-server-parm): Use default value from global
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 5a817e1..9f72484 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -8950,6 +8950,21 @@ Return the number of articles fetched."
       (gnus-summary-position-point)
       n)))
 
+(defun gnus-delete-duplicate-headers (headers)
+  ;; First remove leading duplicates.
+  (while (and (> (length headers) 1)
+	      (= (mail-header-number (car headers))
+		 (mail-header-number (cadr headers))))
+    (pop headers))
+  ;; Then the rest.
+  (let ((result headers))
+    (while (> (length headers) 1)
+      (if (= (mail-header-number (car headers))
+	     (mail-header-number (cadr headers)))
+	  (setcdr headers (cddr headers))
+	(pop headers)))
+    result))
+
 (defun gnus-summary-refer-thread (&optional limit)
   "Fetch all articles in the current thread.
 If no backend-specific 'request-thread function is available
@@ -8966,6 +8981,7 @@ variable."
 	 (limit (if limit (prefix-numeric-value limit)
 		  gnus-refer-thread-limit)))
     (setq gnus-newsgroup-headers
+	  (gnus-delete-duplicate-headers
 	  (gnus-merge
 	   'list gnus-newsgroup-headers
 	   (if (gnus-check-backend-function
@@ -8986,7 +9002,7 @@ variable."
 			(regexp-opt (append refs (list id subject)))))))
 	       (gnus-fetch-headers (list last) (if (numberp limit)
 						   (* 2 limit) limit) t)))
-	   'gnus-article-sort-by-number))
+	    'gnus-article-sort-by-number)))
     (gnus-summary-limit-include-thread id)))
 
 (defun gnus-summary-refer-article (message-id)

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog   |    6 +++++
 lisp/gnus-sum.el |   58 ++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 43 insertions(+), 21 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.