Gnus development mailing list
 help / color / mirror / Atom feed
* Run an arbitrary function on message after splitting
@ 2001-04-20 20:44 Joakim Hove
  2001-04-20 21:07 ` Kai Großjohann
  0 siblings, 1 reply; 6+ messages in thread
From: Joakim Hove @ 2001-04-20 20:44 UTC (permalink / raw)


Hello,

I am using Gnus to read my mail. Normally gnus is running continuously
for weeks at a time, and mail is fetched automagically from my pop
account after 15 minutes of idle time (or something like that).

Would it be possible to make gnus run a particular function, with
the newly arrived messages as argument. For instance every time a new
message has been dumped into my "jokes" folder I would like gnus to
forward the message to some friends, and every time I get a mail from
my mother in law I would like gnus to mark the message as read, and
auto-reply that I will be out of office for the next few months.

Of course I understand that the particular functions I want are not
ready made, but what I was wondering was how to invoke (hook-up) a set
of such functions. Or if it is at all feasible.

Regards - Joakim Hove


-- 
==== Joakim Hove      www.phys.ntnu.no/~hove/   =======================
|| Institutt for fysikk  (735) 93637 / E3-166  |  Skøyensgate 10D    ||
|| N - 7491 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim ||
================================================= 73 93 31 68 =========



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

* Re: Run an arbitrary function on message after splitting
  2001-04-20 20:44 Run an arbitrary function on message after splitting Joakim Hove
@ 2001-04-20 21:07 ` Kai Großjohann
  2001-04-20 21:15   ` Joakim Hove
  2001-04-20 21:17   ` Joakim Hove
  0 siblings, 2 replies; 6+ messages in thread
From: Kai Großjohann @ 2001-04-20 21:07 UTC (permalink / raw)
  Cc: ding

On 20 Apr 2001, Joakim Hove wrote:

> Would it be possible to make gnus run a particular function, with
> the newly arrived messages as argument.

Well, you can use the `:' feature of nnmail-split-fancy.

For example:

(setq nnmail-split-fancy
      '(| (from "motherinlaw"
                (: motherinlaw-function))
          ...))

The function motherinlaw-function should do its thing, then return the
right group for the message, as a string.  For example, if you want to
put messages from her into nnml:people.motherinlaw, the last function
should return the string "people.motherinlaw" (note the missing
`nnml:').

The function is in a buffer which is narrowed to the headers of the
message.

Note that this function is executed before the message is written to
the group, so I don't know how to mark the message as read.

kai
-- 
The passive voice should never be used.


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

* Re: Run an arbitrary function on message after splitting
  2001-04-20 21:07 ` Kai Großjohann
@ 2001-04-20 21:15   ` Joakim Hove
  2001-04-20 21:17   ` Joakim Hove
  1 sibling, 0 replies; 6+ messages in thread
From: Joakim Hove @ 2001-04-20 21:15 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:

> On 20 Apr 2001, Joakim Hove wrote:
> 
> > Would it be possible to make gnus run a particular function, with
> > the newly arrived messages as argument.

Thanks a lot for the response. I am currently only using the simpler
"nnmail-split-methods" and I'm actually quite happy with that, however
I guess I have to look into the nnmail-split-fancy functionality.

> Well, you can use the `:' feature of nnmail-split-fancy.
> 
> For example:
> 
> (setq nnmail-split-fancy
>       '(| (from "motherinlaw"
>                 (: motherinlaw-function))
>           ...))
> 

Joakim

-- 
==== Joakim Hove      www.phys.ntnu.no/~hove/   =======================
|| Institutt for fysikk  (735) 93637 / E3-166  |  Skøyensgate 10D    ||
|| N - 7491 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim ||
================================================= 73 93 31 68 =========



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

* Re: Run an arbitrary function on message after splitting
  2001-04-20 21:07 ` Kai Großjohann
  2001-04-20 21:15   ` Joakim Hove
@ 2001-04-20 21:17   ` Joakim Hove
  2001-04-21 13:48     ` Kai Großjohann
  1 sibling, 1 reply; 6+ messages in thread
From: Joakim Hove @ 2001-04-20 21:17 UTC (permalink / raw)


Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:


> The function is in a buffer which is narrowed to the headers of the
> message.

ahhh - wait a sec, does that imply that the function does not have
access to the full message-body. In that case it would be difficult to
forward the message, or make an auto-reply with citation, or am I
misunderstanding the statement "narrowed to the headers of the
message".

Joakim

-- 
==== Joakim Hove      www.phys.ntnu.no/~hove/   =======================
|| Institutt for fysikk  (735) 93637 / E3-166  |  Skøyensgate 10D    ||
|| N - 7491 Trondheim    hove@phys.ntnu.no     |  N - 7030 Trondheim ||
================================================= 73 93 31 68 =========



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

* Re: Run an arbitrary function on message after splitting
  2001-04-20 21:17   ` Joakim Hove
@ 2001-04-21 13:48     ` Kai Großjohann
  2001-04-25 22:21       ` Simon Josefsson
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Großjohann @ 2001-04-21 13:48 UTC (permalink / raw)
  Cc: ding

On 20 Apr 2001, Joakim Hove wrote:
> Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
> 
>> The function is in a buffer which is narrowed to the headers of the
>> message.
> 
> ahhh - wait a sec, does that imply that the function does not have
> access to the full message-body.

I think it has full access.  Invoke (debug) at that spot and see what
is in the full buffer.  I think it is sufficient to say

    (save-restriction
      (widen)
      ...do.stuff.with.whole.message...)

But I'm not 100% certain.

kai
-- 
The passive voice should never be used.


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

* Re: Run an arbitrary function on message after splitting
  2001-04-21 13:48     ` Kai Großjohann
@ 2001-04-25 22:21       ` Simon Josefsson
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Josefsson @ 2001-04-25 22:21 UTC (permalink / raw)
  Cc: Joakim Hove, ding

> > access to the full message-body.
>
> I think it has full access.  Invoke (debug) at that spot and see what
> is in the full buffer.  I think it is sufficient to say
>
>     (save-restriction
>       (widen)
>       ...do.stuff.with.whole.message...)
>
> But I'm not 100% certain.

Nnimap doesn't fetch the entire mail, just the headers.  But nnmail
probably got the whole mail. So it depends on the backend...



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

end of thread, other threads:[~2001-04-25 22:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-20 20:44 Run an arbitrary function on message after splitting Joakim Hove
2001-04-20 21:07 ` Kai Großjohann
2001-04-20 21:15   ` Joakim Hove
2001-04-20 21:17   ` Joakim Hove
2001-04-21 13:48     ` Kai Großjohann
2001-04-25 22:21       ` Simon Josefsson

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