From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: gnus Split Rules to SIEVE Date: Mon, 21 Sep 2015 00:20:57 +0200 Message-ID: <87h9mo3f7a.fsf@debian.uxu> References: <3d1b340d392ba0a0f6a044c4b5bd0f35@esben-stien.name> <9b40dd334b4abba6de568b9c80e0679b@esben-stien.name> <20150920182624.7282.2800CCB1@ahiker.mooo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1442787182 2143 80.91.229.3 (20 Sep 2015 22:13:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 20 Sep 2015 22:13:02 +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:12:53 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 1Zdmqr-0006EI-6n for geh-help-gnu-emacs@m.gmane.org; Mon, 21 Sep 2015 00:12:53 +0200 Original-Received: from localhost ([::1]:53935 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zdmqq-00016M-OS for geh-help-gnu-emacs@m.gmane.org; Sun, 20 Sep 2015 18:12:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:56125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zdmqe-00015t-5U for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 18:12:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zdmqa-00017T-VT for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 18:12:40 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:50107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zdmqa-00017N-Op for help-gnu-emacs@gnu.org; Sun, 20 Sep 2015 18:12:36 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZdmqV-0005ee-UX for help-gnu-emacs@gnu.org; Mon, 21 Sep 2015 00:12:32 +0200 Original-Received: from nl106-137-244.student.uu.se ([130.243.137.244]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Sep 2015 00:12:31 +0200 Original-Received: from embe8573 by nl106-137-244.student.uu.se with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Sep 2015 00:12:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: help-gnu-emacs@gnu.org Original-Lines: 60 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nl106-137-244.student.uu.se Mail-Copies-To: never User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) Cancel-Lock: sha1:a4K8RYJH3AoTPmncSi9VOzRqmtA= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:107257 Archived-At: Ian Zimmerman 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" "" { 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