Gnus development mailing list
 help / color / mirror / Atom feed
From: Wes Hardaker <wjhardaker@ucdavis.edu>
Subject: Re: display 'not-expired
Date: 11 Feb 1998 12:01:16 -0800	[thread overview]
Message-ID: <x767mlhpwz.fsf@des.castles.com> (raw)
In-Reply-To: Lars Magne Ingebrigtsen's message of "19 Dec 1997 21:21:53 +0100"

>> Yep.  I didn't do it because it was going to take me too long to
>> figure out how to map a article mark into a list of articles that have 
>> it.  If you can point me at the functions I need, I'd be happy to do
>> it correctly...

Lars> There is no such mapping function, but you can do it the other way
Lars> around.  `(gnus-summary-article-mark ARTICLE)' will return the mark of
Lars> ARTICLE, and you can iterate over `gnus-newsgroup-headers' to find all
Lars> the article numbers.

Ok, I'm back to hacking on this problem again (I'm trying to allow the
display parameter to be set to things like "-E" as a reminder), but I
ran into a couple snags:

1) gnus-summary-article-mark always returns 'nil, which I believe is
   because the information hasn't been set yet.

2) I switched to gnus-article-mark, but that seems off too, and it
   marks a bunch of articles with marks that don't have it.

Here's the current code.  Tell me where I went wrong:

(defun gnus-articles-to-read (group &optional read-all)
  ;; Find out what articles the user wants to read.
  (let* ((display (gnus-group-find-parameter group 'display))
	 tmparticles artmark
	 (articles
	  ;; Select all articles if `read-all' is non-nil, or if there
	  ;; are no unread articles.
 	  (cond 
 	   ((or read-all
		(and (zerop (length gnus-newsgroup-marked))
		     (zerop (length gnus-newsgroup-unreads)))
		(eq display 'all))
 	    (gnus-uncompress-range (gnus-active group)))
	   ((stringp display)
	    (message gnus-newsgroup-headers)
	    (setq tmparticles (gnus-uncompress-range (gnus-active group)))
 	    (setq articles nil)
	    (if (string-equal (substring display 0 1) "-")
		(progn
		  (setq display (substring display 1))
		  (while (not (null tmparticles))
		    (setq artmark 
			  (char-to-string 
			   (gnus-article-mark (car tmparticles))))
		    (if (or (not artmark)
			    (not (string-match artmark display)))
			(setq articles 
			      (append (list (car tmparticles)) articles)))
		    (setq tmparticles (cdr tmparticles))))
	      (while (not (null tmparticles))
		(setq artmark 
		      (char-to-string (gnus-article-mark (car tmparticles))))
		(if (and artmark (string-match artmark display))
		    (setq articles
			  (append (list (car tmparticles)) articles)))
		(setq tmparticles (cdr tmparticles))))
	    articles)
 	   ((eq display 'not-expired)
 	    (setq articles (gnus-uncompress-range (gnus-active group)))
 	    (setq tmparticles gnus-newsgroup-expirable)
 	    (while (not (null tmparticles))
	      (setq articles (delq (car tmparticles) articles))
	      (setq tmparticles (cdr tmparticles)))
 	    articles)
 	   (t
	    (sort (append gnus-newsgroup-dormant gnus-newsgroup-marked
			  (copy-sequence gnus-newsgroup-unreads))
		  '<))))
	 (scored-list (gnus-killed-articles gnus-newsgroup-killed articles))
	 (scored (length scored-list))
....



-- 
"Ninjas aren't dangerous.  They're more afraid of you than you are of them."


  reply	other threads:[~1998-02-11 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-04  0:24 Wes Hardaker
1997-12-14 10:08 ` Lars Magne Ingebrigtsen
1997-12-15  1:53   ` Wes Hardaker
1997-12-19 20:21     ` Lars Magne Ingebrigtsen
1998-02-11 20:01       ` Wes Hardaker [this message]
1998-02-13 11:50         ` Lars Magne Ingebrigtsen
1998-02-13 17:18           ` Wes Hardaker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=x767mlhpwz.fsf@des.castles.com \
    --to=wjhardaker@ucdavis.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).