From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Zimmerman Newsgroups: gmane.emacs.help Subject: Re: gnus Split Rules to SIEVE Date: Sun, 20 Sep 2015 15:44:49 -0700 Message-ID: <20150920223506.9499.1BF89E81@ahiker.mooo.com> References: <3d1b340d392ba0a0f6a044c4b5bd0f35@esben-stien.name> <9b40dd334b4abba6de568b9c80e0679b@esben-stien.name> <20150920182624.7282.2800CCB1@ahiker.mooo.com> <87h9mo3f7a.fsf@debian.uxu> Reply-To: help-gnu-emacs@gnu.org NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1442789114 28923 80.91.229.3 (20 Sep 2015 22:45:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Sep 2015 22:45:14 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 21 00:45:07 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZdnM2-0008RS-JD for geh-help-gnu-emacs@m.gmane.org; Mon, 21 Sep 2015 00:45:06 +0200 Original-Received: from localhost ([::1]:54049 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdnM1-0001fJ-Ps for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Sep 2015 18:45:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdnLq-0001f6-MJ for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 18:44:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZdnLn-0008VM-FX for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 18:44:54 -0400 Original-Received: from ahiker.mooo.com ([173.255.215.69]:40420) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZdnLn-0008VE-9p for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 18:44:51 -0400 Original-Received: from localhost ([127.0.0.1] helo=ahiker.mooo.com) by ahiker.mooo.com with smtp (Exim 4.80) (envelope-from ) id 1ZdnLl-0002Uu-Tk for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 15:44:49 -0700 Content-Disposition: inline In-Reply-To: <87h9mo3f7a.fsf@debian.uxu> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 173.255.215.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107258 Archived-At: 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.