help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnus Split Rules to SIEVE


From: Ian Zimmerman
Subject: Re: gnus Split Rules to SIEVE
Date: Sun, 20 Sep 2015 15:44:49 -0700
User-agent: Mutt/1.5.21 (2010-09-15)

On 2015-09-21 00:20 +0200, Emanuel Berg wrote:

> Gnus splitting rules look like this:
> 
>     (setq nnmail-split-methods
>      '(("spam-ooa"     "^X-Spam-Flag: YES\\|\\(^Subject: \\(lists.bofh.it 
> mailing list memberships reminder\\|Happy Birthday From Facebook\\)\\)")
>        ("zsh"          
> "^\\(Cc\\|\\(Resent-\\)?To\\):.*zsh-\\(announce\\|workers\\|users\\)@zsh\.org.*")
>        ("debian.user"  
> "^\\(Cc\\|\\(Resent-\\)?To\\):.*debian-user@lists\.debian\.org.*")
>        ("cc"           "^\\(Newsgroups: 
> gnu.emacs.help\\)\\|\\(Cc\\|\\(Resent-\\)?To\\):.*\\(emacs-devel\\|help-gnu-emacs\\|info-gnus-english\\)@gnu\.org.*")
>        ("spam-ooa"     
> "^\\(Cc\\|\\(Resent-\\)?To\\):.*l4-hackers@os\.inf\.tu-dresden\.de.*")
>        ("emacs-w3m"    "^Subject: \\(Re: \\)*\\[emacs-w3m.*")
>        ("mail.misc"    "") ))

> To write a Lisp program that translates from Gnus splitting rules into
> the SIEVE syntax is a challenge to any programmer. This isn't to say
> anyone should do it. It will be a big effort for a small gain.

(Apologies in advance if long lines in Emanuel's code mess up a reader's
display.) 

It is only a challenge if you write your gnus rules like this, relying
on regexps operators instead of doing it the natural Lisp way.  Roughly
like this:

> (setq nnmail-split-methods
>  '(("spam-ooa" "^X-Spam-Flag: YES")
>    ("spam-ooa" "^Subject: lists.bofh.it mailing list memberships reminder")
>    ("spam-ooa"     "^Subject: Happy Birthday From Facebook")

I believe this style would be easy to translate.

(Btw., you can match regexps with Sieve too, at least with a decent
implementation which includes the requisite plugin.  Dovecot does.)

-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]