Announcements and discussions for Gnus, the GNU Emacs Usenet newsreader
 help / color / mirror / Atom feed
* How to write function to operate on marked articles?
@ 2004-03-15 12:24 Svend Tollak Munkejord
  2004-03-15 22:47 ` Frank Schmitt
  0 siblings, 1 reply; 3+ messages in thread
From: Svend Tollak Munkejord @ 2004-03-15 12:24 UTC (permalink / raw)


Hi,

I have the following function to tell Spamassassin that a message is spam:

(defun stm-spamassassin-spam ()
  (interactive)
  (gnus-summary-show-raw-article)
  (gnus-summary-save-in-pipe "sa-learn --spam");
  (gnus-summary-move-article 1 "nnmaildir:boss" nil nil))
; "boss" is Norwegian meaning "rubbish".

It only works on the current article. Is there a way I can modify this
function to operate on all marked articles in the Summary buffer, one at a
time?

Regards,
-- 
Svend Tollak Munkejord 


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

* Re: How to write function to operate on marked articles?
  2004-03-15 12:24 How to write function to operate on marked articles? Svend Tollak Munkejord
@ 2004-03-15 22:47 ` Frank Schmitt
       [not found]   ` <hddsmg8rjhu.fsf@bacchus.pvv.ntnu.no>
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Schmitt @ 2004-03-15 22:47 UTC (permalink / raw)


Svend Tollak Munkejord <stm+direct_reply@bacchus.pvv.org> writes:

> I have the following function to tell Spamassassin that a message is spam:
>
> (defun stm-spamassassin-spam ()
>   (interactive)
>   (gnus-summary-show-raw-article)
>   (gnus-summary-save-in-pipe "sa-learn --spam");
>   (gnus-summary-move-article 1 "nnmaildir:boss" nil nil))
> ; "boss" is Norwegian meaning "rubbish".
>
> It only works on the current article. Is there a way I can modify this
> function to operate on all marked articles in the Summary buffer, one at a
> time?

Yes, you can use the function gnus-summary-work-articles to get a list
of all process-marked articles. Have a look in
gnus-summary-move-article for an example. Remember to wrap the code in
(eval-after-load 'gnus-sum (...))

-- 
Did you ever realize how much text fits in eighty columns? If you now consider
that a signature usually consists of up to four lines, this gives you enough
space to spread a tremendous amount of information with your messages. So seize
this opportunity and don't waste your signature with bullshit nobody will read.


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

* Re: How to write function to operate on marked articles?
       [not found]     ` <m38yi0egce.fsf@fed1.frank-schmitt.net>
@ 2004-03-17  7:45       ` Svend Tollak Munkejord
  0 siblings, 0 replies; 3+ messages in thread
From: Svend Tollak Munkejord @ 2004-03-17  7:45 UTC (permalink / raw)


On 2004-03-16, Frank Schmitt <usereplyto2004@Frank-Schmitt.net> wrote:

> Svend Tollak Munkejord <stm+direct_reply@bacchus.pvv.org> writes:
>
>>> Remember to wrap the code in (eval-after-load 'gnus-sum (...))
>>
>> Is this necessary? It seemed to work without it...
>
> Well, you use a function defined in gnus-sum.el and when you haven't
> loaded gnus-sum.el when this part of .gnus is read, you'll run in an
> error.

OK, I see. Since I didn't get an error, there is probably something else in
my .gnus that "saved" me, then.

Regards,
-- 
Svend Tollak Munkejord 


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

end of thread, other threads:[~2004-03-17  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-15 12:24 How to write function to operate on marked articles? Svend Tollak Munkejord
2004-03-15 22:47 ` Frank Schmitt
     [not found]   ` <hddsmg8rjhu.fsf@bacchus.pvv.ntnu.no>
     [not found]     ` <m38yi0egce.fsf@fed1.frank-schmitt.net>
2004-03-17  7:45       ` Svend Tollak Munkejord

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