* Fallback for nnmail-split-methods
@ 2002-04-20 9:19 Thomas Gehrlein
2002-05-08 11:36 ` Kai Großjohann
0 siblings, 1 reply; 6+ messages in thread
From: Thomas Gehrlein @ 2002-04-20 9:19 UTC (permalink / raw)
nnmail-split-fancy has a fallback option for mails that don't match any of the
splitting rules. nnmail-split-methods doesnt't provide a fallback. I
discovered this after some of my mails had disappeared.
Here's some code that makes nnmail-split-methods safer. I'm not really happy
with my approach, but I couldn't figure out how the gnus splitting code works.
(defun nnmail-split-methods-add-fall-back ()
"Add a fall-back group to nnmail-split-methods if there isn't one."
;; check for fall-back: second element of last list of split methods is "".
(unless (or (eq nnmail-split-methods 'nnmail-split-fancy)
(string= ""
(cadr (elt nnmail-split-methods
(1- (length nnmail-split-methods))))))
;; add fall-back if there isn't one
(setq nnmail-split-methods
(append nnmail-split-methods (list (list "mail.misc" ""))))))
(add-hook 'nnmail-prepare-incoming-hook 'nnmail-split-methods-add-fall-back)
Thomas
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fallback for nnmail-split-methods
2002-04-20 9:19 Fallback for nnmail-split-methods Thomas Gehrlein
@ 2002-05-08 11:36 ` Kai Großjohann
2002-05-10 14:44 ` Frank Haun
2002-05-11 18:55 ` Paul Jarc
0 siblings, 2 replies; 6+ messages in thread
From: Kai Großjohann @ 2002-05-08 11:36 UTC (permalink / raw)
Cc: ding
Thomas.Gehrlein@t-online.de (Thomas Gehrlein) writes:
> nnmail-split-fancy has a fallback option for mails that don't match any of the
> splitting rules. nnmail-split-methods doesnt't provide a fallback. I
> discovered this after some of my mails had disappeared.
It appears that there is now some code which is supposed to do this:
the last group mentioned in nnmail-split-methods is used as the
fallback.
Can someone confirm this?
There is the following comment in the code:
;; Go through the split methods to find a match.
Some lines down, there is this snippet:
;; This is the final group, which is used as a
;; catch-all.
(unless group-art
(setq group-art
(list (cons (car method)
(funcall func (car method)))))))))
I think this does the trick, but I haven't tested it. Could you test
it?
kai
--
Silence is foo!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fallback for nnmail-split-methods
2002-05-08 11:36 ` Kai Großjohann
@ 2002-05-10 14:44 ` Frank Haun
2002-05-11 18:00 ` Kai Großjohann
2002-05-11 18:55 ` Paul Jarc
1 sibling, 1 reply; 6+ messages in thread
From: Frank Haun @ 2002-05-10 14:44 UTC (permalink / raw)
Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) writes:
> Thomas.Gehrlein@t-online.de (Thomas Gehrlein) writes:
>
> > nnmail-split-fancy has a fallback option for mails that don't match
> > any of the splitting rules. nnmail-split-methods doesnt't provide a
> > fallback. I discovered this after some of my mails had disappeared.
>
> It appears that there is now some code which is supposed to do this:
> the last group mentioned in nnmail-split-methods is used as the
> fallback.
>
> Can someone confirm this?
>
> There is the following comment in the code:
>
> ;; Go through the split methods to find a match.
>
> Some lines down, there is this snippet:
>
> ;; This is the final group, which is used as a
> ;; catch-all.
> (unless group-art
> (setq group-art
> (list (cons (car method)
> (funcall func (car method)))))))))
>
> I think this does the trick, but I haven't tested it. Could you test
> it?
I've tested it, and it doesn't work correctly.
For testing I've made some cron mails:
| From: fhaun (Cron Daemon)
| To: fhaun
| Subject: Cron <fhaun@pille> echo "Hello Frank"
with this split settings:
(setq nnmail-split-methods
'(
("CronJobs" "^\\(From:\\).*Cron Daemon")
("MailingList-cdwrite" "^\\(To:\\|Cc:\\).*cdwrite.*debian.org")
("MailingList-cygwin-announce" "^\\(To:\\|From:\\).*cygwin-announce")
("SYSTEM" "^\\(From:\\).*Charlie Root <root>")
("Unsorted" "")))
the cron mails go to "CronJobs", good. Then I set the split to:
(setq nnmail-split-methods
'(
("SYSTEM" "^\\(From:\\).*Charlie Root <root>")))
and the cron mails go to "SYSTEM", good. Then I set the split to:
(setq nnmail-split-methods
'(
("MailingList-cdwrite" "^\\(To:\\|Cc:\\).*cdwrite.*debian.org")
("MailingList-cygwin-announce" "^\\(To:\\|From:\\).*cygwin-announce")
("SYSTEM" "^\\(From:\\).*Charlie Root <root>")
and all the cron mails vanished, bad.
Message Buffer says:
nnml: Reading incoming mail from file...
nnml: Reading incoming mail (1 new)...done
Frank
--
line-move: End of buffer [42 times]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fallback for nnmail-split-methods
2002-05-10 14:44 ` Frank Haun
@ 2002-05-11 18:00 ` Kai Großjohann
0 siblings, 0 replies; 6+ messages in thread
From: Kai Großjohann @ 2002-05-11 18:00 UTC (permalink / raw)
Cc: ding
Frank Haun <pille3000@gmx.net> writes:
> (setq nnmail-split-methods
> '(
> ("SYSTEM" "^\\(From:\\).*Charlie Root <root>")))
>
> and the cron mails go to "SYSTEM", good. Then I set the split to:
>
> (setq nnmail-split-methods
> '(
> ("MailingList-cdwrite" "^\\(To:\\|Cc:\\).*cdwrite.*debian.org")
> ("MailingList-cygwin-announce" "^\\(To:\\|From:\\).*cygwin-announce")
> ("SYSTEM" "^\\(From:\\).*Charlie Root <root>")
>
> and all the cron mails vanished, bad.
I think this means that the fallback mechanism works if
nnmail-split-methods has only one element, whereas it fails if it has
more than one element.
Hm.
kai
--
Silence is foo!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fallback for nnmail-split-methods
2002-05-08 11:36 ` Kai Großjohann
2002-05-10 14:44 ` Frank Haun
@ 2002-05-11 18:55 ` Paul Jarc
2002-05-11 21:01 ` Kai Großjohann
1 sibling, 1 reply; 6+ messages in thread
From: Paul Jarc @ 2002-05-11 18:55 UTC (permalink / raw)
Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai Großjohann) wrote:
> Thomas.Gehrlein@t-online.de (Thomas Gehrlein) writes:
>> nnmail-split-fancy has a fallback option for mails that don't match
>> any of the splitting rules. nnmail-split-methods doesnt't provide
>> a fallback. I discovered this after some of my mails had
>> disappeared.
>
> It appears that there is now some code which is supposed to do this:
> the last group mentioned in nnmail-split-methods is used as the
> fallback.
Wouldn't it be less surprising and more reliable to use a constant
fallback "bogus", just like nnmail-split-fancy?
paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Fallback for nnmail-split-methods
2002-05-11 18:55 ` Paul Jarc
@ 2002-05-11 21:01 ` Kai Großjohann
0 siblings, 0 replies; 6+ messages in thread
From: Kai Großjohann @ 2002-05-11 21:01 UTC (permalink / raw)
prj@po.cwru.edu (Paul Jarc) writes:
> Wouldn't it be less surprising and more reliable to use a constant
> fallback "bogus", just like nnmail-split-fancy?
Good idea, actually. Especially since it seems that the fallback
only works when (= (length nnmail-split-methods) 1).
kai
--
Silence is foo!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-05-11 21:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-20 9:19 Fallback for nnmail-split-methods Thomas Gehrlein
2002-05-08 11:36 ` Kai Großjohann
2002-05-10 14:44 ` Frank Haun
2002-05-11 18:00 ` Kai Großjohann
2002-05-11 18:55 ` Paul Jarc
2002-05-11 21:01 ` Kai Großjohann
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).