From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/44340 Path: main.gmane.org!not-for-mail From: Mark Thomas Newsgroups: gmane.emacs.gnus.general Subject: seen list cleanup Date: Mon, 22 Apr 2002 16:44:02 -0400 Sender: owner-ding@hpc.uh.edu Message-ID: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1019508346 14681 127.0.0.1 (22 Apr 2002 20:45:46 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 22 Apr 2002 20:45:46 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16zkgz-0003og-00 for ; Mon, 22 Apr 2002 22:45:45 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 16zkf2-0002at-00; Mon, 22 Apr 2002 15:43:44 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 22 Apr 2002 15:43:56 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id PAA18128 for ; Mon, 22 Apr 2002 15:43:45 -0500 (CDT) Original-Received: (qmail 17935 invoked by alias); 22 Apr 2002 20:43:22 -0000 Original-Received: (qmail 17928 invoked from network); 22 Apr 2002 20:43:22 -0000 Original-Received: from cmu-32888.wv.cc.cmu.edu (HELO svelte.home) (128.2.77.169) by gnus.org with SMTP; 22 Apr 2002 20:43:22 -0000 Original-Received: by svelte.home (Postfix, from userid 4642) id 0022C1B843; Mon, 22 Apr 2002 16:44:02 -0400 (EDT) Original-To: ding@gnus.org Mail-Followups-To: ding@gnus.org Original-Lines: 9 User-Agent: Gnus/5.090006 (Oort Gnus v0.06) XEmacs/21.1 (Cuyahoga Valley, i686-pc-linux) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:44340 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:44340 --=-=-= Seeing Norman's "seen" list in the "gnus forgets new mail" thread prompted me to send this code that I'm using to clean up the list of seen articles. -Mark --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment Content-Description: seen list clean up (defun mthomas:gnus-flatten-range (list) "Return the numbers explicitly shown in list. \(\(\(0 . 2) 3 \(\(nil . 4) 5 6) 7 8 \(\(\(9))))) ==> \(0 2 3 4 5 6 7 8 9) Does not do any range calculations." (cond ((not (listp list)) (list list)) ((not (listp (cdr list))) (mthomas:gnus-flatten-range (list (car list) (cdr list)))) (list (apply 'append (mapcar 'mthomas:gnus-flatten-range list))))) (defun mthomas:range-min-max-cons (list) "Return a cons that contains the minimum and maximum values in list of lists/conses/numbers. Uses mthomas:gnus-flatten-range to process the list." (setq list (mthomas:gnus-flatten-range list)) (cons (apply 'min list) (apply 'max list))) (defun mthomas:gnus-mark-all-as-seen () "Set gnus-newsgroup-unseen to the cons of the mininum and the maximum of gnus-newsgroup-seen and gnus-newsgroup-unseen" (let* ((list (append gnus-newsgroup-seen gnus-newsgroup-unseen))) (when list (setq gnus-newsgroup-unseen (list (mthomas:range-min-max-cons list)))))) (defadvice gnus-summary-catchup (after mthomas:gnus-mark-all-seen activate) "Mark all articles as seen whenever the user does a catchup." (mthomas:gnus-mark-all-as-seen)) --=-=-=--