Gnus development mailing list
 help / color / mirror / Atom feed
* marking articles at group exit
@ 2003-02-14 14:50 Ted Zlatanov
  2003-02-14 15:08 ` Niklas Morberg
  0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2003-02-14 14:50 UTC (permalink / raw)


I have the following in spam.el:

  (let ((articles gnus-newsgroup-articles)
	article tomove)
    (dolist (article articles)
      (gnus-summary-remove-process-mark article)
      (when (eq (gnus-summary-article-mark article) gnus-spam-mark)
	(gnus-summary-mark-article article gnus-expirable-mark)
	(push article tomove))))

but it produces errors "Can't find article %d" for every article that
is in the newsgroup, but is not visible when
gnus-summary-remove-process-mark runs (at least, I think that's the
problem).  Is there a better way of doing the removal of the process
mark from all articles?

Thanks
Ted



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

* Re: marking articles at group exit
  2003-02-14 14:50 marking articles at group exit Ted Zlatanov
@ 2003-02-14 15:08 ` Niklas Morberg
  2003-02-14 19:05   ` Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Niklas Morberg @ 2003-02-14 15:08 UTC (permalink / raw)


Ted Zlatanov <tzz@lifelogs.com> writes:

> I have the following in spam.el:
>
>   (let ((articles gnus-newsgroup-articles)
> 	article tomove)
>     (dolist (article articles)
>       (gnus-summary-remove-process-mark article)
>       (when (eq (gnus-summary-article-mark article) gnus-spam-mark)
> 	(gnus-summary-mark-article article gnus-expirable-mark)
> 	(push article tomove))))
>
> but it produces errors "Can't find article %d" for every article that
> is in the newsgroup, but is not visible when
> gnus-summary-remove-process-mark runs (at least, I think that's the
> problem).  Is there a better way of doing the removal of the process
> mark from all articles?

I don't know this at all, but greping for g-s-r-p-m seems to
indicate that you don't populate articles in the same way as
most other implementations in gnus. The common case seems to
be:

  (let ((articles (gnus-summary-work-articles n))

Could that be it?

Niklas




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

* Re: marking articles at group exit
  2003-02-14 15:08 ` Niklas Morberg
@ 2003-02-14 19:05   ` Ted Zlatanov
  2003-02-16  4:56     ` Kevin Greiner
  0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2003-02-14 19:05 UTC (permalink / raw)


On Fri, 14 Feb 2003, niklas.morberg@axis.com wrote:
> Ted Zlatanov <tzz@lifelogs.com> writes:
> 
>> I have the following in spam.el:
>>
>>   (let ((articles gnus-newsgroup-articles)
>> 	article tomove)
>>     (dolist (article articles)
>>       (gnus-summary-remove-process-mark article)
>>       (when (eq (gnus-summary-article-mark article) gnus-spam-mark)
>> 	(gnus-summary-mark-article article gnus-expirable-mark)
>> 	(push article tomove))))
>>
>> but it produces errors "Can't find article %d" for every article
>> that is in the newsgroup, but is not visible when
>> gnus-summary-remove-process-mark runs (at least, I think that's the
>> problem).  Is there a better way of doing the removal of the
>> process mark from all articles?
> 
> I don't know this at all, but greping for g-s-r-p-m seems to
> indicate that you don't populate articles in the same way as
> most other implementations in gnus. The common case seems to
> be:
> 
>   (let ((articles (gnus-summary-work-articles n))
> 
> Could that be it?

This is what you call when you want to get the articles the user wants
you to work with; gnus-summary-move-article would use this for
instance.  What I want instead is the list of articles in the group
that are visible to the user, assuming that the user only cares about
those articles to be processed when he exits the group.  It seems,
from looking at the gnus-summary-work-articles source, that I have to
go through the summary buffer line by line and ask for the article
number of each line.  That seems like a very clumsy way to do it, and
I would like to avoid it in favor of a more reusable approach if one
exists.

To sum up what I need: I need to go through the articles visible in
the summary buffer and a) take the process-mark off, and b) set the
process-mark on those that match some criteria.  Later I call
gnus-summary-move-article and it will operate on those process-marked
articles.

Thanks
Ted



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

* Re: marking articles at group exit
  2003-02-14 19:05   ` Ted Zlatanov
@ 2003-02-16  4:56     ` Kevin Greiner
  2003-02-18 17:56       ` Ted Zlatanov
  0 siblings, 1 reply; 5+ messages in thread
From: Kevin Greiner @ 2003-02-16  4:56 UTC (permalink / raw)


Ted Zlatanov <tzz@lifelogs.com> writes:

> On Fri, 14 Feb 2003, niklas.morberg@axis.com wrote:
>> Ted Zlatanov <tzz@lifelogs.com> writes:
>> 
>>> I have the following in spam.el:
>>>
>>>   (let ((articles gnus-newsgroup-articles)
>>> 	article tomove)
>>>     (dolist (article articles)
>>>       (gnus-summary-remove-process-mark article)
>>>       (when (eq (gnus-summary-article-mark article) gnus-spam-mark)
>>> 	(gnus-summary-mark-article article gnus-expirable-mark)
>>> 	(push article tomove))))
>>>
>>> but it produces errors "Can't find article %d" for every article
>>> that is in the newsgroup, but is not visible when
>>> gnus-summary-remove-process-mark runs (at least, I think that's the
>>> problem).  Is there a better way of doing the removal of the
>>> process mark from all articles?
>> 
>> I don't know this at all, but greping for g-s-r-p-m seems to
>> indicate that you don't populate articles in the same way as
>> most other implementations in gnus. The common case seems to
>> be:
>> 
>>   (let ((articles (gnus-summary-work-articles n))
>> 
>> Could that be it?
>
> This is what you call when you want to get the articles the user wants
> you to work with; gnus-summary-move-article would use this for
> instance.  What I want instead is the list of articles in the group
> that are visible to the user, assuming that the user only cares about
> those articles to be processed when he exits the group.  It seems,
> from looking at the gnus-summary-work-articles source, that I have to
> go through the summary buffer line by line and ask for the article
> number of each line.  That seems like a very clumsy way to do it, and
> I would like to avoid it in favor of a more reusable approach if one
> exists.
>
> To sum up what I need: I need to go through the articles visible in
> the summary buffer and a) take the process-mark off, and b) set the
> process-mark on those that match some criteria.  Later I call
> gnus-summary-move-article and it will operate on those process-marked
> articles.

Have you tried gnus-newsgroup-headers?  If you haven't, you should
definitely look at how gnus-sum.el uses it as there is an entire set
of accessor macros.

As for manipulating the process mark, I did much the same thing in
gnus-agent-summary-fetch-series (gnus-agent.el).  If you're simply
wanting to temporarily override the user's process marks, you can get
by with a simple binding.  For example,

(let ((gnus-newsgroup-processable 
       (my-processable-list-generator gnus-newsgroup-headers)))
  (gnus-summary-move-article nil ...))

There is a minor bug with this sample.  If you move an article that
the user had marked processable, that article is still in the user's
processable list after moving.  If you are truely doing this while
exiting the summary, this shouldn't be a problem.  Still, this would
be a little safer.


(setq gnus-newsgroup-processable
      (let* ((original-processable       gnus-newsgroup-processable)
             (gnus-newsgroup-processable 
              (my-processable-list-generator gnus-newsgroup-headers)))
        (gnus-summary-move-article nil ...)
        (gnus-set-difference original-processable
                             gnus-newsgroup-processable)))

Kevin



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

* Re: marking articles at group exit
  2003-02-16  4:56     ` Kevin Greiner
@ 2003-02-18 17:56       ` Ted Zlatanov
  0 siblings, 0 replies; 5+ messages in thread
From: Ted Zlatanov @ 2003-02-18 17:56 UTC (permalink / raw)


On Sat, 15 Feb 2003, kgreiner@xpediantsolutions.com wrote:
> Ted Zlatanov <tzz@lifelogs.com> writes:

>> To sum up what I need: I need to go through the articles visible in
>> the summary buffer and a) take the process-mark off, and b) set the
>> process-mark on those that match some criteria.  Later I call
>> gnus-summary-move-article and it will operate on those
>> process-marked articles.
> 
> Have you tried gnus-newsgroup-headers?  If you haven't, you should
> definitely look at how gnus-sum.el uses it as there is an entire set
> of accessor macros.

Oh, I see!  I put gnus-summary-kill-process-mark and
gnus-summary-yank-process-mark around my manipulations of the
process-marks, and things seem to work just fine now.  I don't think I
need to use the gnus-newsgroup-headers data, those two functions are
sufficient.

Thanks for the help!

Let me know if you observe any issues with the spam/ham moving code
now.  It seems OK here, I tested it.

Thanks
Ted



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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-14 14:50 marking articles at group exit Ted Zlatanov
2003-02-14 15:08 ` Niklas Morberg
2003-02-14 19:05   ` Ted Zlatanov
2003-02-16  4:56     ` Kevin Greiner
2003-02-18 17:56       ` Ted Zlatanov

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