Gnus development mailing list
 help / color / mirror / Atom feed
* display 'not-expired
@ 1997-12-04  0:24 Wes Hardaker
  1997-12-14 10:08 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Wes Hardaker @ 1997-12-04  0:24 UTC (permalink / raw)



A long time ago I made a rquest for something like a group param that
would allow you to display only articles without an exirory mark.  I
implemented it a long time ago (during a feature freeze) and thought I
should finally send it to you, so here it is.

How it is done:
As a group param:
  (display 'not-expired)

How it should be done:
  (display STRING)

where string is something like "-E" in this case.  Since I don't know
the function for converting marks to article numbers, I haven't done
this, and I just haven't had the time to go looking.  A string would
be much more flexible and could include only marks that someone
wanted (like "RO!"), or just the ones you don't want to see indicated
by a prepended '-' sign (like "-EO").

Wes

Index: gnus-cus.el
===================================================================
RCS file: /home/hardaker/src/cvsroot/qgnus/gnus-cus.el,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 gnus-cus.el
*** gnus-cus.el 1997/11/25 01:13:20     1.1.1.2
--- gnus-cus.el 1997/12/04 00:16:20
***************
*** 144,154 ****
--- 144,158 ----
      (display (choice :tag "Display"
                     :value default
                     (const all)
+                    (const not-expired)
                     (const default)) "\
  Which articles to display on entering the group.
  
  `all'
       Display all articles, both read and unread.
+ 
+ `not-expired'
+      All articles except those marked as expirable.
  
  `default'
       Display the default visible articles, which normally includes
Index: gnus-sum.el
===================================================================
RCS file: /home/hardaker/src/cvsroot/qgnus/gnus-sum.el,v
retrieving revision 1.1.1.5
diff -c -r1.1.1.5 gnus-sum.el
*** gnus-sum.el 1997/11/26 18:47:13     1.1.1.5
--- gnus-sum.el 1997/11/26 19:06:56
***************
*** 3854,3871 ****
  
  (defun gnus-articles-to-read (group &optional read-all)
    ;; Find out what articles the user wants to read.
!   (let* ((articles
          ;; Select all articles if `read-all' is non-nil, or if there
          ;; are no unread articles.
!         (if (or read-all
!                 (and (zerop (length gnus-newsgroup-marked))
!                      (zerop (length gnus-newsgroup-unreads)))
!                 (eq (gnus-group-find-parameter group 'display)
!                     'all))
!             (gnus-uncompress-range (gnus-active group))
            (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))
         (number (length articles))
--- 3854,3881 ----
  
  (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
!        (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)))
!          ((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))
         (number (length articles))


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


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

* Re: display 'not-expired
  1997-12-04  0:24 display 'not-expired Wes Hardaker
@ 1997-12-14 10:08 ` Lars Magne Ingebrigtsen
  1997-12-15  1:53   ` Wes Hardaker
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 1997-12-14 10:08 UTC (permalink / raw)


Wes Hardaker <wjhardaker@ucdavis.edu> writes:

> How it is done:
> As a group param:
>   (display 'not-expired)
> 
> How it should be done:
>   (display STRING)

I think so too, so I'm not applying this patch.  A way to specify what
articles to be displayed on article marks would be nice, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: display 'not-expired
  1997-12-14 10:08 ` Lars Magne Ingebrigtsen
@ 1997-12-15  1:53   ` Wes Hardaker
  1997-12-19 20:21     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Wes Hardaker @ 1997-12-15  1:53 UTC (permalink / raw)


>>>>> On 14 Dec 1997 11:08:14 +0100, Lars Magne Ingebrigtsen <larsi@gnus.org> said:

>> How it is done:
>> As a group param:
>> (display 'not-expired)
>> 
>> How it should be done:
>> (display STRING)

Lars> I think so too, so I'm not applying this patch.  A way to
Lars> specify what articles to be displayed on article marks would be
Lars> nice, though.

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...

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


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

* Re: display 'not-expired
  1997-12-15  1:53   ` Wes Hardaker
@ 1997-12-19 20:21     ` Lars Magne Ingebrigtsen
  1998-02-11 20:01       ` Wes Hardaker
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 1997-12-19 20:21 UTC (permalink / raw)


Wes Hardaker <wjhardaker@ucdavis.edu> writes:

> 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...

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

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: display 'not-expired
  1997-12-19 20:21     ` Lars Magne Ingebrigtsen
@ 1998-02-11 20:01       ` Wes Hardaker
  1998-02-13 11:50         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 7+ messages in thread
From: Wes Hardaker @ 1998-02-11 20:01 UTC (permalink / raw)


>> 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."


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

* Re: display 'not-expired
  1998-02-11 20:01       ` Wes Hardaker
@ 1998-02-13 11:50         ` Lars Magne Ingebrigtsen
  1998-02-13 17:18           ` Wes Hardaker
  0 siblings, 1 reply; 7+ messages in thread
From: Lars Magne Ingebrigtsen @ 1998-02-13 11:50 UTC (permalink / raw)


Wes Hardaker <wjhardaker@ucdavis.edu> writes:

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

Yup.

> 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.

Does it return the wrong value for any articles?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen


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

* Re: display 'not-expired
  1998-02-13 11:50         ` Lars Magne Ingebrigtsen
@ 1998-02-13 17:18           ` Wes Hardaker
  0 siblings, 0 replies; 7+ messages in thread
From: Wes Hardaker @ 1998-02-13 17:18 UTC (permalink / raw)


>>>>> On 13 Feb 1998 12:50:23 +0100, Lars Magne Ingebrigtsen <larsi@gnus.org> said:

>> 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.

Lars> Does it return the wrong value for any articles?

Well, I don't think so.  What I think is happening is that its somehow 
marking the articles.  After my code is called, all articles in the
group appear as 'O' (previously read)!  Which is plain wrong.
Actually, the very last one isn't, its marked as unread (as it should
be).  Very odd.  It appears that the function is somehow modifying the 
mark list and not just returning the value (which judging by what I
read of the macro code, this doesn't make sense).

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


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

end of thread, other threads:[~1998-02-13 17:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-04  0:24 display 'not-expired 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
1998-02-13 11:50         ` Lars Magne Ingebrigtsen
1998-02-13 17:18           ` Wes Hardaker

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).