* (make-regexp...) in an alist
@ 1997-10-03 21:15 Norman Walsh
1997-10-03 22:05 ` William M. Perry
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Norman Walsh @ 1997-10-03 21:15 UTC (permalink / raw)
Hello World,
I'm converting over to nnmail-split-methods from my old
home-grown perl+procmail splitting system. (Hey, gnus does
everything else, why deprive it of this one pleasure ;-)
So I started building the nnmail-split-methods alist and discovered
that there are some parts I just don't want to build by hand.
Then I found (make-regexp) and was happy again.
But now the question is, how do I build the nnmail-split-methods
alist with the _value_ of (make-regexp) in it?
I'm looking for something to replace this sort of thing (which
is clearly wrong):
(setq nnmail-split-methods
'(("letterpress" "Sender:.*letpress@")
("minolta" "To:.*minolta-l")
("emacs.ding" "To:.*ding@")
("spam" (make-regexp '("From:.*@savetrees.com"
"From:.*@ispam.net"
"From:.*@earthlink.net"
...etc. add nauseum here
"Subject:.*are you being investigated")))
("dssslist" "To:.*dssslist")))
Sorry this is only a quasi-gnus question, I'm just hoping for
the kindness of elisp wizards ;-)
--norm
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (make-regexp...) in an alist
1997-10-03 21:15 (make-regexp...) in an alist Norman Walsh
@ 1997-10-03 22:05 ` William M. Perry
1997-10-04 19:10 ` Hrvoje Niksic
1997-10-04 0:12 ` Paul Franklin
1997-10-04 1:55 ` Stefan Waldherr
2 siblings, 1 reply; 5+ messages in thread
From: William M. Perry @ 1997-10-03 22:05 UTC (permalink / raw)
Cc: ding
Norman Walsh <norm@berkshire.net> writes:
> Hello World,
>
> I'm converting over to nnmail-split-methods from my old
> home-grown perl+procmail splitting system. (Hey, gnus does
> everything else, why deprive it of this one pleasure ;-)
>
> So I started building the nnmail-split-methods alist and discovered
> that there are some parts I just don't want to build by hand.
> Then I found (make-regexp) and was happy again.
>
> But now the question is, how do I build the nnmail-split-methods
> alist with the _value_ of (make-regexp) in it?
Backquote:
(setq nnmail-split-methods
(list '("letterpress" "Sender:.*letpress@")
'("minolta" "To:.*minolta-l")
'("emacs.ding" "To:.*ding@")
`("spam" ,@(make-regexp '("From:.*@savetrees.com"
"From:.*@ispam.net"
"From:.*@earthlink.net"
"Subject:.*are you being investigated")))
'("dssslist" "To:.*dssslist")))
-Bill P.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (make-regexp...) in an alist
1997-10-03 22:05 ` William M. Perry
@ 1997-10-04 19:10 ` Hrvoje Niksic
0 siblings, 0 replies; 5+ messages in thread
From: Hrvoje Niksic @ 1997-10-04 19:10 UTC (permalink / raw)
wmperry@aventail.com (William M. Perry) writes:
> Backquote:
>
> (setq nnmail-split-methods
> (list '("letterpress" "Sender:.*letpress@")
> '("minolta" "To:.*minolta-l")
> '("emacs.ding" "To:.*ding@")
> `("spam" ,@(make-regexp '("From:.*@savetrees.com"
> "From:.*@ispam.net"
> "From:.*@earthlink.net"
> "Subject:.*are you being investigated")))
> '("dssslist" "To:.*dssslist")))
Ha! Unnecessary consing! How about this:
(setq nnmail-split-methods
`(("letterpress" "Sender:.*letpress@")
("minolta" "To:.*minolta-l")
("emacs.ding" "To:.*ding@")
("spam" ,@(make-regexp '("From:.*@savetrees.com"
"From:.*@ispam.net"
"From:.*@earthlink.net"
"Subject:.*are you being investigated")))
("dssslist" "To:.*dssslist")))
--
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (make-regexp...) in an alist
1997-10-03 21:15 (make-regexp...) in an alist Norman Walsh
1997-10-03 22:05 ` William M. Perry
@ 1997-10-04 0:12 ` Paul Franklin
1997-10-04 1:55 ` Stefan Waldherr
2 siblings, 0 replies; 5+ messages in thread
From: Paul Franklin @ 1997-10-04 0:12 UTC (permalink / raw)
>>>>> Norman Walsh writes:
> (setq nnmail-split-methods
> '(("letterpress" "Sender:.*letpress@")
> ("spam" (make-regexp '("From:.*@savetrees.com"
> "From:.*@ispam.net"
> "Subject:.*are you being investigated")))
> ("dssslist" "To:.*dssslist")))
I've attached a complicated example which doesn't use backquotes.
Basically, the idea is to use "(list" to get yourself one level down
(or cons/concat/make-regexp), or "'(" to avoid interpretation of
everything below it.
(Yes, my split methods are way out of hand.)
--Paul
(setq pdf-nnmail-split-methods
(let ((not-paul "\\([^p]aul\\|[^a]ul\\|[^u]l\\|[^l]\\)")
(not-paul-pdf
"\\([^p]aul\\|[^a]ul\\|[^u]l\\|[^p]df\\|[^d]f\\|[^lf]\\)"))
(list
'((gnus-warning)
("-mail.duplicates" . "\\<duplicate\\>"))
'((x-from-line)
("-demons.mail" . "\\<postmaster\\>"))
'((a)
("-demons.mail" . "\\<MAILER.?DA?EMON\\>")
("-demons.listproc" . "\\<listproc\\>")
("-demons.majordomo.uw.cs" . "\\<Majordomo@cs.washington.edu\\>")
("-demons.majordomo" . "\\<Majordomo\\>"))
(list '(a)
(list "-mail.ads"
"[^a-z0-9][0-9][0-9][0-9][0-9]+@" ; mbox is 4+ digits
"abuse@" ; typically my complaints
(concat
"@[-.a-zA-Z9-0]*\\." ;subdomains + "."
; top-level domain errors:
"\\([a-zA-Z]*[-0-9][-a-zA-Z9-0]*" ; inval char
"\\|[a-zA-Z]\\|" ; too short (single char)
"[a-zA-Z][a-zA-Z][a-zA-Z][a-zA-Z]+\\)" ; too long (4+)
"[^-.a-zA-Z9-0]"))) ; notice end of addr
;; lots more simpler stuff here
'((l)
("-uw.cac"
"@.*\\<cac.washington.edu\\>"
"postmaster@u.washington.edu"))
(list '(l)
(cons "-transmeta.misc"
(concat not-paul "@.*\\<transmeta.com\\>")))
'((l received message-id references in-reply-to)
("-mail.uw.cs.iws"
"\\<grizzly\\>" "\\<lynx\\>" "\\<wolf\\>"))
(list '(l)
(cons "-mail.uw.cs"
(concat not-paul "@.*\\<cs.washington.edu\\>")))
(list '(l)
(cons "-mail.uw.misc"
(concat not-paul-pdf "@.*\\<washington.edu\\>")))
(list '(l)
(cons "-mail.misc"
(concat not-paul-pdf "@.*\\.")))
'(nil ("-mail.uw.cs" . "")))))
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: (make-regexp...) in an alist
1997-10-03 21:15 (make-regexp...) in an alist Norman Walsh
1997-10-03 22:05 ` William M. Perry
1997-10-04 0:12 ` Paul Franklin
@ 1997-10-04 1:55 ` Stefan Waldherr
2 siblings, 0 replies; 5+ messages in thread
From: Stefan Waldherr @ 1997-10-04 1:55 UTC (permalink / raw)
>>>>> "Norman" == Norman Walsh <norm@berkshire.net> writes:
Norman> So I started building the nnmail-split-methods alist and
Norman> discovered that there are some parts I just don't want to build by
Norman> hand. Then I found (make-regexp) and was happy again.
Can some kind soul explain me, why I would want to use it at all? It as in
`make-regexp', not `nnmail-split-methods'. Why not using multiple rules
("spam" "From:.*@savetrees.com")
("spam" "From:.*@ispam.net")
...etc. add nauseum here
("spam" "Subject:.*are you being investigated")
Thanks,
Stefan.
--
Stefan Waldherr office +1 (412) 268-3837
fax +1 (412) 268-5576
e-Mail swa@cs.cmu.edu
www http://mind.learning.cs.cmu.edu/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1997-10-04 19:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-10-03 21:15 (make-regexp...) in an alist Norman Walsh
1997-10-03 22:05 ` William M. Perry
1997-10-04 19:10 ` Hrvoje Niksic
1997-10-04 0:12 ` Paul Franklin
1997-10-04 1:55 ` Stefan Waldherr
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).