Gnus development mailing list
 help / color / mirror / Atom feed
* expiry-target as function, how about an example
@ 2001-12-29  7:51 Harry Putnam
  2001-12-29 21:18 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Harry Putnam @ 2001-12-29  7:51 UTC (permalink / raw)


The nearest thing to an example of expiry-target used as a funtion is
the description of it in the manual:

o . . . . . . . . . . . . . . . . . . . . . . .  or a function
o (which will be called in a buffer narrowed to the message in question,
o and with the name of the group being moved from as its parameter) which
o should return a target - either a group name or `delete'.

How would one insert a homemade funtion here:

o    Here's an example for specifying a group name:
o      (setq nnmail-expiry-target "nnml:expired")
o 
o    Gnus provides a function `nnmail-fancy-expiry-target' which will
o expire mail to groups according to the variable
o `nnmail-fancy-expiry-targets'.  Here's an example:
o 
o       (setq nnmail-expiry-target 'nnmail-fancy-expiry-target
o             nnmail-fancy-expiry-targets
o             '((to-from "boss" "nnfolder:Work")
o          	 ("subject" "IMPORTANT" "nnfolder:IMPORTANT.%Y.%b")
o               ("from" ".*" "nnfolder:Archive-%Y")))

How can I slip a homemade function in here that processes the message
being expired? Something like this:

(defun hp-process-exp ()
   "Run procmail/formail against this message" 
   (interactive)
   (shell-command "process_exp.ksh < THIS_BUFFER" nil nil))

Where process_exp.ksh is scripting that runs stdin thru a
procmail setup that decides what to do with each expiry candidate.



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

* Re: expiry-target as function, how about an example
  2001-12-29  7:51 expiry-target as function, how about an example Harry Putnam
@ 2001-12-29 21:18 ` Lars Magne Ingebrigtsen
  2001-12-29 23:30   ` Harry Putnam
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2001-12-29 21:18 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

> The nearest thing to an example of expiry-target used as a funtion is
> the description of it in the manual:

[...]

> o    Here's an example for specifying a group name:
> o      (setq nnmail-expiry-target "nnml:expired")

[...]

> How can I slip a homemade function in here that processes the message
> being expired? Something like this:
>
> (defun hp-process-exp ()
>    "Run procmail/formail against this message" 
>    (interactive)
>    (shell-command "process_exp.ksh < THIS_BUFFER" nil nil))

(setq nnmail-expiry-target 'hp-process-exp)

But the function has to return a string that says what the target is. 

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



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

* Re: expiry-target as function, how about an example
  2001-12-29 21:18 ` Lars Magne Ingebrigtsen
@ 2001-12-29 23:30   ` Harry Putnam
  2001-12-29 23:39     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Harry Putnam @ 2001-12-29 23:30 UTC (permalink / raw)


Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> Harry Putnam <reader@newsguy.com> writes:
>
>> The nearest thing to an example of expiry-target used as a funtion is
>> the description of it in the manual:
>
> [...]
>
>> o    Here's an example for specifying a group name:
>> o      (setq nnmail-expiry-target "nnml:expired")
>
> [...]
>
>> How can I slip a homemade function in here that processes the message
>> being expired? Something like this:
>>
>> (defun hp-process-exp ()
>>    "Run procmail/formail against this message" 
>>    (interactive)
>>    (shell-command "process_exp.ksh < THIS_BUFFER" nil nil))
>
> (setq nnmail-expiry-target 'hp-process-exp)

Here we go in nitwit mode...  Do you mean something as simple as:

cat process_exp.ksh
   #!/bin/ksh
   
   if grep '^From:.*larsi@' >/dev/null;then
      echo "sacred_keepers"
   fi

Or does the name have to wear more adorment like "nnml:sacred_keepers"

If this is all it takes then a semi-complex case statement could pick
from almost any number of targets.  Oh.. is "/dev/null" amongst the
legitimate stings to return?

Do the groups have to exist?

Hoping to clear up some things before spending too much time experimenting.



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

* Re: expiry-target as function, how about an example
  2001-12-29 23:30   ` Harry Putnam
@ 2001-12-29 23:39     ` Lars Magne Ingebrigtsen
  0 siblings, 0 replies; 4+ messages in thread
From: Lars Magne Ingebrigtsen @ 2001-12-29 23:39 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

> Here we go in nitwit mode...  Do you mean something as simple as:
>
> cat process_exp.ksh
>    #!/bin/ksh
>
>    if grep '^From:.*larsi@' >/dev/null;then
>       echo "sacred_keepers"
>    fi

Well, kind of.  `shell-command' doesn't return the output from the
command; it returns the exit status.  So you have to capture the
output from the command.

> Or does the name have to wear more adorment like "nnml:sacred_keepers"

Yes.

> If this is all it takes then a semi-complex case statement could pick
> from almost any number of targets.  Oh.. is "/dev/null" amongst the
> legitimate stings to return?

No.

> Do the groups have to exist?

No.

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



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

end of thread, other threads:[~2001-12-29 23:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-29  7:51 expiry-target as function, how about an example Harry Putnam
2001-12-29 21:18 ` Lars Magne Ingebrigtsen
2001-12-29 23:30   ` Harry Putnam
2001-12-29 23:39     ` Lars Magne Ingebrigtsen

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