unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Ian Zimmerman <itz@buug.org>
To: help-gnu-emacs@gnu.org
Subject: Re: gnus Split Rules to SIEVE
Date: Sun, 20 Sep 2015 15:44:49 -0700	[thread overview]
Message-ID: <20150920223506.9499.1BF89E81@ahiker.mooo.com> (raw)
In-Reply-To: <87h9mo3f7a.fsf@debian.uxu>

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	other threads:[~2015-09-20 22:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3d1b340d392ba0a0f6a044c4b5bd0f35@esben-stien.name>
2015-09-20 17:45 ` gnus Split Rules to SIEVE b0ef
2015-09-20 18:27   ` Ian Zimmerman
2015-09-20 22:20     ` Emanuel Berg
2015-09-20 22:44       ` Ian Zimmerman [this message]
2015-09-20 23:55         ` Emanuel Berg
2015-09-21  0:45           ` Ian Zimmerman
2015-09-21  1:06             ` Emanuel Berg
2015-09-21  2:36             ` Emanuel Berg
2015-09-21  3:17           ` Esben Stien
2015-09-22  0:00             ` Emanuel Berg
2015-09-22 23:57               ` Esben Stien
2015-09-23  0:23                 ` Emanuel Berg
2015-09-23  1:16               ` Ian Zimmerman
2015-09-23  1:52                 ` Emanuel Berg
2015-09-23  8:46                   ` tomas
2015-09-25  0:28                     ` Emanuel Berg
2015-09-25  7:16                       ` tomas
2015-09-26  1:58                         ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150920223506.9499.1BF89E81@ahiker.mooo.com \
    --to=itz@buug.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).