Gnus development mailing list
 help / color / mirror / Atom feed
* Split mail on two headers
@ 1998-04-07 18:30 Harry Putnam
  1998-04-07 19:35 ` Colin Rafferty
  0 siblings, 1 reply; 15+ messages in thread
From: Harry Putnam @ 1998-04-07 18:30 UTC (permalink / raw)



Probably should be using 'fancy-splitting' but have tried to read it
several times, and it is just to complicated for my level of
experience. (A 'correct'  way of saying: I couldn't make heads or tails
of it)


I want to see a regexp capable of splitting a message on both 'From' and
'To' headers.  In other words some way to match on more than one line.

Something like this seems it should work to split Joes' mail to me into
'Box' and let his mail to <whatever> go in a different direction, but
does not.

("Box" "From:.*Joe Blow\\(.\\|\n\\)*To:.*reader")

Either one works by itself, but not together.

Trying to tell the search engine to match "From: Joe Blow" then scan any
number of characters or newlines to match "To: <anything> reader"

Is this annotation "\n" the proper one in this instance?

Apparently this regexp engine searches like so:
         
jfjjjfjjj----------------\     "head"  
fjjfjjjf                     --all hearder lines
kfjfjjfjf                    <==Engine searches hear
kkfkfkfkf________________/

jfjfjfjfj----------------\
jfjfjfjf                     -- body 
jfjjjjj__________________/   <==not here


So can it be made to match on more than one line in the 'head'?
Or, even more complicated, can it be made to match on a string in the
body? (might be fun to play with)

-- 

Harry Putnam  reader@newsguy.com


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

* Re: Split mail on two headers
  1998-04-07 18:30 Split mail on two headers Harry Putnam
@ 1998-04-07 19:35 ` Colin Rafferty
  1998-04-07 22:35   ` Harry Putnam
  0 siblings, 1 reply; 15+ messages in thread
From: Colin Rafferty @ 1998-04-07 19:35 UTC (permalink / raw)


Harry Putnam writes:

> Probably should be using 'fancy-splitting' but have tried to read it
> several times, and it is just to complicated for my level of
> experience. (A 'correct'  way of saying: I couldn't make heads or tails
> of it)

For getting started with fancy splitting, just start it at one simple
level to do your basic splitting.  Then add fancy stuff as you need it 
later.

> I want to see a regexp capable of splitting a message on both 'From' and
> 'To' headers.  In other words some way to match on more than one line.

You cannot do this in basic or fancy splitting.  Everything is just
one line at a time.

> Something like this seems it should work to split Joes' mail to me into
> 'Box' and let his mail to <whatever> go in a different direction, but
> does not.

> ("Box" "From:.*Joe Blow\\(.\\|\n\\)*To:.*reader")

This is one of my fancy mail splitting rules that does something
similar to what you want:

	    (from mail
		  (| ("\\(resent-\\)?\\(to\\|cc\\)" "craffert" "mail.daemon")
		     "mail.auto.spam"))

`from' and `mail' are predefined regexp's that match the "From:" field 
and the mailer-daemon sender, respectively.

If a message is "from" "mail", then I do a subsplit.  If it is
actually "to" me, I want it in "mail.daemon".  If it is not to me, it
is probably spam, so put it in the spam box.

Your version may look like this:

	    (from "Joe_Blow"
		  (| ("\\(resent-\\)?\\(to\\|cc\\)" "reader" "Box")
		     "Different.Box"))

> So can it be made to match on more than one line in the 'head'?

No.  You could write your own split function to do that, but it might
be more work than you need.

> Or, even more complicated, can it be made to match on a string in the
> body? (might be fun to play with)

No.  You cannot even write a split function that does this, since the
split is called narrowed to the header.

-- 
Colin


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

* Re: Split mail on two headers
  1998-04-07 19:35 ` Colin Rafferty
@ 1998-04-07 22:35   ` Harry Putnam
  1998-04-07 23:24     ` Ken Raeburn
  1998-04-08  2:22     ` Justin Sheehy
  0 siblings, 2 replies; 15+ messages in thread
From: Harry Putnam @ 1998-04-07 22:35 UTC (permalink / raw)


Colin Rafferty <craffert@ml.com> writes:

> Harry Putnam writes:

> This is one of my fancy mail splitting rules that does something
> similar to what you want:
> 
> 	    (from mail
> 		  (| ("\\(resent-\\)?\\(to\\|cc\\)" "craffert" "mail.daemon")
> 		     "mail.auto.spam"))
> 
> `from' and `mail' are predefined regexp's that match the "From:" field 
> and the mailer-daemon sender, respectively.

When you say "predefined" do you mean in emacs or gnus *.el files
somewhere or do you mean that you have it 'predefined" somewhere?
Runing 'eval-region' or  'eval-last-sexp' just says 
"Symbol function definition is void: from"



> > Or, even more complicated, can it be made to match on a string in the
> > body? (might be fun to play with)
> 
> No.  You cannot even write a split function that does this, since the
> split is called narrowed to the header.


-- 

Harry Putnam  reader@newsguy.com


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

* Re: Split mail on two headers
  1998-04-07 22:35   ` Harry Putnam
@ 1998-04-07 23:24     ` Ken Raeburn
  1998-04-08  1:06       ` Harry Putnam
  1998-04-08  1:40       ` Harry Putnam
  1998-04-08  2:22     ` Justin Sheehy
  1 sibling, 2 replies; 15+ messages in thread
From: Ken Raeburn @ 1998-04-07 23:24 UTC (permalink / raw)
  Cc: ding

Harry Putnam <reader@newsguy.com> writes:

> Colin Rafferty <craffert@ml.com> writes:
> > `from' and `mail' are predefined regexp's that match the "From:" field 
> > and the mailer-daemon sender, respectively.
> 
> When you say "predefined" do you mean in emacs or gnus *.el files
> somewhere or do you mean that you have it 'predefined" somewhere?
> Runing 'eval-region' or  'eval-last-sexp' just says 
> "Symbol function definition is void: from"

There's a customizable assoc list nnmail-split-abbrev-alist which is
checked if a symbol is found rather than a string.  See nnmail.el.


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

* Re: Split mail on two headers
  1998-04-07 23:24     ` Ken Raeburn
@ 1998-04-08  1:06       ` Harry Putnam
  1998-04-08  1:40       ` Harry Putnam
  1 sibling, 0 replies; 15+ messages in thread
From: Harry Putnam @ 1998-04-08  1:06 UTC (permalink / raw)


Ken Raeburn <raeburn@cygnus.com> writes:

> Harry Putnam <reader@newsguy.com> writes:
> 
> > Colin Rafferty <craffert@ml.com> writes:
> > > `from' and `mail' are predefined regexp's that match the "From:" field 
> > > and the mailer-daemon sender, respectively.
> > 
> > When you say "predefined" do you mean in emacs or gnus *.el files
> > somewhere or do you mean that you have it 'predefined" somewhere?
> > Runing 'eval-region' or  'eval-last-sexp' just says 
> > "Symbol function definition is void: from"

Ken:
 
> There's a customizable assoc list nnmail-split-abbrev-alist which is
> checked if a symbol is found rather than a string.  See nnmail.el.

Not sure I see what you are refering to above.  If you feel like
explaining any further, use the kind of language you would use to
address a 'simpleton'  : (

I did find some helpfull examples in nnmail.el, though that look like
something I breezed over in Info but didn't really catch on to.

I have noticed in many examples of mail splitting, the boxes are always
shown in this format 'mail.(dot)name' or 'mail.whatever'.

Lars points out that the actual word 'mail' isn't necessary, but is the
format 'word.word' required.  I just gave names to all mine in a single
word format like so:

(setq nnmail-split-methods
      '(("Box" "From:.*Joe Blow@redhat.com")
         ("Sea-Lore" "Sender:.*neptune@oceanic")
           ("mail.misc" ""))) Seems to work all right for some months
now.  But the stuff shown in nnmail.el is a different split method too.
The last one 'mail.misc', is probably more the result of copying heavily
rather than by design.


Harry:
  > > I want to see a regexp capable of splitting a message on both 'From' and
  > > 'To' headers.  In other words some way to match on more than one line.

Colin:
  
  > You cannot do this in basic or fancy splitting.  Everything is just
  > one line at a time.
  > 
 
Looks like nnmail.el has an example that looks for all the world like it
splits on more than one line.  Unless this is just a joke on Lars for
always 'hawking' those little milk containers. 

  > (setq nnmail-split-methods     
  > 	   '((\"mail.4ad\" \"From:.*4ad\")
  > 	     (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")  <===****
  > 	     (\"mail.misc\" \"\")))

Understanding why this format does what it does was a little more than I
could absorb, must be making a second sweep or something on the matching.

-- 

Harry Putnam  reader@newsguy.com


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

* Re: Split mail on two headers
  1998-04-07 23:24     ` Ken Raeburn
  1998-04-08  1:06       ` Harry Putnam
@ 1998-04-08  1:40       ` Harry Putnam
  1 sibling, 0 replies; 15+ messages in thread
From: Harry Putnam @ 1998-04-08  1:40 UTC (permalink / raw)


Ken Raeburn <raeburn@cygnus.com> writes:

OOPS--

  > Looks like nnmail.el has an example that looks for all the world like it
  > splits on more than one line.  Unless this is just a joke on Lars for
  > always 'hawking' those little milk containers. 
  > 
  >   > (setq nnmail-split-methods     
  >   > 	   '((\"mail.4ad\" \"From:.*4ad\")
  >   > 	     (\"mail.junk\" \"From:.*Lars\\\\|Subject:.*buy\")  <===****
  >   > 	     (\"mail.misc\" \"\")))

  > 

I see now that it is just a normal 'or'setup disguised with a couple of
extra match sticks.  Looks like just suppressing crossposting will do
what I want for now.  If I arrange the order of the splits right.

I didn't see a user setable variable for that so just tried 
(setq nnmail-crosspost nil)  Is this correct?  Haven't given a thorough
test yet but seems to work for the one area where I had crossposting
going on.

-- 

Harry Putnam  reader@newsguy.com


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

* Re: Split mail on two headers
  1998-04-07 22:35   ` Harry Putnam
  1998-04-07 23:24     ` Ken Raeburn
@ 1998-04-08  2:22     ` Justin Sheehy
  1998-04-08  8:59       ` Harry
  1 sibling, 1 reply; 15+ messages in thread
From: Justin Sheehy @ 1998-04-08  2:22 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

> Colin Rafferty <craffert@ml.com> writes:

> > Harry Putnam writes:

> > 	    (from mail
> > 		  (| ("\\(resent-\\)?\\(to\\|cc\\)" "craffert" "mail.daemon")
> > 		     "mail.auto.spam"))

> Runing 'eval-region' or  'eval-last-sexp' just says 
> "Symbol function definition is void: from"

That is because you are not actually supposed to evaluate that form.
It is a splitting rule, not an expression to be evaluated.

Why did you try to eval it?  This is simply a snippet of what you may
wish to set nnmail-split-fancy to.  There is a very clear example of
this in the documentation of that variable.

Please read the fine manual.

-- 
Justin Sheehy

In a cloud bones of steel.
  




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

* Re: Split mail on two headers
  1998-04-08  2:22     ` Justin Sheehy
@ 1998-04-08  8:59       ` Harry
  1998-04-08  9:09         ` Hrvoje Niksic
  1998-04-08  9:37         ` Kai Grossjohann
  0 siblings, 2 replies; 15+ messages in thread
From: Harry @ 1998-04-08  8:59 UTC (permalink / raw)


On 7 Apr 1998, Justin Sheehy wrote:

Justin Sheehy <justin@linus.mitre.org> writes:

> Harry Putnam <reader@newsguy.com> writes:
> 
> > Colin Rafferty <craffert@ml.com> writes:
> 
> > > Harry Putnam writes:
> 
> > > 	    (from mail
> > > 		  (| ("\\(resent-\\)?\\(to\\|cc\\)" "craffert"
"mail.daemon")
> > > 		     "mail.auto.spam"))
> 
> > Runing 'eval-region' or  'eval-last-sexp' just says 
> > "Symbol function definition is void: from"
> 
> That is because you are not actually supposed to evaluate that form.
> It is a splitting rule, not an expression to be evaluated.

> Why did you try to eval it?  This is simply a snippet of what you
>may wish to set nnmail-split-fancy to.  There is a very clear example
>of this in the documentation of that variable.

Just saying loudly that it is "very clear" does not make it so.
Not 'very clear' to everyone.

Not all of us know all the uses of evaling things, in this case my aim
was to try and learn more about what it meant by comparing eval with
eval of my existing "snippets" of mail split phrases.  Not to
determine if it was a complete program.
 
> Please read the fine manual.

I imagine your patience is wearing thin on my ramblings, but it must
be quite apparent that I *am* reading just about everything I can get
my hands on including the nnmail.el file that covers this topic.  And
thesections in Info.  The problem is that I am not understanding enough
of it.

So exortations to RTFM may not be all that usefull or pertinent.

-- 

Harry  <reader@newsguy.com>




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

* Re: Split mail on two headers
  1998-04-08  8:59       ` Harry
@ 1998-04-08  9:09         ` Hrvoje Niksic
  1998-04-08 15:41           ` Harry Putnam
  1998-04-09  3:36           ` Harry Putnam
  1998-04-08  9:37         ` Kai Grossjohann
  1 sibling, 2 replies; 15+ messages in thread
From: Hrvoje Niksic @ 1998-04-08  9:09 UTC (permalink / raw)


Harry <reader@newsguy.com> writes:

> So exortations to RTFM may not be all that usefull or pertinent.

Oh come on Harry...  Colin had made it quite clear that the code
snippet is a part of the splitting rules.  You ask the question,
Justin *answers* it fully, and you are angry that he told you to RTFM!
We all get told to RTFM once in a while, no big deal!

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
You have an unusual magnetic personality.  Don't walk too close to
metal objects which are not fastened down.


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

* Re: Split mail on two headers
  1998-04-08  8:59       ` Harry
  1998-04-08  9:09         ` Hrvoje Niksic
@ 1998-04-08  9:37         ` Kai Grossjohann
  1998-04-08  9:44           ` Hrvoje Niksic
  1 sibling, 1 reply; 15+ messages in thread
From: Kai Grossjohann @ 1998-04-08  9:37 UTC (permalink / raw)
  Cc: ding

>>>>> On Wed, 8 Apr 1998, Harry  said:

  Harry> Not all of us know all the uses of evaling things, in this
  Harry> case my aim was to try and learn more about what it meant by
  Harry> comparing eval with eval of my existing "snippets" of mail
  Harry> split phrases.  Not to determine if it was a complete
  Harry> program.

These symbols are pseudo-variables, and Lars has made it so that these
variables actually have values whenever his code evals the snippet.
As you haven't made sure these pseudo-variables have values before
evaling the snippet, your eval failed.

I think you need to test this stuff with B q which does the
pseudo-variable thing.

kai
-- 
Really cancel?   [OK]  [Cancel]


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

* Re: Split mail on two headers
  1998-04-08  9:37         ` Kai Grossjohann
@ 1998-04-08  9:44           ` Hrvoje Niksic
  1998-04-08 10:15             ` Kai Grossjohann
  0 siblings, 1 reply; 15+ messages in thread
From: Hrvoje Niksic @ 1998-04-08  9:44 UTC (permalink / raw)


Kai Grossjohann <grossjohann@charly.cs.uni-dortmund.de> writes:

> >>>>> On Wed, 8 Apr 1998, Harry  said:
> 
>   Harry> Not all of us know all the uses of evaling things, in this
>   Harry> case my aim was to try and learn more about what it meant by
>   Harry> comparing eval with eval of my existing "snippets" of mail
>   Harry> split phrases.  Not to determine if it was a complete
>   Harry> program.
> 
> These symbols are pseudo-variables, and Lars has made it so that
> these variables actually have values whenever his code evals the
> snippet.  As you haven't made sure these pseudo-variables have
> values before evaling the snippet, your eval failed.

This description is very inaccurate.  What really happens is that the
code walks through nnmail-split-fancy and "interprets" it, without
actually attempting to assign values and using the Lisp evaluator
directly.

> I think you need to test this stuff with B q which does the
> pseudo-variable thing.

`B q' invokes `nnmail-split-it'.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
* Q: What is an experienced Emacs user?
* A: A person who wishes that the terminal had pedals.


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

* Re: Split mail on two headers
  1998-04-08  9:44           ` Hrvoje Niksic
@ 1998-04-08 10:15             ` Kai Grossjohann
  0 siblings, 0 replies; 15+ messages in thread
From: Kai Grossjohann @ 1998-04-08 10:15 UTC (permalink / raw)


>>>>> On 08 Apr 1998, Hrvoje Niksic said:

  Hrvoje> This description is very inaccurate.

Eek.  I should have checked the code first.  Sorry.

kai
-- 
Really cancel?   [OK]  [Cancel]


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

* Re: Split mail on two headers
  1998-04-08  9:09         ` Hrvoje Niksic
@ 1998-04-08 15:41           ` Harry Putnam
  1998-04-09 13:37             ` Hrvoje Niksic
  1998-04-09  3:36           ` Harry Putnam
  1 sibling, 1 reply; 15+ messages in thread
From: Harry Putnam @ 1998-04-08 15:41 UTC (permalink / raw)


Hrvoje Niksic <hniksic@srce.hr> writes:

> Harry <reader@newsguy.com> writes:
> 
> > So exortations to RTFM may not be all that usefull or pertinent.
> 
> Oh come on Harry...  Colin had made it quite clear that the code
> snippet is a part of the splitting rules.  You ask the question,
> Justin *answers* it fully, and you are angry that he told you to RTFM!
> We all get told to RTFM once in a while, no big deal!

OK, ok I do have trouble understanding this stuff.  I understood that  
Colins 'snippet' was *not* meant to be a full blown program for
splitting mail.  Where we parted ways, was my ignorance in what evaling
actually is for or does.  My comments to Colin were only for more
explanation. 

Justin answered in full, yes.  Thanks for that.
But also asks a question.  "Why did you try to eval it?'

Well, out of ignorance mainly, but not for lack of reading the manual.



-- 

Harry Putnam  reader@newsguy.com



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

* Re: Split mail on two headers
  1998-04-08  9:09         ` Hrvoje Niksic
  1998-04-08 15:41           ` Harry Putnam
@ 1998-04-09  3:36           ` Harry Putnam
  1 sibling, 0 replies; 15+ messages in thread
From: Harry Putnam @ 1998-04-09  3:36 UTC (permalink / raw)


> Harry <reader@newsguy.com> writes:
> 
> > So exortations to RTFM may not be all that usefull or pertinent.
> 
> Oh come on Harry...  Colin had made it quite clear that the code
> snippet is a part of the splitting rules.  You ask the question,
> Justin *answers* it fully, and you are angry that he told you to RTFM!
> We all get told to RTFM once in a while, no big deal!

OK, ok I do have trouble understanding this stuff.  I understood that  
Colins 'snippet' was *not* meant to be a full blown program for
splitting mail.  Where we parted ways, was my ignorance in what evaling
actually is for or does.  My comments to Colin were only for more
explanation. 

Justin answered in full, yes.  Thanks for that.
But also asks a question.  "Why did you try to eval it?'

Well, out of ignorance mainly, but not for lack of reading the manual.

-- 

Harry Putnam  reader@newsguy.com








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

* Re: Split mail on two headers
  1998-04-08 15:41           ` Harry Putnam
@ 1998-04-09 13:37             ` Hrvoje Niksic
  0 siblings, 0 replies; 15+ messages in thread
From: Hrvoje Niksic @ 1998-04-09 13:37 UTC (permalink / raw)


Harry Putnam <reader@newsguy.com> writes:

> Justin answered in full, yes.  Thanks for that.
> But also asks a question.  "Why did you try to eval it?'

I would have asked you the same question.  :-)

Obviously, the feature of Lisp that data structures look the same as
the code can be very confusing to beginners.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Ooh, Granny, what a big belly-button you have!


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

end of thread, other threads:[~1998-04-09 13:37 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-07 18:30 Split mail on two headers Harry Putnam
1998-04-07 19:35 ` Colin Rafferty
1998-04-07 22:35   ` Harry Putnam
1998-04-07 23:24     ` Ken Raeburn
1998-04-08  1:06       ` Harry Putnam
1998-04-08  1:40       ` Harry Putnam
1998-04-08  2:22     ` Justin Sheehy
1998-04-08  8:59       ` Harry
1998-04-08  9:09         ` Hrvoje Niksic
1998-04-08 15:41           ` Harry Putnam
1998-04-09 13:37             ` Hrvoje Niksic
1998-04-09  3:36           ` Harry Putnam
1998-04-08  9:37         ` Kai Grossjohann
1998-04-08  9:44           ` Hrvoje Niksic
1998-04-08 10:15             ` Kai Grossjohann

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