all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: gnus Split Rules to SIEVE
Date: Mon, 21 Sep 2015 00:20:57 +0200	[thread overview]
Message-ID: <87h9mo3f7a.fsf@debian.uxu> (raw)
In-Reply-To: 20150920182624.7282.2800CCB1@ahiker.mooo.com

Ian Zimmerman <itz@buug.org> writes:

>> I've found a few threads pertaining to this, but
>> it's still unclear to me if there's a way to just
>> directly convert gnus split rules to SIEVE format?
>
> Not the answer you wanted, but it is very easy to
> write a Lisp program to do so.

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

(By the way, the reason I have that piece of code is
I used it to get newsgroups out of mailing lists that
way, before I realized there was Gmane which does
exactly that, and much better - so I don't recommend
anyone doing it like that, tho what I remember it
worked mostly fine.)

Anyway, SIEVE, on the other hand, looks like this:

    # Reject mails from the hunting enthusiasts at example.com.
    if header :contains "list-id" "<duck-hunting.example.com>"
    {
        reject "No violence, please";
    }

    # The two test below are equivalent;
    # The first variant is clearer and probably also more efficient.
    if address :is :domain "to" "example.com"
    {
        fileinto "examplecom";
    }
    if address :matches :all "to" "*@example.com"
    {
        fileinto "examplecom";
    }

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.

Why not just write the SIEVE and feel good about it?
Here is a tutorial, which is also where I found the
SIEVE syntax examples:

    https://www.tty1.net/blog/2011/sieve-tutorial_en.html

-- 
underground experts united
http://user.it.uu.se/~embe8573




  reply	other threads:[~2015-09-20 22:20 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-20 12:16 gnus Split Rules to SIEVE b0ef
2015-09-20 17:45 ` b0ef
2015-09-20 18:27   ` Ian Zimmerman
2015-09-20 22:20     ` Emanuel Berg [this message]
2015-09-20 22:44       ` Ian Zimmerman
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

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

  git send-email \
    --in-reply-to=87h9mo3f7a.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.