Gnus development mailing list
 help / color / mirror / Atom feed
From: Kevin Greiner <kgreiner@xpediantsolutions.com>
Subject: Re: marking articles at group exit
Date: Sat, 15 Feb 2003 22:56:13 -0600	[thread overview]
Message-ID: <u65rk258y.fsf@xpediantsolutions.com> (raw)
In-Reply-To: <4nof5eadju.fsf@lockgroove.bwh.harvard.edu>

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



  reply	other threads:[~2003-02-16  4:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-14 14:50 Ted Zlatanov
2003-02-14 15:08 ` Niklas Morberg
2003-02-14 19:05   ` Ted Zlatanov
2003-02-16  4:56     ` Kevin Greiner [this message]
2003-02-18 17:56       ` Ted Zlatanov

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=u65rk258y.fsf@xpediantsolutions.com \
    --to=kgreiner@xpediantsolutions.com \
    /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).